From c0b7304aa4d88a9e121b77e158b23e5a5483ecae Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Tue, 27 May 2014 21:58:37 +0200 Subject: [PATCH] autodist: make --list-jobs and --list-pkgs faster by running before reading unneeded package status from repository --- autodist | 66 ++++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/autodist b/autodist index 6c266e6..18b6cab 100755 --- a/autodist +++ b/autodist @@ -5,7 +5,7 @@ # # Released under the terms of the GNU GPL release 3 license # -VERSION=0.9.9 +VERSION=0.9.10 me=(${0##*/} $VERSION "Sat Aug 20 2010") exec 3>`readlink /proc/self/fd/0` @@ -220,12 +220,6 @@ done [ "$SEND_SERVER" ] || SEND_SERVER=$AUTODIST_REPOSITORY SEND_SERVER_CMD="--server $SEND_SERVER" -AUTOUPDATEDIR=${LOCAL_REPS_BASE_DIR}/$AUTODIST_REPOSITORY/autoupdate/ - -[ -r $AUTOUPDATEDIR ] || { - AUTOUPDATEDIR=$USERCONFDIR/$AUTODIST_REPOSITORY/autoupdate - mkdir -p $AUTOUPDATEDIR -} # perform arch names conversions case $BUILDARCH in @@ -236,34 +230,6 @@ case $TARGETARCH in i386|i486|i686) TARGETARCH=i586 ;; esac -SOURCESDIR=$AUTOUPDATEDIR/sources/ -SUCCESSLISTDIR=$AUTOUPDATEDIR -SKIPPEDLISTDIR=$AUTOUPDATEDIR - -SRCPKGLIST=`fetch_repository_list $AUTODIST_REPOSITORY/srcpkglist` -[ "$AUTODIST_DELAYED_REPOSITORY" ] && SRCPKGLIST_DELAYED=`fetch_repository_list $AUTODIST_DELAYED_REPOSITORY/srcpkglist` - -BUILDSLIST=`fetch_repository_list distromatic/$AUTODIST_REPOSITORY/builds-$TARGETARCH` -[ "$AUTODIST_DELAYED_REPOSITORY" ] && BUILDSLIST_DELAYED=`fetch_repository_list distromatic/$AUTODIST_DELAYED_REPOSITORY/builds-$TARGETARCH` - -[ -e "$DISTDB" ] || { - echo "ERROR: missing distdb file $DISTDB; aborting." - exit 1 -} - -[ -e $LOGBASEDIR ] || { - mkdir -p $LOGBASEDIR/prepare/{ok,failed} - mkdir -p $LOGBASEDIR/update/{ok,failed} - mkdir -p $LOGBASEDIR/build/{ok,failed} - mkdir -p $LOGBASEDIR/install/{ok,failed} - mkdir -p $LOGBASEDIR/send/{ok,failed} -} - -#[ "$PACKAGE" ] || { -# echo "ERROR: missing target; aborting." -# usage -# exit 1 -#} # for webbuild message function cgi_encodevar() { @@ -880,6 +846,19 @@ function log_date() { echo -n `LANG=C date +%Y%m%d@%H%M%S` } +[ -e "$DISTDB" ] || { + echo "ERROR: missing distdb file $DISTDB; aborting." + exit 1 +} + +[ -e $LOGBASEDIR ] || { + mkdir -p $LOGBASEDIR/prepare/{ok,failed} + mkdir -p $LOGBASEDIR/update/{ok,failed} + mkdir -p $LOGBASEDIR/build/{ok,failed} + mkdir -p $LOGBASEDIR/install/{ok,failed} + mkdir -p $LOGBASEDIR/send/{ok,failed} +} + DISTDBFILES="$DISTDB" [ -e $DISTDB.$TARGETARCH ] && DISTDBFILES="$DISTDBFILES $DISTDB.$TARGETARCH" [ -e ~/.autodist/distdb ] && DISTDBFILES="$DISTDBFILES ~/.autodist/distdb" @@ -931,6 +910,23 @@ for a in $LOGBASEDIR/{,prepare/{,ok,failed},update/{,ok,failed},build/{,ok,faile done +AUTOUPDATEDIR=${LOCAL_REPS_BASE_DIR}/$AUTODIST_REPOSITORY/autoupdate/ +[ -r $AUTOUPDATEDIR ] || { + AUTOUPDATEDIR=$USERCONFDIR/$AUTODIST_REPOSITORY/autoupdate + mkdir -p $AUTOUPDATEDIR +} + +SOURCESDIR=$AUTOUPDATEDIR/sources/ +SUCCESSLISTDIR=$AUTOUPDATEDIR +SKIPPEDLISTDIR=$AUTOUPDATEDIR + +SRCPKGLIST=`fetch_repository_list $AUTODIST_REPOSITORY/srcpkglist` +[ "$AUTODIST_DELAYED_REPOSITORY" ] && SRCPKGLIST_DELAYED=`fetch_repository_list $AUTODIST_DELAYED_REPOSITORY/srcpkglist` + +BUILDSLIST=`fetch_repository_list distromatic/$AUTODIST_REPOSITORY/builds-$TARGETARCH` +[ "$AUTODIST_DELAYED_REPOSITORY" ] && BUILDSLIST_DELAYED=`fetch_repository_list distromatic/$AUTODIST_DELAYED_REPOSITORY/builds-$TARGETARCH` + + echo "%% Autodist started with PID $$ @ `LANG=C date`" # autobuild: add jobs ordered by oldest builds