~ubuntu-branches/ubuntu/trusty/padre/trusty

« back to all changes in this revision

Viewing changes to debian/repack.sh

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2009-02-18 15:55:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090218155500-puuiwalh3xps7e1p
Tags: 0.27.ds1-1
Initial Release. Closes: #492696 -- ITP

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Repack upstream source removing generated (.mo) files
 
4
# and eg/hangman.p6, which has no license and is certainly
 
5
# copyrighted
 
6
#
 
7
# To be called via debian/watch (uscan or uscan --force)
 
8
# or
 
9
#  sh debian/repack.sh --upstream-version VER FILE
 
10
 
 
11
set -e
 
12
set -u
 
13
 
 
14
usage() {
 
15
    cat <<EOF >& 2
 
16
Usage: $0 --upstream-version VER FILE
 
17
 
 
18
            or
 
19
 
 
20
       uscan [--force]
 
21
EOF
 
22
}
 
23
 
 
24
[ "${1:-}" = "--upstream-version" ] \
 
25
    && [ -n "${2:-}" ] \
 
26
    && [ -n "${3:-}" ] \
 
27
    && [ -z "${4:-}" ] \
 
28
    || usage
 
29
 
 
30
TMPDIR=`mktemp -d -p .`
 
31
 
 
32
trap "rm -rf $TMPDIR" INT QUIT 0
 
33
 
 
34
VER="$2"
 
35
DEB_VER="${VER}.ds1"
 
36
UP_VER="${VER}"
 
37
UPSTREAM_TAR="$3"
 
38
UPSTREAM_DIR=Padre-${UP_VER}
 
39
ORIG="../padre_${DEB_VER}.orig.tar.gz"
 
40
ORIG_DIR="padre-${DEB_VER}.orig"
 
41
 
 
42
if [ -e "$ORIG" ]; then
 
43
    echo "$ORIG already exists. Aborting."
 
44
    exit 1
 
45
fi
 
46
 
 
47
echo -n "Expanding upstream source tree..."
 
48
tar xzf $UPSTREAM_TAR -C $TMPDIR
 
49
echo " done."
 
50
 
 
51
# clean generated files
 
52
echo "Cleaning upstream sources from generated files..."
 
53
for f in `cd $TMPDIR/$UPSTREAM_DIR/share/locale; ls -1 *.mo` ;
 
54
do
 
55
    echo "  share/locale/$f"
 
56
    rm $TMPDIR/$UPSTREAM_DIR/share/locale/$f
 
57
done
 
58
 
 
59
echo "Remmoving copyrighted files without a license..."
 
60
for f in eg/hangman.p6 ;
 
61
do
 
62
    echo "  $f"
 
63
    rm $TMPDIR/$UPSTREAM_DIR/$f
 
64
done
 
65
 
 
66
 
 
67
mv $TMPDIR/$UPSTREAM_DIR $TMPDIR/$ORIG_DIR
 
68
 
 
69
echo -n Repackaging into ${ORIG} ...
 
70
tar c -C $TMPDIR $ORIG_DIR | gzip -n -9 > "$ORIG"
 
71
echo " done."