r15178 - /trunk/libpoe-component-irc-perl/debian/repack.sh
tincho-guest at users.alioth.debian.org
tincho-guest at users.alioth.debian.org
Tue Feb 19 17:43:44 UTC 2008
Author: tincho-guest
Date: Tue Feb 19 17:43:43 2008
New Revision: 15178
URL: http://svn.debian.org/wsvn/?sc=1&rev=15178
Log:
Another try to get repack right. Attempts to be generic enough to be used in other packages.
Modified:
trunk/libpoe-component-irc-perl/debian/repack.sh
Modified: trunk/libpoe-component-irc-perl/debian/repack.sh
URL: http://svn.debian.org/wsvn/trunk/libpoe-component-irc-perl/debian/repack.sh?rev=15178&op=diff
==============================================================================
--- trunk/libpoe-component-irc-perl/debian/repack.sh (original)
+++ trunk/libpoe-component-irc-perl/debian/repack.sh Tue Feb 19 17:43:43 2008
@@ -1,39 +1,42 @@
#!/bin/sh
# Repackage upstream source to exclude non-distributable files
-# should be called as "repack sh --upstream-source <ver> <downloaded file>
+# should be called as "repack.sh --upstream-source <ver> <downloaded file>
# (for example, via uscan)
set -e
set -u
-FILE=$3
+VER="$2"
+FILE="$3"
PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
-VER=`dpkg-parsechangelog|grep ^Version:|sed 's/^Version: //; s/+dfsg-[^-]\+$//'`
-printf "\nRepackaging $FILE\n"
+REPACK_DIR="$PKG-$VER.orig" # DevRef § 6.7.8.2
+
+echo -e "\nRepackaging $FILE\n"
DIR=`mktemp -d ./tmpRepackXXXXXX`
-trap "rm -rf $DIR" QUIT INT EXIT
+trap "rm -rf \"$DIR\"" QUIT INT EXIT
-tar xzf $FILE -C $DIR
+# Create an extra directory to cope with rootless tarballs
+UP_BASE="$DIR/unpack"
+mkdir "$UP_BASE"
+tar xzf "$FILE" -C "$UP_BASE"
-REPACK=`basename $FILE`
+if [ `ls -1 "$UP_BASE" | wc -l` -eq 1 ]; then
+ # Tarball does contain a root directory
+ UP_BASE="$UP_BASE/`ls -1 "$UP_BASE"`"
+fi
-UP_DIR=`ls -1 $DIR`
+## Remove stuff
+rm -vr $UP_BASE/docs/
+## End
-(
- set -e
- set -u
+mv "$UP_BASE" "$DIR/$REPACK_DIR"
- cd $DIR
+# Using a pipe hides tar errors!
+tar cfC "$DIR/repacked.tar" "$DIR" "$REPACK_DIR"
+gzip -9 < "$DIR/repacked.tar" > "$DIR/repacked.tar.gz"
- rm -vr $UP_DIR/docs/
-
- REPACK_DIR="$PKG-$VER.orig"
- mv $UP_DIR $REPACK_DIR
- tar -c $REPACK_DIR | gzip -9 > $REPACK
-)
-
-mv $DIR/$REPACK $FILE
+mv "$DIR/repacked.tar.gz" "$FILE"
echo "*** $FILE repackaged"
More information about the Pkg-perl-cvs-commits
mailing list