VERSION="v0.35/$rev"
VERSIONSTRING="\
Build package utility from PLD Linux Packages repository
-$VERSION (C) 1999-2011 Free Penguins".
+$VERSION (C) 1999-2012 Free Penguins".
PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
# See LOGFILE example.
DATE=`date +%Y-%m-%d_%H-%M-%S`
+# target arch, can also be used for log file naming
+TARGET=$(rpm -E %{_target})
+
# Example: LOGFILE='../log.$PACKAGE_NAME'
# Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
# Example: LOGFILE='$PACKAGE_NAME/$PACKAGE_NAME.$DATE.log'
GROUP_BCONDS="no"
# create symlinks for tools in PACKAGE_DIR, see get_spec()
-SYMLINK_TOOLS="yes"
+SYMLINK_TOOLS="no"
PATCHES=""
SOURCES=""
PACKAGE_NAME=""
ASSUMED_NAME=""
PROTOCOL="http"
+
+# use lftp by default when available
+USE_LFTP=
+lftp --version > /dev/null 2>&1 && USE_LFTP=yes
+PARALLEL_DOWNLOADS=10
+
WGET_RETRIES=${MAX_WGET_RETRIES:-0}
CVS_FORCE=""
CVSIGNORE_DF="yes"
CVSTAG=""
-GIT_SERVER="git@git.tld-linux.org"
+GIT_SERVER="git://git.pld-linux.org"
+GIT_PUSH="git@git.pld-linux.org"
PACKAGES_DIR="packages"
HEAD_DETACHED=""
DEPTH=""
RES_FILE=""
-DISTFILES_SERVER="://df.tld-linux.org"
+DISTFILES_SERVER="://distfiles.pld-linux.org"
ATTICDISTFILES_SERVER="://attic-distfiles.pld-linux.org"
DEF_NICE_LEVEL=19
fi
fi
+UPDATE_POLDEK_INDEXES_OPTS=""
# Here we load saved user environment used to
# predefine options set above, or passed to builder
# Example of ~/.builderrc:
#
#UPDATE_POLDEK_INDEXES="yes"
+#UPDATE_POLDEK_INDEXES_OPTS="--mo=nodiff"
#FETCH_BUILD_REQUIRES="yes"
#REMOVE_BUILD_REQUIRES="force"
#GROUP_BCONDS="yes"
[ -f "$USER_CFG" ] && . "$USER_CFG"
-if [ -n "$GIT_LOGINNAME" ]; then
- GIT_SERVER="git@git.tld-linux.org"
-fi
-
if [ "$SCHEDTOOL" = "auto" ]; then
if [ -x /usr/bin/schedtool ] && schedtool -B -e echo >/dev/null; then
SCHEDTOOL="schedtool -B -e"
GETURI="axel -a $AXEL_OPTS"
GETURI2="$GETURI"
OUTFILEOPT="-o"
+elif [ -n "$USE_LFTP" ]; then
+ GETURI=download_lftp
+ GETURI2=$GETURI
+ OUTFILEOPT=""
else
wget --help 2>&1 | grep -q -- ' --no-check-certificate ' && WGET_OPTS="$WGET_OPTS --no-check-certificate"
wget --help 2>&1 | grep -q -- ' --inet ' && WGET_OPTS="$WGET_OPTS --inet"
GETLOCAL="cp -a"
-if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
+if rpm --version 2>&1 | grep -q '4.0.[0-2]'; then
RPM="rpm"
RPMBUILD="rpm"
else
#---------------------------------------------
# functions
+download_lftp() {
+ local outfile=$1 url=$2 retval tmpfile
+ # TODO: use mktemp
+ tmpfile=$outfile.tmp
+ lftp -c "
+ $([ "$DEBUG" = "yes" ] && echo "debug 5;")
+ set ssl:verify-certificate no;
+ set net:max-retries $WGET_RETRIES;
+ set http:user-agent \"$USER_AGENT\";
+ pget -n $PARALLEL_DOWNLOADS -c \"$url\" -o \"$tmpfile\"
+ "
+
+ retval=$?
+ if [ $retval -eq 0 ]; then
+ mv -f "$tmpfile" "$outfile"
+ else
+ rm -f "$tmpfile"
+ fi
+ return $retval
+}
+
usage() {
if [ -n "$DEBUG" ]; then set -xv; fi
echo "\
[--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
<package>[.spec][:tag]
+-4 - force ipv4 when transferring files
-5, --update-md5 - update md5 comments in spec, implies -nd -ncs
+-6 - force ipv6 when transferring files
-a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
---all-branches - make shallow fetch of all branches; --depth required
+--all-branches - make shallow fetch of all branches; --depth required
-n5, --no-md5 - ignore md5 comments in spec
-D, --debug - enable builder script debugging mode,
-debug - produce rpm debug package (same as --opts -debug)
-bp, --build-prep - execute the %prep phase of <package>.spec,
-bc - execute the %build phase of <package>.spec,
-bi - execute the %install phase of <package>.spec
--bl - execute the %files phase of <package>.spec
+-bl - execute the %files phase of <package>.spec
-bs, --build-source - get all files from PLD repo or HTTP/FTP and only pack
them into src.rpm,
--short-circuit - short-circuit build
-c, --clean - clean all temporarily created files (in BUILD\$RPM_BUILD_ROOT) after rpmbuild commands.
may be used with building process.
-m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
- SPECS and \$RPM_BUILD_ROOT). Doesn't run
- any rpm building.
--cf, --cvs-force - use -f when tagging
+ SPECS and \$RPM_BUILD_ROOT). Doesn't run any rpm building.
+-cf, --cvs-force - use -f when tagging
--define <macro> <value>
- define a macro <macro> with value <value>,
---depth <number>
- - make shallow fetch
+--depth <number> - make shallow fetch
--alt_kernel <kernel>
- same as --define 'alt_kernel <kernel>'
--nodeps - rpm won't check any dependences
-ns, --no-srcs - don't download Sources/Patches
-ns0, --no-source0 - don't download Source0
-nn, --no-net - don't download anything from the net
--pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
+-pN, -p N - set PARALLEL_DOWNLOADS to N (default $PARALLEL_DOWNLOADS)
+-pm, --prefer-mirrors
+ - prefer mirrors (if any) over distfiles for SOURCES
--no-init - don't initialize builder paths (SPECS and SOURCES)
-ske,
---skip-existing-files - skip existing files in get_files
+--skip-existing-files
+ - skip existing files in get_files
--opts <rpm opts> - additional options for rpm
-q, --quiet - be quiet,
--date yyyy-mm-dd - build package using resources from specified date,
-FRB, --force-remove-build-requires
- remove all you fetched with -R or --fetch-build-requires
remember, this option works without confirmation,
--sd, --source-distfiles - list sources available from distfiles (intended for offline
+-sd, --source-distfiles
+ - list sources available from distfiles (intended for offline
operations; does not work when Icon field is present
but icon file is absent),
--sc, --source-cvs - list sources available from PLD repo
--sdp, --source-distfiles-paths - list sources available from distfiles -
+-sc, --source-cvs - list sources available from PLD repo
+-sdp, --source-distfiles-paths
+ - list sources available from distfiles -
paths relative to distfiles directory (intended for offline
operations; does not work when Icon field is present
but icon file is absent),
-sf, --source-files - list sources - bare filenames (intended for offline
operations; does not work when Icon field is present
but icon file is absent),
--lsp, --source-paths - list sources - filenames with full local paths (intended for
+-lsp, --source-paths
+ - list sources - filenames with full local paths (intended for
offline operations; does not work when Icon field is present
but icon file is absent),
-su, --source-urls - list urls - urls to sources and patches
-u, --try-upgrade - check version, and try to upgrade package
-un, --try-upgrade-with-float-version
- as above, but allow float version
- php-pear-Services_Digg/
+ php-pear-Services_Digg/
--upgrade-version - upgrade to specified version in try-upgrade
-U, --update - refetch sources, don't use distfiles, and update md5 comments
-Upi, --update-poldek-indexes
- abort instead of applying patch <patchnumber>
--show-bconds - show available conditional builds, which can be used
- with --with and/or --without switches.
---show-bcond-args - show active bconds, from ~/.bcondrc. this is used by
- ./repackage.sh script. in other words, the output is
- parseable by scripts.
+--show-bcond-args - show active bconds, from ~/.bcondrc. this is used by ./repackage.sh script.
+ In other words, the output is parseable by scripts.
--show-avail-bconds - show available bconds
--with/--without <feature>
- conditional build package depending on %_with_<feature>/
--with feat1 feat2 feat3 --without feat4 feat5 --with feat6
constructions. Set GROUP_BCONDS to yes to make use of it.
--target <platform>, --target=<platform>
- - build for platform <platform>.
---init-rpm-dir - initialize ~/rpm directory structure
+ - build for platform <platform>.
+--init-rpm-dir - initialize ~/rpm directory structure
"
}
mktemp -t builder.XXXXXX || ${TMPDIR:-/tmp}/builder.$RANDOM.$$
}
+tempdir() {
+ mktemp -d builder.XXXXXX
+}
+
# inserts git log instead of %changelog
# outputs name of modified file created by tempfile
insert_gitlog() {
- local SPECFILE=$1 specfile=$(tempfile) gitlog=$(tempfile) speclog=$(tempfile)
+ local SPECFILE=$1 specdir=$(tempdir) gitlog=$(tempfile) speclog=$(tempfile)
# allow this being customized
local log_entries=$(rpm -E '%{?_buildchangelogtruncate}')
# http://rpm.org/gitweb?p=rpm.git;a=blob;f=build/parseChangelog.c#l31
# NOTE: changelog date is always in UTC for rpmbuild
# * 1265749244 +0000 Random Hacker <nikt@pld-linux.org> 9370900
- git log -${log_entries:-20} --format=format:"* %ad %an <%ae> %h%n%s%n" --date=raw > $gitlog
- gawk '/^\* /{printf("* %s %s\n", strftime("%a %b %d %Y", $2), substr($0, length($1)+length($2)+length($3)+4)); next}{print}' $gitlog > $speclog
+ git rev-list -${log_entries:-20} HEAD | while read sha1; do
+ local logfmt='%B%n'
+ git notes list $sha1 &> /dev/null && logfmt=%N
+ git log -n 1 $sha1 --format=format:"* %ad %an <%ae> %h%n${logfmt}%n" --date=raw | sed '/^$/q'
+ done > $gitlog
+ LC_ALL=C gawk '/^\* /{printf("* %s %s\n", strftime("%a %b %d %Y", $2), substr($0, length($1)+length($2)+length($3)+4)); next}{print}' $gitlog > $speclog
sed '/^%changelog/,$d' $SPECFILE | sed -e "\${
a%changelog
r $speclog
}
- " > $specfile
+ " > $specdir/$SPECFILE
rm -f $gitlog $speclog
- echo $specfile
+ echo $specdir
}
# change dependency to specname
cd $PACKAGE_DIR
cache_rpm_dump
- if (rpm_dump | grep -qEi ":.*nosource.*1"); then
+ if rpm_dump | grep -qEi ":.*nosource.*1"; then
FAIL_IF_NO_SOURCES="no"
fi
exit 101
fi
[ -d "$ASSUMED_NAME/.git" ] || NEW_REPO=yes
- ssh $GIT_SERVER create ${ASSUMED_NAME} || Exit_error err_cvs_add_failed
+ # ssh $GIT_SERVER create ${ASSUMED_NAME} || Exit_error err_cvs_add_failed
git init
- git remote add $REMOTE_PLD ${GIT_SERVER}:${PACKAGES_DIR}/${ASSUMED_NAME}.git || Exit_error err_remote_problem $REMOTE_PLD
+ git remote add $REMOTE_PLD ${GIT_SERVER}/${PACKAGES_DIR}/${ASSUMED_NAME}.git && \
+ git remote set-url --push $REMOTE_PLD ssh://${GIT_PUSH}/${PACKAGES_DIR}/${ASSUMED_NAME} \
+ || Exit_error err_remote_problem $REMOTE_PLD
}
get_spec() {
else
(
unset GIT_WORK_TREE
- git clone -o $REMOTE_PLD ${GIT_SERVER}:${PACKAGES_DIR}/${ASSUMED_NAME}.git "$REPO_DIR/${ASSUMED_NAME}" || {
+ git clone -o $REMOTE_PLD ${GIT_SERVER}/${PACKAGES_DIR}/${ASSUMED_NAME}.git || {
# softfail if new package, i.e not yet added to PLD rep
[ ! -f "$ASSUMED_NAME/$SPECFILE" ] && Exit_error err_no_spec_in_repo
echo "Warning: package not in CVS - assuming new package"
NOCVSSPEC="yes"
}
+ git remote set-url --push $REMOTE_PLD ssh://${GIT_PUSH}/${PACKAGES_DIR}/${ASSUMED_NAME}
)
fi
else
exit 3
}
fi
+ git fetch $REMOTE_PLD 'refs/notes/*:refs/notes/*'
cvsignore_df .gitignore
# create symlinks for tools
if [ "$SYMLINK_TOOLS" != "no" ]; then
for a in dropin md5 adapter builder {relup,compile,repackage,pearize}.sh pldnotify.awk; do
+ # skip tools that don't exist in top dir
[ -f $a ] || continue
- ln -sf ../$a $ASSUMED_NAME
+ # skip tools that already exist
+ [ -f $ASSUMED_NAME/$a ] && continue
+ ln -s ../$a $ASSUMED_NAME
cvsignore_df $a
done
fi
cd "$REPO_DIR"
local url="$1"
if [ ! -f "mirrors" ] ; then
- ln -s scripts/mirrors .
+ ln -s rpm-build-tools/mirrors .
fi
IFS="|"
# Warning: unpredictable results if same URL used twice
src_no() {
+ local file="$1"
+ # escape some regexp characters if part of file name
+ file=$(echo "$file" | sed -e 's#\([\+\*\.\&\#\?]\)#\\\1#g')
cd $PACKAGE_DIR
rpm_dump | \
- grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
- sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
- head -n 1 | xargs
+ grep -E "(SOURCE|PATCH)URL[0-9]*[ ]*${file}""[ ]*$" | \
+ sed -e 's/.*\(SOURCE\|PATCH\)URL\([0-9][0-9]*\).*/\1\2/' | \
+ head -n 1 | tr OURCEATH ourceath | xargs
}
src_md5() {
fi
fi
- source_md5=`grep -i "^#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
+ source_md5=$(grep -iE "^#[ ]*(No)?$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://')
if [ -n "$source_md5" ]; then
echo $source_md5
else
else
# we have empty SourceX-md5, but it is still possible
# that we have NoSourceX-md5 AND NoSource: X
- nosource_md5=`grep -i "^#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
+ nosource_md5=`grep -i "^#[ ]*No$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" ] ; then
echo $nosource_md5
fi
local srcno=$(src_no "$i")
if [ -n "$ADD5" ]; then
[ "$fp" = "$i" ] && continue # FIXME what is this check doing?
- grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $PACKAGE_DIR/$SPECFILE && continue
+ grep -qiE '^#[ ]*'$srcno'-md5[ ]*:' $PACKAGE_DIR/$SPECFILE && continue
grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $PACKAGE_DIR/$SPECFILE && continue
else
- grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $PACKAGE_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $PACKAGE_DIR/$SPECFILE || continue
+ grep -qiE '^#[ ]*'$srcno'-md5[ ]*:' $PACKAGE_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $PACKAGE_DIR/$SPECFILE || continue
fi
if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
need_files="$need_files $i"
for i in "$@"; do
local fp=$(nourl "$i")
local srcno=$(src_no "$i")
- local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $PACKAGE_DIR/$SPECFILE )
+ local md5=$(grep -iE '^#[ ]*(No)?'$srcno'-md5[ ]*:' $PACKAGE_DIR/$SPECFILE )
if [ -z "$md5" ]; then
md5=$(grep -iE '^[ ]*BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $PACKAGE_DIR/$SPECFILE )
fi
if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
- local tag="# Source$srcno-md5:\t"
+ local tag="# $srcno-md5:\t"
if [[ "$md5" == *NoSource* ]]; then
- tag="# NoSource$srcno-md5:\t"
+ tag="# No$srcno-md5:\t"
elif [ -n "$USEDIGEST" ]; then
tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
fi
md5=$(md5sum "$fp" | cut -f1 -d' ')
- echo "Updating Source$srcno ($md5: $fp)."
+ echo "Updating $srcno ($md5: $fp)."
perl -i -ne '
- print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
- print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
+ print unless (/^\s*#\s*(No)?'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
+ print "'"$tag$md5"'\n" if /^'$srcno'\s*:\s+/i;
' \
$PACKAGE_DIR/$SPECFILE
fi
im="$i"
fi
update_shell_title "${GETURI%% *}: $im"
- ${GETURI} "$im" ${OUTFILEOPT} "$target" || \
+ ${GETURI} ${OUTFILEOPT} "$target" "$im" || \
if [ "`echo $im | grep -E 'ftp://'`" ]; then
update_shell_title "${GETURI2%% *}: $im"
- ${GETURI2} "$im" ${OUTFILEOPT} "$target"
+ ${GETURI2} ${OUTFILEOPT} "$target" "$im"
fi
test -s "$target" || rm -f "$target"
fi
fi
}
+tag_exist() {
+ local _tag="$1"
+ echo "Searching for tag $_tag..."
+ if [ -n "$DEPTH" ]; then
+ local ref=`git ls-remote $REMOTE_PLD "refs/tags/$_tag"`
+ [ -n "$ref" ] && echo "$ref" && Exit_error err_tag_exists "$_tag"
+ else
+ git show-ref "refs/tags/$_tag" && Exit_error err_tag_exists "$_tag"
+ fi
+}
+
make_tagver() {
if [ -n "$DEBUG" ]; then
set -x
fi
# NOTE: CVS tags may must not contain the characters `$,.:;@'
- TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE | tr '[.@]' '[_#]')
+ TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE)
- # Remove #kernel.version_release from TAGVER because tagging sources
+ # Remove @kernel.version_release from TAGVER because tagging sources
# could occur with different kernel-headers than kernel-headers used at build time.
# besides, %{_kernel_ver_str} is not expanded.
- # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1#%{_kernel_ver_str}
+ # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1@%{_kernel_ver_str}
# TAGVER=auto-ac-madwifi-ng-0-0_20070225_1
- TAGVER=${TAGVER%#*}
+ TAGVER=${TAGVER%@*}
echo -n "$TAGVER"
}
echo "LASTLOG=$LOG" > $LASTLOG_FILE
fi
RES_FILE=$(tempfile)
- local specfile=$(insert_gitlog $SPECFILE)
+ local specdir=$(insert_gitlog $SPECFILE)
- (time eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $specfile; echo $? > $RES_FILE) 2>&1 |tee $LOG
+ (time eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $specdir/$SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
RETVAL=`cat $RES_FILE`
- rm $RES_FILE $specfile
+ rm -r $RES_FILE $specdir
if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
if [ "$RETVAL" -eq "0" ]; then
mv $LOG $LOGDIROK
fi
fi
else
- BRLISTFILE=$(tempfile)
- eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $SPECFILE
+ local specdir=$(insert_gitlog $SPECFILE)
+ eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $specdir/$SPECFILE
RETVAL=$?
+ rm -r $specdir
fi
if [ "$RETVAL" -ne "0" ]; then
if [ -n "$TRY_UPGRADE" ]; then
fi
echo ""
fi
- # try to nicely show package list, to just copy&paste it to poldek or so...
- #eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $SPECFILE 2>$BRLISTFILE
- #BRLIST=$(awk 'BEGIN{ORS=" ";} NR>1 {print $1;}' $BRLISTFILE)
- #echo
- #echo "To install packages type:"
- #echo "poldek -ivh $BRLIST"
- #echo
- #echo "In poldek, copy these command:"
- #echo "install $BRLIST"
- #echo
- #rm $BRLISTFILE
Exit_error err_build_fail
fi
unset BUILD_SWITCH
# w32codec-installer license_agreement
# php +mysqli
# ---
- if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
+ if [ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ]); then
:
else
return
mkdir -p $TOP_DIR $rpmdir $buildir $srpmdir
cd "$TOP_DIR"
- if [ ! -e ../scripts ]; then
- git clone ${GIT_SERVER}:${PACKAGES_DIR}/scripts.git ../scripts
+ if [ ! -e ../rpm-build-tools ]; then
+ git clone ${GIT_SERVER}/${PACKAGES_DIR}/rpm-build-tools.git ../rpm-build-tools
fi
- for a in dropin md5 adapter builder mirrors {relup,compile,repackage,pearize}.sh pldnotify.awk; do
- ln -s ../scripts/$a .
+ for a in adapter builder; do
+ ln -s ../rpm-build-tools/${a}.sh $a
done
init_builder
}
DONT_PRINT_REVISION="yes"
# remove spec and sources
- $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" $PACKAGE_DIR/$SPECFILE
- rm -rf $PACKAGE_DIR/.git .gitignore
+ $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" --define "_builddir $builddir" $PACKAGE_DIR/$SPECFILE
+ rm -rf $PACKAGE_DIR/{.git,.gitignore}
rmdir --ignore-fail-on-non-empty $PACKAGE_DIR
}
while [ $# -gt 0 ]; do
case "${1}" in
+ -4|-6)
+ # NOTE: we should be fetcher specific, like fille WGET_OPTS, but
+ # unfortunately $GETURI is already formed
+ GETURI="$GETURI $1"
+ shift
+ ;;
-5 | --update-md5)
COMMAND="update_md5"
NODIST="yes"
RPMOPTS="${RPMOPTS} --define \"_smp_mflags $1\""
shift
;;
+ -p)
+ PARALLEL_DOWNLOADS=$2
+ shift 2
+ ;;
+ -p[0-9])
+ PARALLEL_DOWNLOADS=${1#-p}
+ shift
+ ;;
-l | --logtofile )
shift; LOGFILE="${1}"; shift ;;
-ni| --nice )
-FRB | --force-remove-build-requires)
REMOVE_BUILD_REQUIRES="force"
shift ;;
- -sc | --sources-cvs)
+ -sc | --source-cvs)
COMMAND="list-sources-cvs"
shift ;;
-sd | --source-distfiles)
# ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
if [ -n "$TEST_TAG" ]; then
local TAGVER=`make_tagver`
- echo "Searching for tag $TAGVER..."
- if [ -n "$DEPTH" ]; then
- local ref=`git ls-remote $REMOTE_PLD "refs/tags/$TAGVER"`
- [ -n "$ref" ] && echo "$ref" && Exit_error err_tag_exists "$TAGVER"
- else
- git show-ref "refs/tags/$TAGVER" && Exit_error err_tag_exists "$TAGVER"
- fi
+ tag_exist $TAGVER
+ # check also tags created in CVS
+ tag_exist $(echo $TAGVER | tr '[.@]' '[_#]')
# - do not allow to build from HEAD when XX-branch exists
- TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
+ TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto/\([a-zA-Z]\+\)/.*#\1#g')
if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
TAG_BRANCH="${TREE_PREFIX}-branch"
if [ -n "$DEPTH" ]; then
;;
*)
NODIST="yes" get_files $SOURCES $PATCHES
- update_md5 $SOURCES
+ update_md5 $SOURCES $PATCHES
;;
esac
build_package
- if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
- run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
+ if [ "$UPDATE_POLDEK_INDEXES" = "yes" ] && [ "$COMMAND" = "build" -o "$COMMAND" = "build-binary" ]; then
+ run_poldek --sdir="${POLDEK_INDEX_DIR}" ${UPDATE_POLDEK_INDEXES_OPTS} --mkidxz
fi
remove_build_requires
;;
if [ -n "$NOSOURCE0" ] ; then
SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
fi
- update_md5 $SOURCES
+ update_md5 $SOURCES $PATCHES
;;
"tag" )
NOURLS=1