On Wed, Aug 5, 2009 at 7:00 AM, Cedric Staniewski<cedric@gmx.ca> wrote:
This time a more tested patch... Probably someone knows a possibility to quote the file name in the cmd string so that the characters are recognized as quoting chars and not as part of the filename without using eval.
From 0aad0c6f6030806cea1804152afc0650d491b307 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 5 Aug 2009 12:43:03 +0200 Subject: [PATCH] makepkg: always keep sources symlinks
Add -k (keep) option to the bunzip2/xz commands and make gunzip decompressing to stdout, because it does not offer something like a -k option.
Additionally the selection of the decompression command for gzip/bzip2/xz compressed files now also depends on the file suffix, since the decompression programs rely on them when not using -c option.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 56ad2c0..c7a6434 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -644,22 +644,34 @@ extract_sources() { local cmd='' case "$file_type" in *application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*) - cmd="bsdtar -x -f" ;; - *application/x-gzip*) - cmd="gunzip -d -f" ;; - *application/x-bzip*) - cmd="bunzip2 -f" ;; - *application/x-xz*) - cmd="xz -d -f" ;; + cmd="bsdtar xf '$file'" ;; *) - # Don't know what to use to extract this file, - # skip to the next file - continue;; + case "$file" in + *.gz|*.z|*.Z) + [[ "$file_type" = *application/x-gzip* ]] \ + && cmd="gunzip -cf '$file' > '${file%.*}'" \ + || continue + ;; + *.bz2|*.bz) + [[ "$file_type" = *application/x-bzip* ]] \ + && cmd="bunzip2 -fk '$file'" \ + || continue + ;; + *.xz) + [[ "$file_type" = *application/x-xz* ]] \ + && cmd="xz -dfk '$file'" \ + || continue + ;;
This patch just makes me cry a little bit...its like taking a sledgehammer to kill a fly, unfortunately. All we wanted to do was keep a symlink around, and we've now regressed to using extensions, which we haven't done since pre 3.1.0. On a side note, if anyone can figure out how to annotate/blame an old version of a file that no longer exists (as it has been renamed), please let me know. git might be failing here: $ git blame scripts/makepkg.in e19d7da4~1 fatal: cannot stat path 'scripts/makepkg.in': No such file or directory $ git annotate --follow "scripts/makepkg.sh.in" e19d7da4~1 fatal: no such path scripts/makepkg.sh.in in e19d7da4~1 -Dan