[arch-dev-public] [PATCH] Support xz compressed packages

Pierre Schmitz pierre at archlinux.de
Mon Feb 15 09:04:28 EST 2010


This simple patch allows us to slowly migrate to xz compressed packages. New
packages have to be xz compressed while old ones may keep their current
compression until they will be replaced by an update.

The *.pkg.tar.* naming scheme has to be kept.

I also removed the convert-to-any which we don't need.

Signed-off-by: Pierre Schmitz <pierre at archlinux.de>
---
 config                      |    3 +-
 convert-to-any              |   71 -------------------------------------------
 cron-jobs/create-filelists  |    2 +-
 cron-jobs/sourceballs       |    4 +-
 db-move                     |    4 +-
 misc-scripts/ftpdir-cleanup |    7 ++--
 6 files changed, 10 insertions(+), 81 deletions(-)
 delete mode 100755 convert-to-any

diff --git a/config b/config
index 92def37..7132d0b 100644
--- a/config
+++ b/config
@@ -12,7 +12,8 @@ TMPDIR="/srv/tmp"
 ARCHES=(i686 x86_64)
 BUILDSCRIPT="PKGBUILD"
 DBEXT=".db.tar.gz"
-PKGEXT=".pkg.tar.gz"
+# has to match .pkg.tar.*
+PKGEXT=".pkg.tar.xz"
 SRCEXT=".src.tar.gz"
 
 # Allowed licenses: get sourceballs only for licenses in this array
diff --git a/convert-to-any b/convert-to-any
deleted file mode 100755
index 53d1a7b..0000000
--- a/convert-to-any
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-#
-# Converts an existing architecture-independent package
-# for i686 or x86_64 into a package with "arch = any"
-#
-
-# -- Abhishek Dasgupta <abhidg at gmail.com>
-
-[ "$UID" = "" ] && UID=$(uid)
-OUTDIR="$(pwd)"
-WORKDIR="/tmp/convert-to-any.$UID"
-
-if [ $# -ne 1 ]; then
-    echo "Syntax: $(basename $0) <package-file>"
-    exit 1
-fi
-
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
-
-cleanup() {
-    trap '' 0 2
-    rm -rf "$WORKDIR"
-    [ "$1" ] && exit $1
-}
-
-ctrl_c() {
-    echo "Interrupted" >&2
-    cleanup 0
-}
-
-die() {
-    echo "$*" >&2
-    cleanup 1
-}
-
-mkdir -p "$WORKDIR/build"
-
-oldpkgname="$1"
-
-if [ -z "$oldpkgname" ]; then
-    die "convert-to-any: which package to convert?"
-fi
-
-pkg="$(basename $oldpkgname)"
-newpkgname=$(echo $pkg | sed "s/-\(i686\|x86_64\)$PKGEXT/-any$PKGEXT/")
-
-if ! cp "$oldpkgname" "$WORKDIR/build/$pkg"; then
-    die "convert-to-any: failed to copy package to $WORKDIR"
-fi
-pushd "$WORKDIR/build" >/dev/null
-
-# Conversion of i686 package into "any" package.
-mkdir -p package
-if ! fakeroot bsdtar xf "$pkg" -C package; then
-	die "convert-to-any: error in extracting $oldpkgname"
-fi
-
-sed -i "s/arch = \(i686\|x86_64\)/arch = any/g" package/.PKGINFO
-pushd package >/dev/null
-case "$newpkgname" in
-	*tar.gz)  TAR_OPT="z" ;;
-	*tar.bz2) TAR_OPT="j" ;;
-	*tar.xz)  TAR_OPT="J" ;;
-	*) die "$newpkgname does not have a valid archive extension." ;;
-esac
-fakeroot bsdtar c${TAR_OPT}f "$OUTDIR/$newpkgname" .PKGINFO *
-popd >/dev/null
-
-popd >/dev/null
-cleanup
diff --git a/cron-jobs/create-filelists b/cron-jobs/create-filelists
index c9d7db9..62e72c1 100755
--- a/cron-jobs/create-filelists
+++ b/cron-jobs/create-filelists
@@ -44,7 +44,7 @@ for repo in $repos; do
         fi
 
         # create file lists
