mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
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
|
# fix flyspray #6246
|
||||||
local file_type=$(file -bizL "$file")
|
local file_type=$(file -bizL "$file")
|
||||||
|
local ext=${file##*.}
|
||||||
local cmd=''
|
local cmd=''
|
||||||
case "$file_type" in
|
case "$file_type" in
|
||||||
*application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
|
*application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
|
||||||
cmd="bsdtar -x -f" ;;
|
cmd="bsdtar" ;;
|
||||||
*application/x-gzip*)
|
*application/x-gzip*)
|
||||||
cmd="gunzip -d -f" ;;
|
case "$ext" in
|
||||||
|
gz|z|Z) cmd="gzip" ;;
|
||||||
|
*) continue;;
|
||||||
|
esac ;;
|
||||||
*application/x-bzip*)
|
*application/x-bzip*)
|
||||||
cmd="bunzip2 -f" ;;
|
case "$ext" in
|
||||||
|
bz2|bz) cmd="bzip2" ;;
|
||||||
|
*) continue;;
|
||||||
|
esac ;;
|
||||||
*application/x-xz*)
|
*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,
|
# Don't know what to use to extract this file,
|
||||||
# skip to the next file
|
# skip to the next file
|
||||||
@ -663,8 +673,13 @@ extract_sources() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
local ret=0
|
local ret=0
|
||||||
msg2 '%s' "$cmd \"$file\""
|
msg2 "$(gettext "extracting %s with %s")" "$file" "$cmd"
|
||||||
$cmd "$file" || ret=$?
|
if [ "$cmd" = "bsdtar" ]; then
|
||||||
|
$cmd -xf "$file" || ret=?
|
||||||
|
else
|
||||||
|
rm -f "${file%.*}"
|
||||||
|
$cmd -dcf "$file" > "${file%.*}" || ret=?
|
||||||
|
fi
|
||||||
if [ $ret -ne 0 ]; then
|
if [ $ret -ne 0 ]; then
|
||||||
error "$(gettext "Failed to extract %s")" "$file"
|
error "$(gettext "Failed to extract %s")" "$file"
|
||||||
plain "$(gettext "Aborting...")"
|
plain "$(gettext "Aborting...")"
|
||||||
|
Loading…
Reference in New Issue
Block a user