Author: glen                         Date: Fri Apr  6 19:09:27 2012 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
- add -a option to send with last autotag

---- Files affected:
pld-builder.new/client:
   make-request.sh (1.102 -> 1.103) 

---- Diffs:

================================================================
Index: pld-builder.new/client/make-request.sh
diff -u pld-builder.new/client/make-request.sh:1.102 
pld-builder.new/client/make-request.sh:1.103
--- pld-builder.new/client/make-request.sh:1.102        Fri Apr  6 21:08:39 2012
+++ pld-builder.new/client/make-request.sh      Fri Apr  6 21:09:22 2012
@@ -151,6 +151,45 @@
        done
 }
 
+# autotag from rpm-build-macros
+# displays latest used tag for a specfile
+autotag() {
+       local out s
+       for s in "$@"; do
+               # strip branches
+               s=${s%:*}
+               # ensure package ends with .spec
+               s=${s%.spec}.spec
+               out=$(cvs status -v $s | awk "!/Sticky/&&/auto-$dist-/{if 
(!a++) print \$1}")
+               echo "$s:$out"
+       done
+}
+
+# get autotag for specs
+# WARNING: This may checkout some files from CVS
+get_autotag() {
+       local pkg spec rpmdir
+
+       rpmdir=$(rpm -E %_topdir)
+       cd $rpmdir
+       for pkg in "$@"; do
+               # strip branches
+               pkg=${pkg%:*}
+               # strip .spec extension
+               pkg=${pkg%.spec}
+               # checkout only if missing
+               if [ ! -e $pkg/$pkg.spec ]; then
+                       $rpmdir/builder -g $pkg -ns -r HEAD 1>&2
+               fi
+               if [ ! -e $pkg/$pkg.spec ]; then
+                       # just print it out, to fallback to base pkg name
+                       echo "$pkg"
+               else
+                       autotag $pkg/$pkg.spec
+               fi
+       done
+}
+
 usage() {
        cat <<EOF
 Usage: make-request.sh [OPTION] ... [SPECFILE] ....
@@ -160,8 +199,11 @@
       --config-file /path/to/config/file
             Source additional config file (after $USER_CFG), useful when
             when sending build requests to Ac/Th from the same account
+      -a
+            Try to use latest auto-tag for the spec when building
+            WARNING: This will checkout new files to your packages dir
       -b 'BUILDER BUILDER ...',  --builder='BUILDER BUILDER ...'
-           Sends request to given builders (in 'version-arch' format)
+            Sends request to given builders (in 'version-arch' format)
       --with VALUE, --without VALUE
             Build package with(out) a given bcond
       --kernel VALUE
@@ -265,6 +307,10 @@
                        shift
                        ;;
 
+               -a)
+                       autotag=yes
+                       ;;
+
                --with)
                        with="$with $(echo "$2" | tr ',' ' ')"
                        shift
@@ -555,6 +601,11 @@
                ;;
        esac
 done`
+
+if [ "$autotag" = "yes" ]; then
+       msg "Auto autotag build enabled"
+       specs=$(get_autotag $specs)
+fi
 
 if [ "$df_fetch" = "yes" ]; then
        df_fetch $specs
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/pld-builder.new/client/make-request.sh?r1=1.102&r2=1.103

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to