Author: adsb
Date: 2009-06-02 18:35:47 +0000 (Tue, 02 Jun 2009)
New Revision: 1904

Modified:
   trunk/debian/changelog
   trunk/scripts/uupdate.1
   trunk/scripts/uupdate.sh
Log:
uupdate: Add support for .lzma compressed tarballs and diffs.  Thanks to
Simon Richter for the patch.  (Closes: #531570)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2009-06-02 18:25:33 UTC (rev 1903)
+++ trunk/debian/changelog      2009-06-02 18:35:47 UTC (rev 1904)
@@ -32,6 +32,8 @@
     Thanks, Jakub Wilk.  (Closes: #531059)
   * uscan: Make a regular expression example in the manpage clearer.  Thanks,
     Jason Heeris.  (Closes: #530362)
+  * uupdate: Add support for .lzma compressed tarballs and diffs.  Thanks to
+    Simon Richter for the patch.  (Closes: #531570)
 
   [ James Vega ]
   * bts: Only Cc [email protected] if we're reasonably sure we have

Modified: trunk/scripts/uupdate.1
===================================================================
--- trunk/scripts/uupdate.1     2009-06-02 18:25:33 UTC (rev 1903)
+++ trunk/scripts/uupdate.1     2009-06-02 18:35:47 UTC (rev 1904)
@@ -19,10 +19,12 @@
 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 and \fI.zip\fR
+\fI.tar.bz2\fR, \fI.tar.Z\fR, \fI.tgz\fR, \fI.tar\fR, \fI.tar.lzma\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 and
+file types are \fBgzip\fR-compressed, \fBbzip2\fR-compressed,
+\fBlzma\fR-compressed and
 uncompressed patch files.  The file types are identified by the file
 names, so they must use the standard suffixes.
 .PP

Modified: trunk/scripts/uupdate.sh
===================================================================
--- trunk/scripts/uupdate.sh    2009-06-02 18:25:33 UTC (rev 1903)
+++ trunk/scripts/uupdate.sh    2009-06-02 18:35:47 UTC (rev 1904)
@@ -48,7 +48,7 @@
 "Usage for a new archive:
   $PROGNAME [options] <new upstream archive> [<version>]
 For a patch file:
-  $PROGNAME [options] --patch|-p <patch>[.gz|.bz2]
+  $PROGNAME [options] --patch|-p <patch>[.gz|.bz2|.lzma]
 Options are:
    --upstream-version <version>, -v <version>
                       specify version number of upstream package
@@ -56,10 +56,10 @@
                       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}; not valid
+                      copied to <pkg>_<version>.orig.tar.{gz|bz2|lzma}; not 
valid
                       for patches
    --no-symlink       Copy new upstream archive to new location
-                      as <pkg>_<version>.orig.tar.{gz|bz2} instead of making a
+                      as <pkg>_<version>.orig.tar.{gz|bz2|lzma} instead of 
making a
                       symlink
    --no-conf, --noconf
                       Don't read devscripts config files;
@@ -257,6 +257,7 @@
            case "$PATCH" in
                *.gz)  CATPATCH="zcat $PATCH"; X=${X%.gz};;
                *.bz2) CATPATCH="bzcat $PATCH"; X=${X%.bz2};;
+               *.lzma) CATPATCH="lzcat $PATCH"; X=${X%.lzma};;
                *)     CATPATCH="cat $PATCH";;
            esac
            ;;
@@ -282,6 +283,14 @@
                    fi
                    X=${X%.bz2}
                    ;;
+               *.lzma)
+                   if [ -r "$OPWD/$PATCH" ]; then
+                       CATPATCH="lzcat $OPWD/$PATCH"
+                   else
+                       CATPATCH="lzcat ../$PATCH"
+                   fi
+                   X=${X%.lzma}
+                   ;;
                *)    if [ -r "$OPWD/$PATCH" ]; then
                        CATPATCH="cat $OPWD/$PATCH"
                    else
@@ -338,6 +347,9 @@
     elif [ -r "../${PACKAGE}_$UVERSION.orig.tar.bz2" ]; then
        OLDARCHIVE="${PACKAGE}_$UVERSION.orig.tar.bz2"
        OLDARCHIVETYPE=bz2
+    elif [ -r "../${PACKAGE}_$UVERSION.orig.tar.lzma" ]; then
+       OLDARCHIVE="${PACKAGE}_$UVERSION.orig.tar.lzma"
+       OLDARCHIVETYPE=lzma
     else
        echo "$PROGNAME: can't find/read 
