File: repack.sh

package info (click to toggle)
libnetaddr-ip-perl 4.007%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 728 kB
  • ctags: 92
  • sloc: perl: 715; pascal: 78; ansic: 77; makefile: 56; sh: 23
file content (41 lines) | stat: -rw-r--r-- 793 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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

FILE=$3
PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
VER=`dpkg-parsechangelog|grep ^Version:|sed 's/^Version: //; s/+dfsg-[^-]\+$//'`

printf "\nRepackaging $FILE\n"

DIR=`mktemp -d ./tmpRepackXXXXXX`
trap "rm -rf $DIR" QUIT INT EXIT

tar xzf $FILE -C $DIR

REPACK=`basename $FILE`

UP_DIR=`ls -1 $DIR`

(
    set -e
    set -u

    cd $DIR

    rm -v $UP_DIR/docs/rfc1884.txt

    sed -i '\,docs/rfc1884.txt, D' $UP_DIR/MANIFEST

    REPACK_DIR="$PKG-$VER.orig"
    mv $UP_DIR $REPACK_DIR
    tar -c $REPACK_DIR | gzip -9 > $REPACK
)

mv $DIR/$REPACK $FILE

echo "*** $FILE repackaged"