[Pkg-cyrus-sasl2-commits] r466 - /cyrus-sasl-2.1/trunk/debian/repack.sh
fabbe at users.alioth.debian.org
fabbe at users.alioth.debian.org
Sun May 24 15:12:00 UTC 2009
Author: fabbe
Date: Sun May 24 15:12:00 2009
New Revision: 466
URL: http://svn.debian.org/wsvn/pkg-cyrus-sasl2/?sc=1&rev=466
Log:
Fix repack.sh
Modified:
cyrus-sasl-2.1/trunk/debian/repack.sh
Modified: cyrus-sasl-2.1/trunk/debian/repack.sh
URL: http://svn.debian.org/wsvn/pkg-cyrus-sasl2/cyrus-sasl-2.1/trunk/debian/repack.sh?rev=466&op=diff
==============================================================================
--- cyrus-sasl-2.1/trunk/debian/repack.sh (original)
+++ cyrus-sasl-2.1/trunk/debian/repack.sh Sun May 24 15:12:00 2009
@@ -1,40 +1,61 @@
#!/bin/sh
-# Repackage upstream source to exclude non-distributable files
-# should be called as "repack sh --upstream-source <ver> <downloaded file>
-# (for example, via uscan)
+#
+# Repackage upstream source to exclude non-distributable files.
+# Should be called as "repack sh --upstream-source <version> <file>
+# (for example, via uscan).
set -e
set -u
-FILE=$3
-PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
-VER=`dpkg-parsechangelog|grep ^Version:|sed 's/^Version: //; s/.dfsg1-[^-]\+$//'`
+if [ $# -ne 3 ]; then
+ echo "Usage: $0 --upstream-source <version> <file>"
+ exit 1
+fi
-printf "\nRepackaging $FILE\n"
+OPT_VERSION=$2
+OPT_FILE=$3
+TMPDIR=`mktemp -d`
+trap "rm -rf $TMPDIR" QUIT INT EXIT
-DIR=`mktemp -d ./tmpRepackXXXXXX`
-trap "rm -rf $DIR" QUIT INT EXIT
+echo "Repackaging $OPT_FILE"
-tar xzf $FILE -C $DIR
+tar xzf $OPT_FILE -C $TMPDIR
-REPACK=`basename $FILE`
+orig_file_path=`readlink --canonicalize $OPT_FILE`
+upstream_directory=`ls -1 $TMPDIR | head -1`
+package_name=`dpkg-parsechangelog | sed -n 's/^Source: //p'`
+dfsg_directory=${package_name}_${OPT_VERSION}.dfsg1
+dfsg_file_path=`dirname $orig_file_path`/$dfsg_directory.orig.tar.gz
-UP_DIR=`ls -1 $DIR`
+# Use a subshell to remove the non-dfsg-free files
+(
+ set -e
+ set -u
-(
- set -e
- set -u
+ cd $TMPDIR/$upstream_directory
- cd $DIR
+ # Individual files to remove
+ for file in \
+ doc/draft* \
+ doc/rfc* \
+ java/doc/draft* ; do
+ rm -v $file
+ done
- rm -v $UP_DIR/doc/draft*
- rm -v $UP_DIR/doc/rfc*
-
- REPACK_DIR="$PKG-$VER.orig"
- mv $UP_DIR $REPACK_DIR
- tar -c $REPACK_DIR | gzip -9 > $REPACK
+ # Whole directories to remove
+ for directory in \
+ dlcompat-20010505 ; do
+ rm -rfv $directory
+ done
)
-mv $DIR/$REPACK $FILE
+# Rename upstream tarball root directory and repackage the file
+(
+ cd $TMPDIR
+ mv $upstream_directory $dfsg_directory
+ tar czf $orig_file_path *
+ mv $orig_file_path $dfsg_file_path
+)
-echo "*** $FILE repackaged"
+echo "File $OPT_FILE repackaged successfully to $dfsg_file_path"
+
More information about the Pkg-cyrus-sasl2-commits
mailing list