# HG changeset patch # User Rob Landley # Date 1290468766 21600 # Node ID a80d7f256ff948d9f73b7077f06a2b43ca5e80cf # Parent dcf7da6a6633fc369e5d3edd7d566aaf1652846f Handle package tarballs with overlapping names (thingy and thingy-test for example). diff -r dcf7da6a6633 -r a80d7f256ff9 sources/download_functions.sh --- a/sources/download_functions.sh Mon Nov 22 17:31:51 2010 -0600 +++ b/sources/download_functions.sh Mon Nov 22 17:32:46 2010 -0600 @@ -27,6 +27,25 @@ done } +# Get the tarball for this package + +find_package_tarball() +{ + # If there are multiple similar files we want the newest timestamp, in case + # the URL just got upgraded but cleanup_oldfiles hasn't run yet. Be able to + # distinguish "package-123.tar.bz2" from "package-tests-123.tar.bz2" and + # return the shorter one reliably. + + ls -tc "$SRCDIR/$1-"*.tar* 2>/dev/null | while read i + do + if [ "$(noversion "${i/*\//}")" == "$1" ] + then + echo "$i" + break + fi + done +} + # Extract tarball named in $1 and apply all relevant patches into # "$BUILD/packages/$1". Record sha1sum of tarball and patch files in # sha1-for-source.txt. Re-extract if tarball or patches change. @@ -47,7 +66,7 @@ # Find tarball, and determine type - FILENAME="$(ls -tc "$SRCDIR/${PACKAGE}-"*.tar* 2>/dev/null | head -n 1)" + FILENAME="$(find_package_tarball "$PACKAGE")" DECOMPRESS="" [ "$FILENAME" != "${FILENAME/%\.tar\.bz2/}" ] && DECOMPRESS="j" [ "$FILENAME" != "${FILENAME/%\.tar\.gz/}" ] && DECOMPRESS="z"