-        for pkg in $repodir/*${PKGEXT}; do
+        for pkg in $repodir/*.pkg.tar.*; do
             pkgname="$(getpkgname "$pkg")"
             pkgver="$(getpkgver "$pkg")"
             tmppkgdir="${TMPDIR}/${repodir}/${pkgname}-${pkgver}"
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index b7a4885..f08d349 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -47,11 +47,11 @@ for repo in $repos; do
             continue
         fi
         cd $ftppath
-        for pkg in *$PKGEXT; do
+        for pkg in *.pkg.tar.*; do
             [ -f "$pkg" ] || continue
             pkgbase=$(getpkgbase $pkg)
             srcpath="$srcbase/"
-            srcpkg="${pkg//$PKGEXT/$SRCEXT}"
+            srcpkg="${pkg//.pkg.tar.*/$SRCEXT}"
             srcpkg="${srcpkg//-$arch/}"
             srcpkgname="${srcpkg%-*-*$SRCEXT}"
             srcpkgbase="${srcpkg/$srcpkgname/$pkgbase}"
diff --git a/db-move b/db-move
index efd54e0..3539a47 100755
--- a/db-move
+++ b/db-move
@@ -58,7 +58,7 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
     . "$packagebase/repos/$svnrepo_from/$BUILDSCRIPT"
     
     for i in ${pkgname[@]}; do
-        _pkgfile="$i-$pkgver-$pkgrel-$_arch$PKGEXT"
+        _pkgfile="$i-$pkgver-$pkgrel-$_arch.pkg.tar.*"
         if [ ! -f "$ftppath_from/${_arch}/$_pkgfile" ]; then
             die "error: package file '$_pkgfile' not found in repo '$repofrom'"
         fi
@@ -107,7 +107,7 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
 		#use '*' to move the old DB too
 		mv $repoto$DBEXT* $ftppath_to/$architecture
         for i in ${pkgname[@]}; do
-            _pkgfile="$i-$pkgver-$pkgrel-$_arch$PKGEXT"
+            _pkgfile="$i-$pkgver-$pkgrel-$_arch.pkg.tar.*"
             if [ "${_arch}" == "any" ]; then
                 mv ${_pkgfile} $ftppath_to/any
                 ln -s ../any/${_pkgfile} $ftppath_to/$architecture/
diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup
index f0f89a3..62eec9f 100755
--- a/misc-scripts/ftpdir-cleanup
+++ b/misc-scripts/ftpdir-cleanup
@@ -51,7 +51,6 @@ for arch in ${ARCHES[@]}; do
 
   for pkg in $TMPDIR/*; do
     filename=$(grep -A1 '^%FILENAME%$' "${pkg}/desc" | tail -n1)
-    [ -z "${filename}" ] && filename="${pkg}${PKGEXT}"
 
     if [ ! -e "${filename}" ]; then
       MISSINGFILES="${MISSINGFILES} ${filename}"
@@ -69,7 +68,7 @@ for arch in ${ARCHES[@]}; do
     fi
   done
 
-  for pkg in *$PKGEXT; do
+  for pkg in *.pkg.tar.*; do
       if [ ! -e "$pkg" ]; then
           continue
       fi
@@ -161,8 +160,8 @@ ARCHINDEPFILES=""
 
 if [ -d "$ftppath_base/any" ]; then
     cd "$ftppath_base/any"
-    for pkg in *$PKGEXT; do
-        [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz"
+    for pkg in *.pkg.tar.*; do
+        [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.*"
         found=0
         #check for any existing symlinks
         for arch in ${ARCHES[@]}; do
-- 
1.6.6.1


Pierre Schmitz, https://users.archlinux.de/~pierre


More information about the arch-dev-public mailing list