${PACKAGE}_$UVERSION.orig.tar.{gz|bz2}" >&2
        echo "in the parent directory!" >&2
@@ -383,6 +395,12 @@
            echo "aborting..." >&2
            exit 1
        }
+    elif [ "$OLDARCHIVETYPE" = lzma ]; then
+       tar --lzma -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
@@ -468,8 +486,11 @@
                            TYPE=gz ;;
            *.orig.tar.bz2) X="${X%.orig.tar.bz2}"; UNPACK="tar --bzip -xf";
                            TYPE=bz2 ;;
+           *.orig.tar.lzma) X="${X%.orig.tar.lzma}"; UNPACK="tar --lzma -xf";
+                           TYPE=lzma ;;
            *.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.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="" ;;
@@ -535,11 +556,20 @@
        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.lzma" ] && \
+       [ "$(md5sum "${ARCHIVE_PATH}" | cut -d" " -f1)" != \
+         "$(md5sum "../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma" | cut -d" " 
-f1)" ]
+    then
+       echo "$PROGNAME: a different ${PACKAGE}_$SNEW_VERSION.orig.tar.lzma" >&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" ]; then
+       ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.bz2" -a \
+       ! -e "../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma" ]; then
        if [ "$UUPDATE_SYMLINK_ORIG" = yes ]; then
            echo "Symlinking to pristine source from 
${PACKAGE}_$SNEW_VERSION.orig.tar.$TYPE..."
            case $ARCHIVE_PATH in
@@ -565,6 +595,13 @@
                    cp "$ARCHIVE_PATH" 
"../${PACKAGE}_$SNEW_VERSION.orig.tar.bz2"
                fi
                ;;
+           lzma)
+               if [ "$UUPDATE_SYMLINK_ORIG" = yes ]; then
+                   ln -s "$LINKARCHIVE" 
"../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma"
+               else
+                   cp "$ARCHIVE_PATH" 
"../${PACKAGE}_$SNEW_VERSION.orig.tar.lzma"
+               fi
+               ;;
            *)
                echo "$PROGNAME: can't preserve pristine sources from non 
.tar.gz/.tar.bz2 upstream archive!" >&2
                echo "Continuing anyway..." >&2
@@ -615,6 +652,10 @@
        DIFF="../${PACKAGE}_$SVERSION.diff.bz2"
        DIFFTYPE=diff
        DIFFCAT=bzcat
+    elif [ -r "../${PACKAGE}_$SVERSION.diff.lzma" ]; then
+       DIFF="../${PACKAGE}_$SVERSION.diff.lzma"
+       DIFFTYPE=diff
+       DIFFCAT=lzcat
     elif [ -r "../${PACKAGE}_$SVERSION.debian.tar.gz" ]; then
        DIFF="../${PACKAGE}_$SVERSION.debian.tar.gz"
        DIFFTYPE=tar
@@ -623,6 +664,10 @@
        DIFF="../${PACKAGE}_$SVERSION.debian.tar.bz2"
        DIFFTYPE=tar
        DIFFUNPACK="tar --bzip2 -xf"
+    elif [ -r "../${PACKAGE}_$SVERSION.debian.tar.lzma" ]; then
+       DIFF="../${PACKAGE}_$SVERSION.debian.tar.lzma"
+       DIFFTYPE=tar
+       DIFFUNPACK="tar --lzma -xf"
     fi
 
     if [ "$DIFFTYPE" = diff ]; then
@@ -677,7 +722,7 @@
            done
        fi
 
-       if zcat ../${PACKAGE}_$SVERSION.diff.gz | patch -sNp1 ; then
+       if $DIFFCAT ../$DIFF | patch -sNp1 ; then
            echo "Success!  The diffs from version $VERSION worked fine."
        else
            echo "$PROGNAME: the diffs from version $VERSION did not apply 
cleanly!" >&2
@@ -697,7 +742,7 @@
 
     elif [ "$DIFFTYPE" = tar ]; then
        if [ -d debian ]; then
-           echo "$PROGNAME warning: using a debian.tar.{gz|bz2} file in old 
Debian source," >&@
+           echo "$PROGNAME warning: using a debian.tar.{gz|bz2|lzma} file in 
old Debian source," >&@
            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



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

Reply via email to