The following commit has been merged in the master branch:
commit f8e996ead8110ed93f15dd6602fd09dbe9b7c46e
Author: James Vega <[email protected]>
Date:   Sun Apr 4 00:10:26 2010 -0400

    Add support for working with/recognizing xz archives.
    
    Closes #568615

diff --git a/README b/README
index 1ff8cb0..326446a 100644
--- a/README
+++ b/README
@@ -212,7 +212,7 @@ And now, in mostly alphabetical order, the scripts:
   also call a program such as uupdate to attempt to update the Debianised
   version based on the new update.  Whilst uscan could be used to release
   the updated version automatically, it is probably better not to without
-  testing it first. [libcrypt-ssleay-perl, libwww-perl, unzip, lzma]
+  testing it first. [libcrypt-ssleay-perl, libwww-perl, unzip, lzma, xz-utils]
 
 - uupdate: Update the package with an archive or patches from
   an upstream author.  This will be of help if you have to update your
diff --git a/debian/changelog b/debian/changelog
index 6672360..b549300 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,8 +26,11 @@ devscripts (2.10.62) UNRELEASED; urgency=low
     #565159)
   * debcheckout: Ensure "/git/" is at the start of the URL's path when
     performing an authenticated clone of an Alioth git repo.
-  * uupdate: Fix a typo which caused redirection of stdout to a file name "@".
-    (Closes: #569062)
+  * uupdate:
+    + Fix a typo which caused redirection of stdout to a file name "@".
+      (Closes: #569062)
+    + Add support for xz compressed archives/patches.  Thanks to Hideki Yamane
+      for the patch.  (Closes: #568615)
   * Update descriptions of debcommit to include darcs as a supported VCS.
     (Closes: #570138)
   * debchange:
@@ -49,6 +52,8 @@ devscripts (2.10.62) UNRELEASED; urgency=low
     is one of the default keyrings.
   * dget: Add description of the use of dscverify to the description in the
     man page.  (Closes: #537367)
+  * Add support for working with/recognizing xz archives to debchange,
+    debdiff, debuild, uscan.
 
   [ Patrick Schoenfeld ]
   * nmudiff: Fix "[nmudiff] please include --tagpending option" by applying the
diff --git a/debian/control b/debian/control
index aeaadd1..bba370a 100644
--- a/debian/control
+++ b/debian/control
@@ -21,7 +21,7 @@ Recommends: at, curl | wget, dctrl-tools, debian-keyring, 
debian-maintainers,
  libyaml-syck-perl, lintian, lsb-release, bsd-mailx | mailx | mailutils, 
  man-db, patch, patchutils, ssh-client, strace, unzip, wdiff, www-browser,
  subversion | cvs | darcs | svk | tla | bzr | git-core | mercurial, lzma,
- sensible-utils
+ xz-utils, sensible-utils
 Suggests: build-essential, cvs-buildpackage, devscripts-el, gnuplot,
  libfile-desktopentry-perl, libnet-smtp-ssl-perl (>= 1.01-2), mutt,
  svn-buildpackage, w3m
@@ -119,7 +119,7 @@ Description: scripts to make the life of a Debian Package 
maintainer easier
     transitions for which uploads to unstable are currently blocked
     [libwww-perl, libyaml-syck-perl]
   - uscan: scan upstream sites for new releases of packages
-    [libcrypt-ssleay-perl, libwww-perl, unzip, lzma]
+    [libcrypt-ssleay-perl, libwww-perl, unzip, lzma, xz-utils]
   - uupdate: integrate upstream changes into a source package [patch]
   - whodepends: check which maintainers' packages depend on a package
   - who-uploads: determine the most recent uploaders of a package to the Debian
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index b0fc8bf..51cc70c 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -1436,7 +1436,7 @@ if ((basename(cwd()) =~ m%^\Q$PACKAGE\E-\Q$UVERSION\E$%) 
&&
        }
        # And check whether a new orig tarball exists
        my @origs = glob("../$PACKAGE\_$new_uversion.*");
-       my $num_origs = grep { 
/^..\/\Q$PACKAGE\E_\Q$new_uversion\E\.orig\.tar\.(gz|bz2|lzma)$/ } @origs;
+       my $num_origs = grep { 
/^..\/\Q$PACKAGE\E_\Q$new_uversion\E\.orig\.tar\.(gz|bz2|lzma|xz)$/ } @origs;
        if ($num_origs == 0) {
            warn "$progname warning: no orig tarball found for the new 
version.\n";
        }
diff --git a/scripts/debdiff.pl b/scripts/debdiff.pl
index c235af0..ae32df2 100755
--- a/scripts/debdiff.pl
+++ b/scripts/debdiff.pl
@@ -459,7 +459,7 @@ elsif ($type eq 'dsc') {
                if ($file =~ /\.diff\.gz$/) {
                    $diffs[$i] = cwd() . '/' . $file;
                }
-               elsif ($file =~ /(\.orig)?\.tar\.(gz|bz2|lzma)$/) {
+               elsif ($file =~ /(\.orig)?\.tar\.(gz|bz2|lzma|xz)$/) {
                    $origs[$i] = $file;
                }
            } else {
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index 63ce75c..777bc81 100755
--- a/scripts/debuild.pl
+++ b/scripts/debuild.pl
@@ -981,12 +981,13 @@ if ($command_version eq 'dpkg') {
     my $origdir = basename(cwd()) . ".orig";
     if (! $binaryonly and $tgz_check and $uversion ne $sversion
        and ! -f "../${orig_prefix}.bz2" and ! -f "../${orig_prefix}.lzma"
-       and ! -f "../${orig_prefix}.gz" and ! -d "../$origdir") {
+       and ! -f "../${orig_prefix}.gz" and ! -f "../${orig_prefix}.xz"
+       and ! -d "../$origdir") {
        print STDERR "This package has a Debian revision number but there does"
            . " not seem to be\nan appropriate original tar file or .orig"
            . " directory in the parent directory;\n(expected one of"
-           . " ${orig_prefix}.gz, ${orig_prefix}.bz2,\n${orig_prefix}.lzma or"
-           . " $origdir)\ncontinue anyway? (y/n) ";
+           . " ${orig_prefix}.gz, ${orig_prefix}.bz2,\n${orig_prefix}.lzma, "
+           . " ${orig_prefix}.xz or $origdir)\ncontinue anyway? (y/n) ";
        my $ans = <STDIN>;
        exit 1 unless $ans =~ /^y/i;
     }
diff --git a/scripts/uscan.1 b/scripts/uscan.1
index 3e6ebb3..0550ec4 100644
--- a/scripts/uscan.1
+++ b/scripts/uscan.1
@@ -369,14 +369,15 @@ orig.tar.gz names if their extensions are \fI.tar.gz\fR 
or \fI.tgz\fR,
 and similarly for tar.bz2 files.
 .TP
 .B \-\-repack
-After having downloaded a lzma tar, bzip tar or zip archive, repack it
-to a gzip tar archive, which is still currently required as a member
-of a Debian source package. Does nothing if the downloaded archive is
-not a lzma tar archive, bzip tar archive or a zip archive (i.e. it
-doesn't match a .tlzma, .tar.lzma, .tbz, .tbz2, .tar.bz2 or .zip
-extension). The unzip package must be installed in order to
-repack .zip archives, and the lzma package must be installed to repack
-lzma tar archives.
+After having downloaded an lzma tar, xz tar, bzip tar or zip archive,
+repack it to a gzip tar archive, which is still currently required as a
+member of a Debian source package. Does nothing if the downloaded
+archive is not an lzma tar archive, xz tar archive, bzip tar archive or
+a zip archive (i.e. it doesn't match a .tlz, .tar.lzma, .txz, .tar.xz
+\^.tbz, .tbz2, .tar.bz2 or .zip extension). The unzip package must be
+installed in order to repack .zip archives, the lzma package must be
+installed to repack lzma tar archives, and the xz-utils package must be
+installed to repack xz tar archives.
 .TP
 .B \-\-no\-symlink
 Don't make these symlinks and don't rename the files.
@@ -492,7 +493,7 @@ equivalent to the \fB\-\-destdir\fR option.
 .TP
 .B USCAN_REPACK
 If this is set to \fIyes\fR, then after having downloaded a bzip tar,
-lzma tar or zip archive, \fBuscan\fR will repack it to a gzip tar.
+lzma tar, xz tar, or zip archive, \fBuscan\fR will repack it to a gzip tar.
 This is equivalent to the \fB\-\-repack\fR option.
 .SH "EXIT STATUS"
 The exit status gives some indication of whether a newer version was
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index b5827f1..3bc5d4e 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1350,7 +1350,7 @@ EOF
        $newfile_base = $newfile_base_gz;
     }
 
-    if ($repack and $newfile_base =~ /^(.*)\.(tar\.lzma|tlzma?)$/) {
+    if ($repack and $newfile_base =~ /^(.*)\.(tar\.lzma|tlz(?:ma?)?)$/) {
        print "-- Repacking from lzma to gzip\n" if $verbose;
        my $newfile_base_gz = "$1.tar.gz";
        system("lzma -cd $destdir/$newfile_base | gzip -n -9 > 
$destdir/$newfile_base_gz") == 0
@@ -1359,6 +1359,15 @@ EOF
        $newfile_base = $newfile_base_gz;
     }
 
+    if ($repack and $newfile_base =~ /^(.*)\.(tar\.xz|txz)$/) {
+       print "-- Repacking from xz to gzip\n" if $verbose;
+       my $newfile_base_gz = "$1.tar.gz";
+       system("xz -cd $destdir/$newfile_base | gzip -n -9 > 
$destdir/$newfile_base_gz") == 0
+         or die "repacking from xz to gzip failed\n";
+       unlink "$destdir/$newfile_base";
+       $newfile_base = $newfile_base_gz;
+    }
+
     if ($repack and $newfile_base =~ /^(.*)\.zip$/) {
        print "-- Repacking from zip to .tar.gz\n" if $verbose;
 
diff --git a/scripts/uupdate.1 b/scripts/uupdate.1
index 611dddf..999a51a 100644
--- a/scripts/uupdate.1
+++ b/scripts/uupdate.1
@@ -19,12 +19,12 @@ Note that the patch file or archive cannot be within the 
source tree
 itself.  The full details of what the code does are given below.
 .PP
 Currently supported source code file types are \fI.tar.gz\fR,
-\fI.tar.bz2\fR, \fI.tar.Z\fR, \fI.tgz\fR, \fI.tar\fR, \fI.tar.lzma\fR
-and \fI.zip\fR
+\fI.tar.bz2\fR, \fI.tar.Z\fR, \fI.tgz\fR, \fI.tar\fR, \fI.tar.lzma\fR,
+\fI.tar.xz\fR and \fI.zip\fR
 archives.  Also supported are already unpacked source code archives;
 simply give the path of the source code directory.  Supported patch
 file types are \fBgzip\fR-compressed, \fBbzip2\fR-compressed,
-\fBlzma\fR-compressed and
+\fBlzma\fR-compressed, \fBxz\fR-compressed and
 uncompressed patch files.  The file types are identified by the file
 names, so they must use the standard suffixes.
 .PP
diff --git a/scripts/uupdate.sh b/scripts/uupdate.sh
index 563376b..c5db482 100755
--- a/scripts/uupdate.sh
+++ b/scripts/uupdate.sh
@@ -48,7 +48,7 @@ usage () {
 "Usage for a new archive:
   $PROGNAME [options] <new upstream archive> [<version>]
 For a patch file:
-  $PROGNAME [options] --patch|-p <patch>[.gz|.bz2|.lzma]
+  $PROGNAME [options] --patch|-p <patch>[.gz|.bz2|.lzma|.xz]
 Options are:
    --upstream-version <version>, -v <version>
                       specify version number of upstream package
@@ -56,10 +56,10 @@ Options are:
                       which command to be used to become root
                       for package-building
    --pristine, -u     Source is pristine upstream source and should be
-                      copied to <pkg>_<version>.orig.tar.{gz|bz2|lzma}; not 
valid
+                      copied to <pkg>_<version>.orig.tar.{gz|bz2|lzma|xz}; not 
valid
                       for patches
    --no-symlink       Copy new upstream archive to new location
-                      as <pkg>_<version>.orig.tar.{gz|bz2|lzma} instead of 
making a
+                      as <pkg>_<version>.orig.tar.{gz|bz2|lzma|xz} instead of 
making a
                       symlink
    --no-conf, --noconf
                       Don't read devscripts config files;
@@ -258,6 +258,7 @@ if [ "$PATCH" ]; then
                *.gz)  CATPATCH="zcat $PATCH"; X=${X%.gz};;
                *.bz2) CATPATCH="bzcat $PATCH"; X=${X%.bz2};;
                *.lzma) CATPATCH="lzcat $PATCH"; X=${X%.lzma};;
+               *.xz) CATPATCH="xzcat $PATCH"; X=${X%.xz};;
                *)     CATPATCH="cat $PATCH";;
            esac
            ;;
@@ -291,6 +292,14 @@ if [ "$PATCH" ]; then
                    fi
                    X=${X%.lzma}
                    ;;
+               *.xz)
+                   if [ -r "$OPWD/$PATCH" ]; then
+                       CATPATCH="xzcat $OPWD/$PATCH"
+                   else
+                       CATPATCH="xzcat ../$PATCH"
+                   fi
+                   X=${X%.xz}
+                   ;;
                *)    if [ -r "$OPWD/$PATCH" ]; then
                        CATPATCH="cat $OPWD/$PATCH"
                    else
@@ -350,8 +359,11 @@ if [ "$PATCH" ]; then
     elif [ -r "../${PACKAGE}_$UVERSION.orig.tar.lzma" ]; then
        OLDARCHIVE="${PACKAGE}_$UVERSION.orig.tar.lzma"
        OLDARCHIVETYPE=lzma
+    elif [ -r "../${PACKAGE}_$UVERSION.orig.tar.xz" ]; then
+       OLDARCHIVE="${PACKAGE}_$UVERSION.orig.tar.xz"
+       OLDARCHIVETYPE=xz
     else
-       echo "$PROGNAME: can't find/read 
${PACKAGE}_$UVERSION.orig.tar.{gz|bz2}" >&2
+       echo "$PROGNAME: can't find/read 
${PACKAGE}_$UVERSION.orig.tar.{gz|bz2|lzma|xz}" >&2
        echo "in the parent directory!" >&2
        echo "Aborting...." >&2
        exit 1
@@ -401,6 +413,12 @@ if [ "$PATCH" ]; then
            echo "aborting..." >&2
            exit 1
        }
+    elif [ "$OLDARCHIVETYPE" = xz ]; then
+       tar --xz -xf ../$OLDARCHIVE || {
+           echo "$PROGNAME: can't untar $OLDARCHIVE;" >&2
+           echo "aborting..." >&2
+           exit 1
+       }
     else
        echo "$PROGNAME: internal error: unknown OLDARCHIVETYPE: 
$OLDARCHIVETYPE" >&2
        exit 1
@@ -488,9 +506,12 @@ else
                            TYPE=bz2 ;;
            *.orig.tar.lzma) X="${X%.orig.tar.lzma}"; UNPACK="tar --lzma -xf";
                            TYPE=lzma ;;
+           *.orig.tar.xz) X="${X%.orig.tar.xz}"; UNPACK="tar --xz -xf";
+                           TYPE=xz ;;
            *.tar.gz)  X="${X%.tar.gz}";  UNPACK="tar zxf"; TYPE=gz ;;
            *.tar.bz2) X="${X%.tar.bz2}"; UNPACK="tar --bzip -xf"; TYPE=bz2 ;;
            *.tar.lzma) X="${X%.tar.lzma}"; UNPACK="tar --lzma -xf"; TYPE=lzma 
