]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
- allow comments and empty lines in mirrors file
[packages/rpm-build-tools.git] / builder.sh
index 66ae105bb468f4e40f29999c9c5eac7d53730f31..7c8a1521eae9abdd1de8f9328c3ce7c05405254c 100644 (file)
@@ -602,18 +602,22 @@ get_spec()
 find_mirror()
 {
        cd "$SPECS_DIR"
-       url="$1"
+       local url="$1"
        if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
                cvs update mirrors >&2
        fi
 
        IFS="|"
-       while read origin mirror name rest
-       do
+       local origin mirror name rest ol prefix
+       while read origin mirror name rest; do
+               # skip comments and empty lines
+               if [ -z "$origin" ] || [[ $origin == \#* ]]; then
+                       continue
+               fi
                ol=`echo -n "$origin"|wc -c`
                prefix="`echo -n "$url" | head -c $ol`"
                if [ "$prefix" = "$origin" ] ; then
-                       suffix="`echo "$url"|cut -b $ol-`"
+                       suffix="`echo "$url"|cut -b $((ol+1))-`"
                        echo -n "$mirror$suffix"
                        return 0
                fi
This page took 0.031791 seconds and 4 git commands to generate.