Mercurial > hg > aboriginal
comparison sources/download_functions.sh @ 1257:1461d20bb6a7
Genericize the noversion() regex a bit, and make sure to only apply patches in the sources/patches directory that end in ".patch".
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 07 Oct 2010 23:46:30 -0500 |
parents | d4b251e78fc0 |
children | a80d7f256ff9 |
comparison
equal
deleted
inserted
replaced
1256:df70740df1a5 | 1257:1461d20bb6a7 |
---|---|
1 #!/bin/echo "This file is sourced, not run" | 1 #!/bin/echo "This file is sourced, not run" |
2 | 2 |
3 # Give filename.tar.ext minus the version number. | 3 # Remove version information and extension tarball name "$1". |
4 # If "$2", add that version number back, keeping original extension. | |
4 | 5 |
5 noversion() | 6 noversion() |
6 { | 7 { |
7 echo "$1" | sed -e 's/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\6/' | 8 LOGRUS='s/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\(\..z2*\)*\)$' |
9 [ -z "$2" ] && LOGRUS="$LOGRUS//" || LOGRUS="$LOGRUS/$2\\6/" | |
10 | |
11 echo "$1" | sed -e "$LOGRUS" | |
8 } | 12 } |
9 | 13 |
10 # Apply any patches to this package | 14 # Apply any patches to this package |
11 patch_package() | 15 patch_package() |
12 { | 16 { |
13 ls "$PATCHDIR/${PACKAGE}"-* 2> /dev/null | sort | while read i | 17 ls "$PATCHDIR/${PACKAGE}"-*.patch 2> /dev/null | sort | while read i |
14 do | 18 do |
15 if [ -f "$i" ] | 19 if [ -f "$i" ] |
16 then | 20 then |
17 echo "Applying $i" | 21 echo "Applying $i" |
18 (cd "${SRCTREE}/${PACKAGE}" && | 22 (cd "${SRCTREE}/${PACKAGE}" && |
52 # assume everything's ok. | 56 # assume everything's ok. |
53 | 57 |
54 SHA1FILE="$SRCTREE/$PACKAGE/sha1-for-source.txt" | 58 SHA1FILE="$SRCTREE/$PACKAGE/sha1-for-source.txt" |
55 if [ -z "$FILENAME" ] | 59 if [ -z "$FILENAME" ] |
56 then | 60 then |
57 [ ! -e "$SRCTREE/$PACKAGE" ] && dienow "No tarball for $PACKAGE" | 61 if [ ! -e "$SRCTREE/$PACKAGE" ] |
62 then | |
63 echo "No tarball for $PACKAGE" >&2 | |
64 dienow | |
65 fi | |
58 | 66 |
59 # If the sha1sum file isn't there, re-patch the package. | 67 # If the sha1sum file isn't there, re-patch the package. |
60 [ ! -e "$SHA1FILE" ] && patch_package | 68 [ ! -e "$SHA1FILE" ] && patch_package |
61 return 0 | 69 return 0 |
62 fi | 70 fi |
167 # or vice versa | 175 # or vice versa |
168 | 176 |
169 touch -c "$SRCDIR"/{"$FILENAME","$ALTFILENAME"} 2>/dev/null | 177 touch -c "$SRCDIR"/{"$FILENAME","$ALTFILENAME"} 2>/dev/null |
170 | 178 |
171 # Give package name, minus file's version number and archive extension. | 179 # Give package name, minus file's version number and archive extension. |
172 BASENAME="$(noversion "$FILENAME" | sed 's/\.tar\..z2*$//')" | 180 BASENAME="$(noversion "$FILENAME")" |
173 | 181 |
174 # If unstable version selected, try from listed location, and fall back | 182 # If unstable version selected, try from listed location, and fall back |
175 # to PREFERRED_MIRROR. Do not try normal mirror locations for unstable. | 183 # to PREFERRED_MIRROR. Do not try normal mirror locations for unstable. |
176 | 184 |
177 if is_in_list "$BASENAME" $USE_UNSTABLE | 185 if is_in_list "$BASENAME" $USE_UNSTABLE |