~vorlon/ubuntu/oneiric/cyrus-sasl2/multiarch

« back to all changes in this revision

Viewing changes to debian/repack.sh

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-06-04 16:03:06 UTC
  • mfrom: (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090604160306-wioioa3amb1up5ws
Tags: 2.1.23.dfsg1-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add sysv-rc dependency
  - Since the libsasl2 package description so clearly
    states that the library is "completely useless" without one of the
    libsasl2-modules packages, upgrade the Recommends on a single package
    to an ORd Depends on the complete list of them.
  - Prepend XS-Original- to Vcs-{Browser,Svn}.
  - Remove stop links from rc0 and rc6
  - stop service only when switching to single user mode.
* Dropped changes, superseded in Debian:
  - build-depend on libdb4.6-dev; Debian has moved on to db4.7
  - Added debian/patches/021ubuntu-fix-threaded-sasl.dpatch
    - Fixes SEGV in threaded SASL applications.
* debian/rules: remove all the build-*stamp files on clean, not just
  build-stamp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
 
# Repackage upstream source to exclude non-distributable files
3
 
# should be called as "repack sh --upstream-source <ver> <downloaded file>
4
 
# (for example, via uscan)
 
2
#
 
3
# Repackage upstream source to exclude non-distributable files.
 
4
# Should be called as "repack sh --upstream-source <version> <file>
 
5
# (for example, via uscan).
5
6
 
6
7
set -e
7
8
set -u
8
9
 
9
 
FILE=$3
10
 
PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
11
 
VER=`dpkg-parsechangelog|grep ^Version:|sed 's/^Version: //; s/.dfsg1-[^-]\+$//'`
12
 
 
13
 
printf "\nRepackaging $FILE\n"
14
 
 
15
 
DIR=`mktemp -d ./tmpRepackXXXXXX`
16
 
trap "rm -rf $DIR" QUIT INT EXIT
17
 
 
18
 
tar xzf $FILE -C $DIR
19
 
 
20
 
REPACK=`basename $FILE`
21
 
 
22
 
UP_DIR=`ls -1 $DIR`
23
 
 
24
 
(
25
 
    set -e
26
 
    set -u
27
 
 
28
 
    cd $DIR
29
 
 
30
 
    rm -v $UP_DIR/doc/draft*
31
 
    rm -v $UP_DIR/doc/rfc*
32
 
 
33
 
    REPACK_DIR="$PKG-$VER.orig"
34
 
    mv $UP_DIR $REPACK_DIR
35
 
    tar -c $REPACK_DIR | gzip -9 > $REPACK
36
 
)
37
 
 
38
 
mv $DIR/$REPACK $FILE
39
 
 
40
 
echo "*** $FILE repackaged"
 
10
if [ $# -ne 3 ]; then
 
11
        echo "Usage: $0 --upstream-source <version> <file>"
 
12
        exit 1
 
13
fi
 
14
 
 
15
OPT_VERSION=$2
 
16
OPT_FILE=$3
 
17
TMPDIR=`mktemp -d`
 
18
trap "rm -rf $TMPDIR" QUIT INT EXIT
 
19
 
 
20
echo "Repackaging $OPT_FILE"
 
21
 
 
22
tar xzf $OPT_FILE -C $TMPDIR
 
23
 
 
24
orig_file_path=`readlink --canonicalize $OPT_FILE`
 
25
upstream_directory=`ls -1 $TMPDIR | head -1`
 
26
package_name=`dpkg-parsechangelog | sed -n 's/^Source: //p'`
 
27
dfsg_directory=${package_name}_${OPT_VERSION}.dfsg1
 
28
dfsg_file_path=`dirname $orig_file_path`/$dfsg_directory.orig.tar.gz
 
29
 
 
30
# Use a subshell to remove the non-dfsg-free files
 
31
(
 
32
        set -e
 
33
        set -u
 
34
 
 
35
        cd $TMPDIR/$upstream_directory
 
36
 
 
37
        # Individual files to remove
 
38
        for file in \
 
39
                doc/draft* \
 
40
                doc/rfc* \
 
41
                java/doc/draft* ; do
 
42
                rm -v $file
 
43
        done
 
44
 
 
45
        # Whole directories to remove
 
46
        for directory in \
 
47
                dlcompat-20010505 ; do
 
48
                rm -rfv $directory
 
49
        done
 
50
)
 
51
 
 
52
# Rename upstream tarball root directory and repackage the file
 
53
(
 
54
        cd $TMPDIR
 
55
        mv $upstream_directory $dfsg_directory
 
56
        tar czf $orig_file_path *
 
57
        mv $orig_file_path $dfsg_file_path
 
58
)
 
59
 
 
60
echo "File $OPT_FILE repackaged successfully to $dfsg_file_path"
 
61