From 1e2ba88e57f55d75f065bbc4394c867b1b7b4ad4 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 16 Aug 2012 11:41:10 +0200 Subject: [PATCH] autodist: improved management of skipped packages, delayed repository and other small fixes --- autodist | 72 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/autodist b/autodist index 09b7988..4bc51cd 100755 --- a/autodist +++ b/autodist @@ -504,7 +504,7 @@ function launch_pkgs_loop() { if [ $JOB_IDX -eq 0 -a "$do_autobuild" ]; then # preserve specfile modification date if [ -e $AUTOUPDATEDIR/spec-patches-$patch_operation/$pkg.spec.patch ]; then - echo -n "== " + echo -n "?= " patch -p1 $spec_dir/$pkg.spec $AUTOUPDATEDIR/spec-patches-$patch_operation/$pkg.spec.patch || { case $SEVERITY in 0) ;; @@ -548,6 +548,28 @@ function launch_pkgs_loop() { [ -e "$SRCPKGLIST" ] && PKGLINE=`grep "^${pkg} " $SRCPKGLIST` || PKGLINE= [ -e "$SRCPKGLIST_DELAYED" ] && PKGLINE_DELAYED=`grep "^${pkg} " $SRCPKGLIST_DELAYED` || PKGLINE_DELAYED= + if [ "$PKGLINE_DELAYED" -a "$do_autobuild" ]; then + set -- $PKGLINE + _ver1=$2 + _rel1=$6 + set -- $PKGLINE_DELAYED + _ver2=$2 + _rel2=$6 + version_find_bigger ${_ver1} ${_ver2} + if [ $? -eq 2 ]; then + PKGLINE=$PKGLINE_DELAYED + echo "!! Warning: using package from delayed repository (${_ver2} > ${_ver1})" + elif [ $? -eq 0 ]; then + version_find_bigger ${_rel1} ${_rel2} + if [ $? -eq 0 ]; then + echo "!! Warning: package with same version (${_ver1}-${_rel1}) exists in delayed repository" + elif [ $? -eq 2 ]; then + echo "!! Warning: using package from delayed repository (${_ver2}-${_rel2} > ${_ver1}-${_rel1})" + PKGLINE=$PKGLINE_DELAYED + fi + fi + fi + case $operation in prepare) command_opts="-a1" @@ -570,10 +592,12 @@ function launch_pkgs_loop() { if [ "$PKGLINE" ]; then set -- $PKGLINE pkglinever=$2 - # warning: assuming version is passed first + # warning: asasuming version is passed first version_find_bigger "${passed_arguments/ *}" "$pkglinever" [ $? -eq 1 ] || { echo "!! Warning: skipping ${pkg} package already up to date ($pkglinever >= ${passed_arguments/ *})." + echo "%% Adding ${pkg} job to skipped list." + echo "${pkg} $DATE_NOW 255" >> $SKIPPEDLISTDIR/auto.skip continue } fi @@ -584,6 +608,8 @@ function launch_pkgs_loop() { set -- $PKGLINE_DELAYED if [ "$SPEC_VERSION-$SPEC_RELEASE" = "$2-$6" ]; then echo "!! Warning: skipping ${pkg} package build because already present in delayed repository." + echo "%% Adding ${pkg} job to skipped list." + echo "${pkg} $DATE_NOW 254" >> $SKIPPEDLISTDIR/auto.skip continue fi fi @@ -647,7 +673,8 @@ function launch_pkgs_loop() { command="$AUTOSPEC_CMD -u $pkg $command_opts $passed_arguments $JOB_ARGS" - tmpfile=`tempfile` + tmpfile=${LOGBASEDIR}/current.$$ + > $tmpfile tmpfile1=`tempfile` echo -n "== "`log_date`" $JOB_NAME with args: $JOB_ARGS..." >> $LOGFILE echo " @@ -717,12 +744,12 @@ function launch_pkgs_loop() { ;; update|autoupdate) cp $spec_dir/$pkg.spec $spec_dir/.$pkg.spec.autodist.prebuild - SPEC_EPOCH=`grep "Epoch:" $spec_dir/$pkg.spec | sed "s|Epoch:[[:space:]]*||"` - SPEC_VERSION=`grep "Version:" $spec_dir/$pkg.spec | sed "s|Version:[[:space:]]*||"` - SPEC_RELEASE=`grep "Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"` + SPEC_EPOCH=`grep -m1 "^Epoch:" $spec_dir/$pkg.spec | sed "s|Epoch:[[:space:]]*||"` + SPEC_VERSION=`grep -m1 "^Version:" $spec_dir/$pkg.spec | sed "s|Version:[[:space:]]*||"` + SPEC_RELEASE=`grep -m1 "^Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"` if [ "$PKGLINE" ]; then set -- $PKGLINE - echo "== Specfile updated from version $2-$6 to $SPEC_VERSION-$SPEC_RELEASE" + echo "?= Specfile updated from version $2-$6 to $SPEC_VERSION-$SPEC_RELEASE" if [ "`echo $SPEC_VERSION | grep -i alpha`" -o \ "`echo $SPEC_VERSION | grep -i beta`" -o \ "`echo $SPEC_VERSION | grep -i rc`" -o \ @@ -880,29 +907,28 @@ if [ "$do_autobuild" = "1" ]; then sed -i "/^$PKGNAME /d" $SUCCESSLISTDIR/*.success fi fi - + # check skippedlist SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "` - if [ "$SKIPPEDLINE" ]; then - set -- $SKIPPEDLINE - SKIPPEDTIME=$2 - SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400` - if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then - SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1` + if [ "$SKIPPEDLINE" ]; then + set -- $SKIPPEDLINE + SKIPPEDTIME=$2 + SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400` + if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then + SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1` # echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping" continue - else - sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip - fi + else + sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip + fi fi - + # check legacylist awk '{ print $1 }' $LEGACYLIST | grep "^$PKGNAME$" >/dev/null && { echo "?= Job $PKGNAME is in the legacy list; skipping automatic update" - echo "$PKGNAME $DATE_NOW 100" >> $SKIPPEDLISTDIR/auto.skip + echo "$PKGNAME $DATE_NOW 100" >> $SKIPPEDLISTDIR/auto.skip continue - } - + } fi if [ $AUTOBUILD_NUMADDED -ge $AUTOBUILD_MAXNUM ]; then @@ -913,7 +939,7 @@ if [ "$do_autobuild" = "1" ]; then fi done < $srctmpfile - echo "%% Total pkgs: $PKGCOUNT, skipped list: $SKIPPEDCOUNT, blacklist: $BLACKLISTCOUNT, success list: $SUCCESSLISTCOUNT" + echo "%% Total pkgs: $PKGCOUNT, skipped list: $SKIPPEDCOUNT, blacklist: $BLACKLISTCOUNT, success list: $SUCCESSLISTCOUNT, last build date: $BUILDDATE" while read line; do set -- $line PKGNAME=${1} @@ -1011,7 +1037,7 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do if [ ! "$rebuild_packages" -a "${JOB_VER}" != "+0" ]; then [ $ret -ge 2 -a "$do_autobuild" ] && { echo "%% Adding $JOB_NAME job to skipped list." - echo "$JOB_NAME $DATE_NOW $?" >> $SKIPPEDLISTDIR/auto.skip + echo "$JOB_NAME $DATE_NOW $ret" >> $SKIPPEDLISTDIR/auto.skip } case $SEVERITY in 0) ;;