[pacman-dev] [PATCH] [Idea] makepkg: Extract from any file bsdtar can recognize

Nezmer git at nezmer.info
Sat May 29 15:44:07 EDT 2010


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

Signed-off-by: Nezmer <git at nezmer.info>
---

bsdtar can recognize many containers and compression algorithms.

lzma is the best compression the GNU guys are using in their dist files.

% file -bizL wget-1.12.tar.lzma
application/octet-stream; charset=binary

"file" output is not really useful.

Using lzma can reduce the size of source packages by a good margin.

 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..71b87ff 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;;
+				# Check If bsdtar can recognize the file
+				if bsdtar -tf "$file" &>/dev/null; then
+					cmd="bsdtar"
+				else
+					continue
+				fi ;;
 		esac
 
 		local ret=0
-- 
1.7.1



More information about the pacman-dev mailing list