[pacman-dev] FS #6246 - makepkg fails if the extensions is wrong on the archive

James Rosten seinfeld90 at gmail.com
Sun Jan 21 12:43:43 EST 2007


This is a fix for FS #6246 ( http://bugs.archlinux.org/task/6246 ).

Instead of using the extension of the source archive, I make use of
file -biz (the z allows use to know if it is just a bzip2 or a tar.bzip2).

As usual the patch is below.

~ Jamie / yankees26

Signed-off-by: James Rosten <seinfeld90 at gmail.com>
-------------- next part --------------
--- pacman-lib.orig/scripts/makepkg	2007-01-17 00:29:54.000000000 -0500
+++ pacman-lib/scripts/makepkg	2007-01-21 12:35:44.000000000 -0500
@@ -681,24 +681,43 @@ else
 	for netfile in "${source[@]}"; do
 		unziphack=0
 		file=$(strip_url "$netfile")
+		# fix flyspray #6246
+		file_type=$(file -biz $file)
+		if [ -n "$(echo $file_type | grep tar | grep gzip)" ]; then
+			ft=".tgz" 
+		elif [ -n "$(echo $file_type | grep tar | grep bzip2)" ]; then
+			ft=".tbz2"
+		elif [ -n "$(echo $file_type | grep tar)" ]; then
+			ft=".tar"
+		elif [ -n "$(echo $file_type | grep -q zip)" ]; then
+			ft=".zip"
+		elif [ -n "$(echo $file_type | grep cpio | grep gzip)" ]; then
+			ft=".cpio.gz"
+		elif [ -n "$(echo $file_type | grep cpio | grep bzip2)" ]; then
+			ft=".cpio.bz2"
+		elif [ -n "$(echo $file_type | grep gzip)" ]; then
+			ft=".gz"
+		elif [ -n "$(echo $file_type | grep bzip2)" ]; then
+			ft=".bz2"
+		fi
 		unset cmd
-		case "$(echo $file |tr "A-Z" "a-z")" in
-			*.tar.gz|*.tar.z|*.tgz)
+		case "$ft" in
+			.tgz)
 			cmd="tar --use-compress-program=gzip -xf $file" ;;
-			*.tar.bz2|*.tbz2)
+			.tbz2)
 			cmd="tar --use-compress-program=bzip2 -xf $file" ;;
-			*.tar)
+			.tar)
 			cmd="tar -xf $file" ;;
-			*.zip)
+			.zip)
 			unziphack=1
 			cmd="unzip -qqo $file" ;;
-			*.cpio.gz)
+			.cpio.gz)
 			cmd="bsdtar -x -f $file" ;;
-			*.cpio.bz2)
+			.cpio.bz2)
 			cmd="bsdtar -x -f $file" ;;
-			*.gz)
+			.gz)
 			cmd="gunzip -f $file" ;;
-			*.bz2)
+			.bz2)
 			cmd="bunzip2 -f $file" ;;
 		esac
 		if [ "$cmd" != "" ]; then


More information about the pacman-dev mailing list