;;
+           *.tar.xz)  X="${X%.tar.xz}";  UNPACK="tar --xz -xf"; TYPE=xz ;;
            *.tar.Z)   X="${X%.tar.Z}";   UNPACK="tar zxf"; TYPE="" ;;
            *.tgz)     X="${X%.tgz}";     UNPACK="tar zxf"; TYPE=gz ;;
            *.tar)     X="${X%.tar}";     UNPACK="tar xf";  TYPE="" ;;
@@ -564,12 +585,21 @@ else
        echo "already exists in the parent dir;" >&2
        echo "please check on the situation before trying $PROGNAME again." >&2
        exit 1
+    elif [ -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.xz" ] && \
+       [ "$(md5sum "${ARCHIVE_PATH}" | cut -d" " -f1)" != \
+         "$(md5sum "../${PACKAGE}_$SNEW_VERSION.orig.tar.xz" | cut -d" " -f1)" 
]
+    then
+       echo "$PROGNAME: a different ${PACKAGE}_$SNEW_VERSION.orig.tar.xz" >&2
+       echo "already exists in the parent dir;" >&2
+       echo "please check on the situation before trying $PROGNAME again." >&2
+       exit 1
     fi
 
     if [ $UUPDATE_PRISTINE = yes -a -n "$TYPE" -a \
        ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.gz" -a \
        ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.bz2" -a \
-       ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma" ]; then
+       ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma" -a \
+       ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.xz" ]; then
        if [ "$UUPDATE_SYMLINK_ORIG" = yes ]; then
            echo "Symlinking to pristine source from 
