[packages/rpm-build-tools/merge-pld-builder-client: 246/2675] - add -a option to send with last autotag

glen glen at pld-linux.org
Mon Dec 19 22:01:26 CET 2016


commit ad4381bf813f4c37023ec9db5af75b614071968f
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Fri Apr 6 19:09:22 2012 +0000

    - add -a option to send with last autotag
    
    Changed files:
        client/make-request.sh -> 1.103

 make-request.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)
---
diff --git a/make-request.sh b/make-request.sh
index c218426..dd7f558 100755
--- a/make-request.sh
+++ b/make-request.sh
@@ -151,6 +151,45 @@ df_fetch() {
 	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 @@ Mandatory arguments to long options are mandatory for short options too.
       --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 @@ while [ $# -gt 0 ] ; do
 			shift
 			;;
 
+		-a)
+			autotag=yes
+			;;
+
 		--with)
 			with="$with $(echo "$2" | tr ',' ' ')"
 			shift
@@ -556,6 +602,11 @@ specs=`for s in $specs; do
 	esac
 done`
 
+if [ "$autotag" = "yes" ]; then
+	msg "Auto autotag build enabled"
+	specs=$(get_autotag $specs)
+fi
+
 if [ "$df_fetch" = "yes" ]; then
 	df_fetch $specs
 	exit 0
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/cca6584b96e6c33d0732d559e43e100d804e2ecd



More information about the pld-cvs-commit mailing list