pld-builder.new: client/make-request.sh - update from WORKING branch

glen glen at pld-linux.org
Sun Nov 11 19:38:55 CET 2007


Author: glen                         Date: Sun Nov 11 18:38:55 2007 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
- update from WORKING branch

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

---- Diffs:

================================================================
Index: pld-builder.new/client/make-request.sh
diff -u pld-builder.new/client/make-request.sh:1.31 pld-builder.new/client/make-request.sh:1.32
--- pld-builder.new/client/make-request.sh:1.31	Sun Nov 11 18:47:52 2007
+++ pld-builder.new/client/make-request.sh	Sun Nov 11 19:38:50 2007
@@ -8,33 +8,35 @@
 command=
 command_flags=
 gpg_opts=
+default_branch='HEAD'
+distro=
 
 if [ -n "$HOME_ETC" ]; then
 	USER_CFG=$HOME_ETC/.requestrc
 else
 	USER_CFG=$HOME/.requestrc
-fi;
+fi
 
-if [ -f "$USER_CFG" ]; then
-	. $USER_CFG
-else
+if [ ! -f "$USER_CFG" ]; then
 	echo "Creating config file $USER_CFG. You *must* edit it."
-	cat >$USER_CFG <<EOF
+	cat >$USER_CFG <<'EOF'
 priority=2
-requester=deviloper
+requester=deviloper at pld-linux.org
 default_key=deviloper at pld-linux.org
-builder_email=builderth at ep09.pld-linux.org
 mailer="/usr/sbin/sendmail -t"
-default_builders="th-*"
 gpg_opts=""
+distro=th
 
 # defaults:
 f_upgrade=yes
-
 EOF
 exit
 fi
 
+if [ -f "$USER_CFG" ]; then
+  . $USER_CFG
+fi
+
 die () {
   echo "$0: $*" 1>&2
   exit 1
@@ -54,22 +56,33 @@
   echo "  --kernel VALUE"
   echo "       set alt_kernel to VALUE"
   echo "  -t   --test-build"
-  echo "       Performs a test build. No upgrades on builders, no tagging."
+  echo "       Performs a 'test-build'. Package will be uploaded to test/ tree"
+  echo "       and won't be upgraded on builders"
   echo "  -r   --ready-build"
-  echo "       Ac compatibility. \"Ready\" build"
+  echo "       Build and upgrade package and upload it to ready/ tree"
   echo "  -u   --upgrade"
-  echo "       Forces package upgrade"
+  echo "       Forces package upgrade (for use with -t)"
   echo "  -n   --no-upgrade"
-  echo "       Disables package upgrade"
+  echo "       Disables package upgrade (for use with -r)"
   echo "  -ni  -no-install-br"
   echo "       Do not install missing BuildRequires (--nodeps)"
   echo "  -f   --flag"
+  echo "  -d   --distro"
+  echo "       Specify value for \$distro"
   echo "  -cf  --command-flag"
   echo "       Not yet documented"
   echo "  -c   --command"
   echo "       Executes a given command on builders"
+  echo "       --test-remove-pkg"
+  echo "       shortcut for --command poldek -evt ARGS"
+  echo "       --remove-pkg"
+  echo "       shortcut for --command poldek -ev --noask ARGS"
+  echo "       --upgrade-pkg"
+  echo "       shortcut for --command poldek -uv ARGS"
   echo "       --cvsup"
   echo "       Updates builders infrastructure (outside chroot)"
+  echo "  -q   "
+  echo "       shortcut for --command rpm -q ARGS"
   echo "  -g   --gpg-opts \"opts\""
   echo "       Pass additional options to gpg binary"
   echo "  -p   --priority VALUE"
@@ -82,10 +95,16 @@
 
 while [ $# -gt 0 ] ; do
   case "$1" in
+    --distro | -d )
+      distro=$2
+      shift
+      ;;
+
     --config-file | -C )
       [ -f $2 ] && . $2 || die "Config file not found"
       shift
       ;;
+
     --builder | -b )
       builders="$builders $2"
       shift
@@ -95,21 +114,16 @@
       with="$with $2"
       shift
       ;;
-      
+
     --without )
       without="$without $2"
       shift
       ;;
 
-	--test-build | -t )
-	  build_mode=test
-	  f_upgrade=no
-	  ;;
-
-	--ready-build | -r )
-	  build_mode=ready
-	  f_upgrade=yes
-	  ;;
+    --test-build | -t )
+      build_mode=test
+      f_upgrade=no
+      ;;
 
     --kernel )
       kernel=$2
@@ -121,6 +135,10 @@
       shift
       ;;
 
+    --ready-build | -r )
+      build_mode=ready
+      ;;
+
     --upgrade | -u )
       f_upgrade=yes
       ;;
@@ -130,9 +148,9 @@
       ;;
 
     --no-install-br | -ni )
-	  flags="$flags no-install-br" 
-	  ;;
-	  
+      flags="$flags no-install-br"
+      ;;
+
     --flag | -f )
       flags="$flags $2"
       shift
