r15183 - /scripts/repack_template.sh

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Tue Feb 19 18:54:16 UTC 2008


Author: tincho-guest
Date: Tue Feb 19 18:54:15 2008
New Revision: 15183

URL: http://svn.debian.org/wsvn/?sc=1&rev=15183
Log:
Repack template

Added:
    scripts/repack_template.sh   (with props)

Added: scripts/repack_template.sh
URL: http://svn.debian.org/wsvn/scripts/repack_template.sh?rev=15183&op=file
==============================================================================
--- scripts/repack_template.sh (added)
+++ scripts/repack_template.sh Tue Feb 19 18:54:15 2008
@@ -1,0 +1,42 @@
+#!/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)
+
+set -e
+set -u
+
+VER="$2"
+FILE="$3"
+PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
+
+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
+
+# Create an extra directory to cope with rootless tarballs
+UP_BASE="$DIR/unpack"
+mkdir "$UP_BASE"
+tar xzf "$FILE" -C "$UP_BASE"
+
+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
+
+## Remove stuff
+rm -vr $UP_BASE/non_free_stuff
+## End
+
+mv "$UP_BASE" "$DIR/$REPACK_DIR"
+
+# Using a pipe hides tar errors!
+tar cfC "$DIR/repacked.tar" "$DIR" "$REPACK_DIR"
+gzip -9 < "$DIR/repacked.tar" > "$DIR/repacked.tar.gz"
+
+mv "$DIR/repacked.tar.gz" "$FILE"
+
+echo "*** $FILE repackaged"

Propchange: scripts/repack_template.sh
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-perl-cvs-commits mailing list