summaryrefslogtreecommitdiff
path: root/scripts/makepkg.in
diff options
context:
space:
mode:
authorAndrew Fyfe <andrew@neptune-one.net>2007-06-27 12:04:33 +0100
committerDan McGee <dan@archlinux.org>2007-06-27 20:35:09 -0400
commit1e56e41d638fcdddc291d9a8ea183b40f4802aae (patch)
tree2a14815ab64f327036c0d35ebe3b28b0b8506a20 /scripts/makepkg.in
parent269022ccae921ae7f7caa1aca4a7d40cb0773985 (diff)
scripts/makepkg.in: Use bsdtar to find packages for xdelta.
When looking for old packages to create a delta from used bsdtar to read the packages .PKGINFO to check it's name and arch instead of depending on the filename of th package. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Diffstat (limited to 'scripts/makepkg.in')
-rw-r--r--scripts/makepkg.in19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/makepkg.in b/scripts/makepkg.in
index 2cc43b18..a7cc7e51 100644
--- a/scripts/makepkg.in
+++ b/scripts/makepkg.in
@@ -594,6 +594,7 @@ extract_sources() {
if [ $ret -ne 0 ]; then
error "$(gettext "Failed to extract %s")" "$file"
plain "$(gettext "Aborting...")"
+ exit 1
fi
done
@@ -828,20 +829,18 @@ create_xdelta() {
local pkg_file=$1
local cache_dir="/var/cache/pacman/pkg" # TODO: autoconf me
+ local pkginfo="$(mktemp "$startdir"/xdelta-pkginfo.XXXXXXXXX)"
local old_file old_version
for old_file in $(ls {"$cache_dir","$PKGDEST"}/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
- if [[ "$old_file" =~ "$CARCH" ]]; then
- old_version=${old_file%-$CARCH$PKGEXT}
- else
- old_version=${old_file%$PKGEXT}
+ bsdtar -xOf "$oldfile" .PKGINFO > "$pkginfo" || continue
+ if [ "$(cat "$pkginfo" | grep '^pkgname = ')" != "pkgname = $pkgname" ]; then
+ continue # Package name does not match.
+ elif [ "$(cat "$pkginfo" | grep '^arch = ')" != "arch = $CARCH" ] ; then
+ continue # Not same arch.
fi
- old_version=$(echo $old_version | \
- sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)$|\1|" | \
- grep -v -e "^$cache_dir" -e "^$PKGDEST")
-
- [ "$old_version" = "" ] && continue
+ old_version="$(cat "$pkginfo" | grep '^pkgver = ' | sed 's/^pkgver = //')"
# old_version may include the target package, only use the old versions
local vercmp=$(vercmp "$old_version" "$latest_version")
@@ -851,6 +850,8 @@ create_xdelta() {
fi
done
+ rm -f "$pkginfo"
+
if [ "$base_file" != "" ]; then
msg "$(gettext "Making delta from version %s...")" "$latest_version"
local delta_file="$PKGDEST/$pkgname-${latest_version}_to_$pkgver-$pkgrel-$CARCH.delta"