${PACKAGE}_$SNEW_VERSION.orig.tar.$TYPE..."
            case $ARCHIVE_PATH in
@@ -602,8 +632,15 @@ else
                    cp "$ARCHIVE_PATH" 
"../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma"
                fi
                ;;
+           xz)
+               if [ "$UUPDATE_SYMLINK_ORIG" = yes ]; then
+                   ln -s "$LINKARCHIVE" 
"../${PACKAGE}_$SNEW_VERSION.orig.tar.xz"
+               else
+                   cp "$ARCHIVE_PATH" "../${PACKAGE}_$SNEW_VERSION.orig.tar.xz"
+               fi
+               ;;
            *)
-               echo "$PROGNAME: can't preserve pristine sources from non 
.tar.gz/.tar.bz2 upstream archive!" >&2
+               echo "$PROGNAME: can't preserve pristine sources from non 
.tar.{gz|bz2|lzma|xz} upstream archive!" >&2
                echo "Continuing anyway..." >&2
                ;;
        esac
@@ -656,6 +693,10 @@ else
        DIFF="../${PACKAGE}_$SVERSION.diff.lzma"
        DIFFTYPE=diff
        DIFFCAT=lzcat
+    elif [ -r "../${PACKAGE}_$SVERSION.diff.xz" ]; then
+       DIFF="../${PACKAGE}_$SVERSION.diff.xz"
+       DIFFTYPE=diff
+       DIFFCAT=xzcat
     elif [ -r "../${PACKAGE}_$SVERSION.debian.tar.gz" ]; then
        DIFF="../${PACKAGE}_$SVERSION.debian.tar.gz"
        DIFFTYPE=tar
@@ -668,6 +709,10 @@ else
        DIFF="../${PACKAGE}_$SVERSION.debian.tar.lzma"
        DIFFTYPE=tar
        DIFFUNPACK="tar --lzma -xf"
+    elif [ -r "../${PACKAGE}_$SVERSION.debian.tar.xz" ]; then
+       DIFF="../${PACKAGE}_$SVERSION.debian.tar.xz"
+       DIFFTYPE=tar
+       DIFFUNPACK="tar --xz -xf"
     fi
 
     if [ "$DIFFTYPE" = diff ]; then
@@ -742,7 +787,7 @@ else
 
     elif [ "$DIFFTYPE" = tar ]; then
        if [ -d debian ]; then
-           echo "$PROGNAME warning: using a debian.tar.{gz|bz2|lzma} file in 
old Debian source," >&2
+           echo "$PROGNAME warning: using a debian.tar.{gz|bz2|lzma|xz} file 
in old Debian source," >&2
            echo "but upstream also contains a debian/ directory!" >&2
            if [ -e "debian.upstream" ]; then
                echo "Please apply the diff by hand and take care with this." 
>&2

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to