From: Nezmer <[email protected]>

If "file -bizL" does not return a supported type, check if the file is
recognized by bsdtar and if yes extract from it.

Dan: use '-q' option to prevent needing to seek the entire archive.

Signed-off-by: Nezmer <[email protected]>
Signed-off-by: Dan McGee <[email protected]>
---

I think I got the '-q' option working just fine as long as you order the
options correctly to bsdtar. This appears to work on random files I was
testing it on from the command line.

$ time bsdtar -tf /var/cache/makepkg/src/linux-2.6.34.tar.bz2 -q '*'; echo 
return: $?
linux-2.6.34/

real    0m0.079s
user    0m0.063s
sys     0m0.010s
return: 0

-Dan

 scripts/makepkg.sh.in |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 76b6183..28e550b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -685,9 +685,12 @@ extract_sources() {
                                        *) continue;;
                                esac ;;
                        *)
-                               # Don't know what to use to extract this file,
-                               # skip to the next file
-                               continue;;
+                               # See if bsdtar can recognize the file
+                               if bsdtar -tf "$file" -q '*' &>/dev/null; then
+                                       cmd="bsdtar"
+                               else
+                                       continue
+                               fi ;;
                esac
 
                local ret=0
-- 
1.7.1


Reply via email to