SPECS: builder - rpm digest support

patrys patrys at pld-linux.org
Wed Jan 9 18:10:04 CET 2008


Author: patrys                       Date: Wed Jan  9 17:10:04 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- rpm digest support

---- Files affected:
SPECS:
   builder (1.527 -> 1.528) 

---- Diffs:

================================================================
Index: SPECS/builder
diff -u SPECS/builder:1.527 SPECS/builder:1.528
--- SPECS/builder:1.527	Tue Jan  8 16:56:02 2008
+++ SPECS/builder	Wed Jan  9 18:09:59 2008
@@ -54,6 +54,9 @@
 CVSROOT=""
 GREEDSRC=""
 
+# use rpm 4.4.6+ digest format instead of comments if non-zero
+USEDIGEST=
+
 # user agent when fetching files
 USER_AGENT="PLD/Builder($VERSION)"
 
@@ -871,8 +874,9 @@
 		if [ -n "$ADD5" ]; then
 			[ "$fp" = "$i" ] && continue # FIXME what is this check doing?
 			grep -qiE '^#[ 	]*Source'$srcno'-md5[ 	]*:' $SPEC_DIR/$SPECFILE && continue
+			grep -qiE '^BuildRequires:[ 	]*digest[(]%SOURCE'$srcno'[)][ 	]*=' $SPEC_DIR/$SPECFILE && continue
 		else
-			grep -qiE '^#[ 	]*Source'$srcno'-md5[ 	]*:' $SPEC_DIR/$SPECFILE || continue
+			grep -qiE '^#[ 	]*Source'$srcno'-md5[ 	]*:' $SPEC_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ 	]*digest[(]%SOURCE'$srcno'[)][ 	]*=' $SPEC_DIR/$SPECFILE || continue
 		fi
 		if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
 			need_files="$need_files $i"
@@ -889,16 +893,21 @@
 		local fp=$(nourl "$i")
 		local srcno=$(src_no "$i")
 		local md5=$(grep -iE '^#[ 	]*(No)?Source'$srcno'-md5[ 	]*:' $SPEC_DIR/$SPECFILE )
+		if [ -z "$md5"]; then
+			md5=$(grep -iE '^[ 	]*BuildRequires:[ 	]*digest[(]%SOURCE'$srcno'[)][ 	]*=' $SPEC_DIR/$SPECFILE )
+		fi
 		if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
-			local tag="Source$srcno-md5"
+			local tag="# Source$srcno-md5:\t"
 			if [[ "$md5" == *NoSource* ]]; then
-				tag="NoSource$srcno-md5"
+				tag="# NoSource$srcno-md5:\t"
+			elif [ -n "$USEDIGEST" ]; then
+				tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
 			fi
 			md5=$(md5sum "$fp" | cut -f1 -d' ')
 			echo "Updating $tag ($md5: $fp)."
 			perl -i -ne '
-				print unless /^\s*#\s*(No)?Source'$srcno'-md5\s*:/i;
-				print "# '$tag':\t'$md5'\n" if /^Source'$srcno'\s*:\s+/;
+				print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
+				print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
 			' \
 			$SPEC_DIR/$SPECFILE
 		fi
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/builder?r1=1.527&r2=1.528&f=u



More information about the pld-cvs-commit mailing list