From 7ddb645bd7cf7e1c56a508321df511864da411a4 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Wed, 5 Aug 2009 16:12:46 +0200 Subject: makepkg: always keep sources symlinks Make bunzip2/xz/gunzip decompressing to stdout, because gzip does not offer something like a -k option. The selection of the decompression command for gzip/bzip2/xz compressed files now also depends on the file suffix, since we need to strip the extensions to get the output filename. Thanks to Cedric Staniewski for reporting this issue and contributing patches. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 126379ac..80d38670 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -646,16 +646,26 @@ extract_sources() { # fix flyspray #6246 local file_type=$(file -bizL "$file") + local ext=${file##*.} local cmd='' case "$file_type" in *application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*) - cmd="bsdtar -x -f" ;; + cmd="bsdtar" ;; *application/x-gzip*) - cmd="gunzip -d -f" ;; + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; *application/x-bzip*) - cmd="bunzip2 -f" ;; + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; *application/x-xz*) - cmd="xz -d -f" ;; + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; *) # Don't know what to use to extract this file, # skip to the next file @@ -663,8 +673,13 @@ extract_sources() { esac local ret=0 - msg2 '%s' "$cmd \"$file\"" - $cmd "$file" || ret=$? + msg2 "$(gettext "extracting %s with %s")" "$file" "$cmd" + if [ "$cmd" = "bsdtar" ]; then + $cmd -xf "$file" || ret=? + else + rm -f "${file%.*}" + $cmd -dcf "$file" > "${file%.*}" || ret=? + fi if [ $ret -ne 0 ]; then error "$(gettext "Failed to extract %s")" "$file" plain "$(gettext "Aborting...")" -- cgit v1.2.3-70-g09d2