r49568 - /scripts/repack.sh
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Wed Dec 30 19:30:34 UTC 2009
Author: gregoa
Date: Wed Dec 30 19:30:27 2009
New Revision: 49568
URL: http://svn.debian.org/wsvn/?sc=1&rev=49568
Log:
add support for bzip2; bump REPACK_VERSION to 2, so that packages can add 'requires_version 2'
Modified:
scripts/repack.sh
Modified: scripts/repack.sh
URL: http://svn.debian.org/wsvn/scripts/repack.sh?rev=49568&op=diff
==============================================================================
--- scripts/repack.sh (original)
+++ scripts/repack.sh Wed Dec 30 19:30:27 2009
@@ -12,6 +12,7 @@
# switch over libsyntax-highlight-engine-kate-perl.
# TODO: have each mv and rm check that something actually changed, and
# if not, die
+# TODO: add support for .zip?
set -e
set -u
@@ -50,7 +51,7 @@
# Create an extra directory to cope with rootless tarballs
UP_BASE="$DIR/unpack"
mkdir "$UP_BASE"
-tar xzf "$FILE" -C "$UP_BASE"
+tar xf "$FILE" -C "$UP_BASE"
if [ `ls -1 "$UP_BASE" | wc -l` -eq 1 ]; then
# Tarball does contain a root directory
@@ -111,7 +112,7 @@
}
# bump with incompatible changes
-REPACK_VERSION=1
+REPACK_VERSION=2
requires_version(){
if [ $REPACK_VERSION -lt $1 ]; then
@@ -131,14 +132,31 @@
## End
REPACK_DIR="$PKG-${VER}${SUFFIX}.orig" # DevRef § 6.7.8.2
-DFSG_TAR="$(dirname $FILE)/${PKG}_${VER}${SUFFIX}.orig.tar.gz"
+DFSG_TAR="$(dirname $FILE)/${PKG}_${VER}${SUFFIX}.orig.tar"
real_mv "$UP_BASE" "$DIR/$REPACK_DIR"
+# .gz or .bz2?
+FILETYPE=$(file --brief --mime-type --dereference "$FILE")
+case "$FILETYPE" in
+ application/x-gzip)
+ C_PROGRAM="gzip"
+ C_SUFFIX="gz"
+ ;;
+ application/x-bzip2)
+ C_PROGRAM="bzip2"
+ C_SUFFIX="bz2"
+ ;;
+ *)
+ echo "E: Unknown filetye $FILETYPE"
+ exit 1
+ ;;
+esac
+
# Using a pipe hides tar errors!
tar cfC "$DIR/repacked.tar" "$DIR" "$REPACK_DIR"
-gzip -9 < "$DIR/repacked.tar" > "$DIR/repacked.tar.gz"
+$C_PROGRAM -9 < "$DIR/repacked.tar" > "$DIR/repacked.tar.$C_SUFFIX"
-real_mv "$DIR/repacked.tar.gz" "$DFSG_TAR"
+real_mv "$DIR/repacked.tar.$C_SUFFIX" "$DFSG_TAR.$C_SUFFIX"
-echo "*** $DFSG_TAR ready"
+echo "*** $DFSG_TAR.$C_SUFFIX ready"
More information about the Pkg-perl-cvs-commits
mailing list