]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
- s/ALLWAYS_CVSUP/ALWAYS_CVSUP/
[packages/rpm-build-tools.git] / builder.sh
index acf3c3941024f83a3309f4ec0feca71e6186b5e8..222088d6f37ed699b4bd93b74f29807e22a1cb3a 100644 (file)
@@ -28,7 +28,7 @@ NODIST=""
 UPDATE=""
 UPDATE5=""
 ADD5=""
-ALLWAYS_CVSUP=${ALLWAYS_CVSUP:-"yes"}
+ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
 if [ -s CVS/Root ]; then
     CVSROOT=$(cat CVS/Root)
 else
@@ -69,6 +69,7 @@ FAIL_IF_NO_SOURCES="yes"
 
 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES --inet"
 GETURI2="wget -c -nd -t$WGET_RETRIES --inet"
+GETLOCAL="cp -a"
 
 if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
     RPM="rpm"
@@ -350,7 +351,19 @@ src_md5 ()
     no=$(src_no "$1")
     [ -z "$no" ] && return
     cd $SPECS_DIR
-    grep -i "#[        ]*Source$no-md5[        ]*:" $SPECFILE | sed -e 's/.*://' | xargs
+    spec="$SPECFILE,$(head -1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
+    md5=$(grep -v '^#' additional-md5sums | \
+          grep -E "[   ]$(basename "$1")[      ]*[     ]${spec}([      ]|\$)" | \
+         sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
+         grep -E '^[0-9a-f]{32}$')
+    if [ X"$md5" = X"" ] ; then
+      grep -i "#[      ]*Source$no-md5[        ]*:" $SPECFILE | sed -e 's/.*://' | xargs
+    else
+      if [ $(echo "$md5" | wc -l) != 1 ] ; then
+        echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
+      fi
+      echo "$md5" | tail -1
+    fi
 }
 
 distfiles_url ()
@@ -397,7 +410,7 @@ get_files()
             fi
         fi
        for i in $GET_FILES; do
-           if [ ! -f `nourl $i` ] || [ $ALLWAYS_CVSUP = "yes" ]; then
+           if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then
                if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
                    echo "Warning: no URL given for $i"
                fi
@@ -409,14 +422,18 @@ get_files()
                    fi
                    target=$(nourl "$i")
                    url=$(distfiles_url "$i")
-                   if [ -z "$NOMIRRORS" ] ; then
-                       url="`find_mirror "$url"`"
-                   fi
-                   ${GETURI} -O "$target" "$url" || \
-                       if [ `echo $url | grep -E 'ftp://'` ]; then
-                           ${GETURI2} -O "$target" "$url"
+                   if [ `echo $url | grep -E '^(\.|/)'` ] ; then
+                       ${GETLOCAL} $url $target
+                   else
+                       if [ -z "$NOMIRRORS" ] ; then
+                           url="`find_mirror "$url"`"
                        fi
-                   test -s "$target" || rm -f "$target"
+                       ${GETURI} -O "$target" "$url" || \
+                           if [ `echo $url | grep -E 'ftp://'` ]; then
+                               ${GETURI2} -O "$target" "$url"
+                           fi
+                       test -s "$target" || rm -f "$target"
+                   fi
                elif [ -z "$(src_md5 "$i")" ] && \
                     ( [ -z "$NOCVS" ] || echo $i | grep -qvE '(ftp|http|https)://' ); then
                    result=1
@@ -445,13 +462,14 @@ get_files()
                fi
 
 
+               srcno=$(src_no $i)
                if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
                    Exit_error err_no_source_in_repo $i;
                elif [ -n "$UPDATE5" ] && \
-                    ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' ) || \
+                    ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \
+                        [ -z "$(grep -E -i '^NoSource[         ]*:[    ]*'$i'([        ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \
                       grep -q -i -E '^#[       ]*source'$(src_no $i)'-md5[     ]*:' $SPECS_DIR/$SPECFILE )
                then
-                   srcno=$(src_no $i)
                    echo "Updating source-$srcno md5."
                    md5=$(md5sum `nourl $i` | cut -f1 -d' ')
                    perl -i -ne 'print "# Source'$srcno'-md5:\t'$md5'\n" 
This page took 0.029706 seconds and 4 git commands to generate.