From 71f8e908d518d8b3954f834bff6d9ad4146c4dab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 21 Sep 2006 19:21:35 +0000 Subject: [PATCH] - also update NoSource md5 Changed files: builder.sh -> 1.456 --- builder.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/builder.sh b/builder.sh index bbfc367..e1e1ce1 100644 --- a/builder.sh +++ b/builder.sh @@ -760,6 +760,17 @@ cvsup() return $result } +# returns true if "$1" is ftp, http or https protocol url +is_url() +{ + case "$1" in + ftp://*|http://*|https://*) + return 0 + ;; + esac + return 1 +} + update_md5() { if [ $# -eq 0 ]; then @@ -800,16 +811,17 @@ update_md5() for i in "$@"; do local fp=$(nourl "$i") local srcno=$(src_no "$i") - if ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \ - [ -z "$(grep -E -i '^NoSource[ ]*:[ ]*'$i'([ ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \ - grep -q -i -E '^#[ ]*source'$srcno'-md5[ ]*:' $SPECS_DIR/$SPECFILE ) - then - echo "Updating source-$srcno md5." + local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $SPECS_DIR/$SPECFILE ) + if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then + local tag="Source$srcno-md5" + if [[ "$md5" == *NoSource* ]]; then + tag="NoSource$srcno-md5" + fi md5=$(md5sum "$fp" | cut -f1 -d' ') + echo "Updating $tag ($md5)." perl -i -ne ' - print unless /^\s*#\s*Source'$srcno'-md5\s*:/i; - print "# Source'$srcno'-md5:\t'$md5'\n" - if /^Source'$srcno'\s*:\s+/; + print unless /^\s*#\s*(No)?Source'$srcno'-md5\s*:/i; + print "# '$tag':\t'$md5'\n" if /^Source'$srcno'\s*:\s+/; ' \ $SPECS_DIR/$SPECFILE fi -- 2.43.0