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 <cedric@gmx.ca> for reporting this issue and contributing patches. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a05757f984
commit
7ddb645bd7
|
@ -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...")"
|
||||
|
|
Loading…
Reference in New Issue