Mercurial > hg > aboriginal
changeset 1204:6ab5fbb82619
Fix case where build/packages/alt-package exists but tarball doesn't, and EXTRACT_ALL=1 ./download.sh gets called.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 13 Aug 2010 15:41:03 -0500 |
parents | ac8d9db5cf37 |
children | 2b3f347dd225 |
files | sources/functions.sh |
diffstat | 1 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/sources/functions.sh Tue Aug 10 11:40:42 2010 -0500 +++ b/sources/functions.sh Fri Aug 13 15:41:03 2010 -0500 @@ -176,13 +176,6 @@ echo "$1" | sed -e 's/.*-\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\1/' } -# Give package name, minus file's version number and archive extension. - -basename() -{ - noversion $1 | sed 's/\.tar\..z2*$//' -} - # Apply any patches to this package patch_package() { @@ -219,7 +212,7 @@ # Find tarball, and determine type - FILENAME="$(echo -n "$SRCDIR/"; cd "$SRCDIR"; ls -tc "${PACKAGE}-"*.tar* | head -n 1)" + FILENAME="$(ls -tc "$SRCDIR/${PACKAGE}-"*.tar* 2>/dev/null | head -n 1)" DECOMPRESS="" [ "$FILENAME" != "${FILENAME/%\.tar\.bz2/}" ] && DECOMPRESS="j" [ "$FILENAME" != "${FILENAME/%\.tar\.gz/}" ] && DECOMPRESS="z" @@ -228,8 +221,10 @@ # assume everything's ok. SHA1FILE="$SRCTREE/$PACKAGE/sha1-for-source.txt" - if [ ! -e "$FILENAME" ] && [ -e "$SRCTREE/$PACKAGE" ] + if [ -z "$FILENAME" ] then + [ ! -e "$SRCTREE/$PACKAGE" ] && dienow "No tarball for $PACKAGE" + # If the sha1sum file isn't there, re-patch the package. [ ! -e "$SHA1FILE" ] && patch_package return 0 @@ -296,7 +291,7 @@ # Preemptively extract source packages? [ -z "$EXTRACT_ALL" ] && return 0 - extract_package "$(basename "$FILENAME")" + extract_package "$BASENAME" return $? fi @@ -342,17 +337,24 @@ touch -c "$SRCDIR"/{"$FILENAME","$ALTFILENAME"} 2>/dev/null + # Give package name, minus file's version number and archive extension. + BASENAME="$(noversion "$FILENAME" | sed 's/\.tar\..z2*$//')" + # If unstable version selected, try from listed location, and fall back # to PREFERRED_MIRROR. Do not try normal mirror locations for unstable. - if is_in_list "$(basename "$FILENAME")" $USE_UNSTABLE + if is_in_list "$BASENAME" $USE_UNSTABLE then + # If extracted source directory exists, don't download alt-tarball. + [ -e "$SRCTREE/alt-$BASENAME" ] && return 0 + + # Download new one as alt-packagename.tar.ext FILENAME="$ALTFILENAME" SHA1= - # Download new one as alt-packagename.tar.ext - download_from "$UNSTABLE" || - ([ ! -z "$PREFERRED_MIRROR" ] && - download_from "$PREFERRED_MIRROR/$ALTFILENAME") + + ([ ! -z "$PREFERRED_MIRROR" ] && + download_from "$PREFERRED_MIRROR/$ALTFILENAME") || + download_from "$UNSTABLE" return $? fi