[pacman-dev] [PATCH] Add support for the xz archive format

Pierre Schmitz pierre at archlinux.de
Wed May 13 02:21:11 EDT 2009


This simple patch adds support for the xz archive format to makepkg and repo-
add.
Xz can be used as source, package and package db file type.

Signed-off-by: Pierre Schmitz <pierre at archlinux.de>
---
 scripts/makepkg.sh.in  |    5 +++++
 scripts/repo-add.sh.in |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d978107..cc59f1b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -648,6 +648,8 @@ extract_sources() {
 				cmd="gunzip -d -f $file" ;;
 			*application/x-bzip*)
 				cmd="bunzip2 -f $file" ;;
+			*application/x-xz*)
+				cmd="xz -d -f $file" ;;
 			*)
 				# Don't know what to use to extract this file,
 				# skip to the next file
@@ -979,6 +981,7 @@ create_package() {
 	case "$PKGEXT" in
 		*tar.gz)  EXT=${PKGEXT%.gz} ;;
 		*tar.bz2) EXT=${PKGEXT%.bz2} ;;
+		*tar.xz) EXT=${PKGEXT%.xz} ;;
 		*) warning "$(gettext "'%s' is not a valid archive extension.")" \
 		"$PKGEXT" ; EXT=$PKGEXT ;;
 	esac
@@ -996,6 +999,7 @@ create_package() {
 		case "$PKGEXT" in
 			*tar.gz)  gzip -f -n "$pkg_file" ;;
 			*tar.bz2) bzip2 -f "$pkg_file" ;;
+			*tar.xz) xz -z -f "$pkg_file" ;;
 		esac
 		ret=$?
 	fi
@@ -1054,6 +1058,7 @@ create_srcpackage() {
 	case "$SRCEXT" in
 		*tar.gz)  TAR_OPT="z" ;;
 		*tar.bz2) TAR_OPT="j" ;;
+		*tar.xz) TAR_OPT="J" ;;
 		*) warning "$(gettext "'%s' is not a valid archive extension.")" \
 		"$SRCEXT" ;;
 	esac
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 2390a92..bbd41a2 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -462,6 +462,7 @@ if [ $success -eq 1 ]; then
 	case "$REPO_DB_FILE" in
 		*tar.gz)  TAR_OPT="z" ;;
 		*tar.bz2) TAR_OPT="j" ;;
+		*tar.xz) TAR_OPT="J" ;;
 		*) warning "$(gettext "'%s' does not have a valid archive extension.")" \
 		"$REPO_DB_FILE" ;;
 	esac
-- 
1.6.3


-- 

Pierre Schmitz


Clemens-August-Straße 76
53115 Bonn

Telefon		0228 9716608
Mobil		0160 95269831
Jabber		pierre at jabber.archlinux.de
WWW		http://www.archlinux.de



More information about the pacman-dev mailing list