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

James Rosten seinfeld90 at gmail.com
Sun Jan 21 15:34:39 EST 2007


* Johannes Weiner <hannes at saeurebad.de> [070121 13:38]:
> 
> What about this:
> 
> case $file_type in
> 	"application/x-tar")
> 		ft=".tar";;
> 	"application/x-tar*")
> 		case $file_type in
> 			"*x-gzip")
> 				ft=".tgz";;
> 			"*x-bzip2")
> 				ft=".tbz2";;
> 		ecac;;
> 	"application/x-zip*")
> 		ft=".zip";;
> 	[...]
> esac
> 
> This would save a lot of external calls to grep ;)

Good idea.  I've got the new patch below as usual.

~ 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 14:01:58.000000000 -0500
@@ -681,24 +681,24 @@ else
 	for netfile in "${source[@]}"; do
 		unziphack=0
 		file=$(strip_url "$netfile")
+		# fix flyspray #6246
+		file_type=$(file -biz $file)
 		unset cmd
-		case "$(echo $file |tr "A-Z" "a-z")" in
-			*.tar.gz|*.tar.z|*.tgz)
+		case "$file_type" in
+			"application/x-tar, POSIX (GNU) (application/x-gzip)")
 			cmd="tar --use-compress-program=gzip -xf $file" ;;
-			*.tar.bz2|*.tbz2)
+			"application/x-tar, POSIX (GNU) (application/x-bzip2)")
 			cmd="tar --use-compress-program=bzip2 -xf $file" ;;
-			*.tar)
+			"application/x-tar, POSIX (GNU)")
 			cmd="tar -xf $file" ;;
-			*.zip)
+			"*application/x-zip*")
 			unziphack=1
 			cmd="unzip -qqo $file" ;;
-			*.cpio.gz)
+			"application/x-cpio*")
 			cmd="bsdtar -x -f $file" ;;
-			*.cpio.bz2)
-			cmd="bsdtar -x -f $file" ;;
-			*.gz)
+			"application/x-gzip")
 			cmd="gunzip -f $file" ;;
-			*.bz2)
+			"application/x-gzip")
 			cmd="bunzip2 -f $file" ;;
 		esac
 		if [ "$cmd" != "" ]; then


More information about the pacman-dev mailing list