@@ -145,42 +163,85 @@
 
     --command | -c )
       command="$2"
+      f_upgrade=no
+      shift
+      ;;
+    --test-remove-pkg)
+      command="poldek -evt $2"
+      f_upgrade=no
+      shift
+      ;;
+    --remove-pkg)
+      command="poldek -ev --noask $2"
+      f_upgrade=no
+      shift
+      ;;
+    --upgrade-pkg)
+      command="poldek -uv $2"
+      f_upgrade=no
+      shift
+      ;;
+    -q)
+      command="rpm -q $2"
+      f_upgrade=no
       shift
       ;;
 
     --cvsup )
-       command_flags="no-chroot"
-       command="cvs up"
+      command_flags="no-chroot"
+      command="cvs up"
       ;;
 
     --gpg-opts | -g )
        gpg_opts="$2"
        shift
        ;;
-	  
+
     --help | -h )
       usage
       ;;
-      
+
     -* )
       die "unknown knob: $1"
       ;;
 
-    *:* )
+    *:* | * )
       specs="$specs $1"
       ;;
-
-    * )
-      specs="$specs $1:HEAD"
-      ;;
   esac
   shift
 done
 
-specs=`for s in $specs ; do
+case "$distro" in
+ac)
+  builder_email="builder-ac at pld-linux.org"
+  default_builders="ac-*"
+  default_branch="AC-branch"
+  ;;
+ti)
+  builder_email="builderti at oberon.pld-linux.org"
+  default_builders="ti-i686"
+  ;;
+th)
+  builder_email="builderth at ep09.pld-linux.org"
+  default_builders="th-*"
+  ;;
+esac
+
+specs=`for s in $specs; do
   case "$s" in
-    *.spec:* ) echo "$s" ;;
-    * ) echo "$s" | sed -e 's/:/.spec:/' ;;
+  *.spec:*) # spec with branch
+    echo $s
+    ;;
+  *.spec) # spec without branch
+    echo $s:$default_branch
+    ;;
+  *:*) # package name with branch
+    echo $s | sed -e 's/:/.spec:/'
+    ;;
+  *) # just package name
+    echo $s.spec:$default_branch
+    ;;
   esac
 done`
 
@@ -198,14 +259,20 @@
 
 if [ "$build_mode" = "test" ] ; then
   if [ "$f_upgrade" = "yes" ] ; then
-	die "--upgrade and --test-build are mutually exclusive"
+    die "--upgrade and --test-build are mutually exclusive"
   fi
   flags="$flags test-build"
 fi
 
+if [ -z "$build_mode" ] ; then
+	# missing build mode, builders go crazy when you proceed"
+	die "please specify build mode"
+fi
+
+
 ok=
-for s in $specs ; do
-  ok=1
+for s in $specs; do
+	ok=1
 done
 
 if [ "$ok" = "" ] ; then
@@ -236,39 +303,53 @@
     done
     echo "  </batch>"
   else
-  
+
+  echo >&2 "* Using priority $priority"
+  echo >&2 "* Using email $builder_email"
+  echo >&2 "* Build mode: $build_mode"
+	if [ "$f_upgrade" = "yes" ] ; then
+		echo >&2 "* Upgrade mode: $f_upgrade"
+	fi
+  echo >&2 "* Queue-ID: $id"
+
   # first id:
   fid=
-  for s in $specs ; do
+	i=1
+  for s in $specs; do
     bid=$(uuidgen)
     echo "  <batch id='$bid' depends-on='$fid'>"
     [ "$fid" = "" ] && fid="$bid"
     name=$(echo "$s" | sed -e 's|:.*||')
     branch=$(echo "$s" | sed -e 's|.*:||')
+    echo >&2 "* Adding #$i $name:$branch"
     echo "     <spec>$name</spec>"
     echo "     <branch>$branch</branch>"
     echo "     <kernel>$kernel</kernel>"
     echo "     <info></info>"
     echo
-    for b in $with ; do
+    for b in $with; do
       echo "     <with>$b</with>"
     done
-    for b in $without ; do
+    for b in $without; do
       echo "     <without>$b</without>"
     done
     echo
-    for b in $builders ; do
+    for b in $builders; do
       echo "     <builder>$b</builder>"
     done
     echo "  </batch>"
+		i=$((i+1))
   done
 
   fi
-  
+
   echo "</group>"
 }
 
 gen_email () {
+	# make request first, so the STDERR/STDOUT streams won't be mixed
+	local req=$(gen_req)
+
 cat <<EOF
 From: $requester
 To: $builder_email
@@ -277,8 +358,10 @@
 X-New-PLD-Builder: request
 X-Requester-Version: \$Id$
 
-$(gen_req | gpg --clearsign --default-key $default_key $gpg_opts)
+$(echo "$req" | gpg --clearsign --default-key $default_key $gpg_opts)
 EOF
 }
 
 gen_email | $mailer
+
+# vim:ts=2:sw=2:noet
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/client/make-request.sh?r1=1.31&r2=1.32&f=u



More information about the pld-cvs-commit mailing list