USEDIGEST=
# user agent when fetching files
-USER_AGENT="PLD/Builder($VERSION)"
+USER_AGENT="TLD/Builder($VERSION)"
# It can be used i.e. in log file naming.
# See LOGFILE example.
WGET_RETRIES=${MAX_WGET_RETRIES:-0}
+# rsync repository with git refs of packages
+PKGREVS_URL="http://pkgrevs.tld-linux.org"
+
# TLD git/df config
TLD_GIT_SERVER="git://git.tld-linux.org"
TLD_GIT_PUSH="git@git.tld-linux.org"
[{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}]
[-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
[--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
+[--git-pld|--git-tld] [--pkgrev]
<package>[.spec][:tag]
-4 - force IPv4 when transferring files
--git-pld - force use of PLD git and distfiles
--git-tld - force use of TLD git and distfiles (note: it will fall
back to PLD git/df if package doesn't exist in TLD git)
+--pkgrev - write git revision of package being built into rsync repo
+ (note: only official TLD source builders are allowed to do so)
"
}
echo >&2 "Error: problem with remote (${2})"
exit 13 ;;
"err_no_checkut" )
- echo >&2 "Error: cannot checkout $2"
+ echo >&2 "Error: cannot checkout ${2}"
exit 14 ;;
+ "err_pkgrev_set" )
+ echo >&2 "Error: failed to set package revision for tag ${2}"
+ exit 15 ;;
+ "err_pkgrev_get" )
+ echo >&2 "Error: failed to get package revision for tag ${2}"
+ exit 16 ;;
"err_not_implemented" )
remove_build_requires
echo >&2 "Error: functionality not yet imlemented"
fi
if [ -n "$CVSTAG" ]; then
+ local _rev=$(get_pkgrev "$CVSTAG")
+ echo "$_rev" | grep -q -E "^ERROR$" || CVSTAG="$_rev"
if git rev-parse --verify -q "$CVSTAG"; then
git checkout "$CVSTAG" --
elif git rev-parse --verify -q "refs/remotes/${REMOTE_PLD}/$CVSTAG"; then
fi
}
+get_pkgrev() {
+ [ -z "$1" ] && return 1
+ local _tmp=$(mktemp /tmp/.builder-XXXX)
+ rm $_tmp 2>/dev/null
+ $GETURI $OUTFILEOPT $_tmp $PKGREVS_URL/get/$1 1>/dev/null 2>&1 || Exit_error err_pkgrev_get "$1"
+ local result=$(cat $_tmp)
+ rm $_tmp 2>/dev/null
+ echo -n "$result"
+}
+
+set_pkgrev() {
+ local _tag
+ if [ "$TAG_VERSION" = "yes" ]; then
+ _tag=`make_tagver`
+ fi
+ if [ -n "$TAG" ]; then
+ _tag="$TAG"
+ fi
+ echo "Writing git revision for tag $_tag"
+ local _tmp=$(mktemp /tmp/.builder-XXXX)
+ rm $_tmp 2>/dev/null
+ local _rev=$(git rev-parse HEAD)
+ $GETURI $OUTFILEOPT $_tmp $PKGREVS_URL/set/$_rev/$_tag 1>/dev/null 2>&1 || Exit_error err_pkgrev_get "$1"
+ local result=$(cat $_tmp)
+ rm $_tmp 2>/dev/null
+ echo "$result" | grep -q -E "^OK$" && return 0
+ echo "$result" | grep -q -E "^EXISTS$" && Exit_error err_tag_exists "$_tag"
+ Exit_error err_pkgrev_set
+}
+
branch_files() {
TAG=$1
echo "Git branch: $TAG"
DISTFILES_SERVER=${TLD_DISTFILES_SERVER}
ATTICDISTFILES_SERVER=${TLD_ATTICDISTFILES_SERVER}
;;
+ --pkgrev)
+ COMMAND="set_pkgrev"
+ shift;;
-*)
Exit_error err_invalid_cmdline "$1"
;;
# Check if given package exists in TLD git
if ! git ls-remote --heads ${GIT_SERVER}/${PACKAGES_DIR}/${ASSUMED_NAME} 1>/dev/null 2>&1; then
- # Nope, we don't have it in TLD, switch for PLD repositories
+ # Nope, we don't have it in TLD, switch to PLD repositories
GIT_SERVER=${PLD_GIT_SERVER}
GIT_PUSH=${PLD_GIT_PUSH}
PACKAGES_DIR=${PLD_PACKAGES_DIR}
# ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
if [ -n "$TEST_TAG" ]; then
- local TAGVER=`make_tagver`
+ local TAGVER=`
+ make_tagver`
tag_exist $TAGVER || [ $TAGVER = $CVSTAG ] || Exit_error err_tag_exists $TAGVER
# check also tags created in CVS
local TAGVER_CVS=$(echo $TAGVER | tr '[.@]' '[_#]')
"version" )
echo "$VERSIONSTRING"
;;
+ "set_pkgrev" )
+ init_builder
+ if [ -z "$SPECFILE" ]; then
+ Exit_error err_no_spec_in_cmdl
+ fi
+ get_spec > /dev/null
+ parse_spec
+ set_bconds_values
+ display_bconds
+ set_pkgrev
+ ;;
esac
if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"