File: snapshot-package.sh

package info (click to toggle)
polymake 4.15-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 35,892 kB
  • sloc: cpp: 168,945; perl: 43,410; javascript: 31,575; ansic: 3,007; java: 2,654; python: 632; sh: 268; xml: 117; makefile: 61
file content (83 lines) | stat: -rw-r--r-- 1,829 bytes parent folder | download | duplicates (7)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh

# Usage: From top source directory of polymake run
#
# % sh Packages/debian/snapshot-package.sh [-S] [-d]
#
# The -S option builds only a debian source package, and does not
# require polymake build dependencies in the current environment.

set -e

die () {
    echo $* >&2
    exit 1
}

tempdir=$(mktemp -d -p .. snapshot.XXXXXX)
debug=0

cleanup () {
    if [ "$debug" = 0 ]; then
	rm -rf $tempdir
	[ -f debian/.autogenerated ] && rm -r debian
    fi
}
trap cleanup EXIT;

if [ "$1" = "-S" ]; then
    source_only=1
    shift
else
    source_only=0
fi

if [ "$1" = "-d" ]; then
    debug=1
fi

if [ ! -f perllib/Polymake.pm ]; then
    die "This script must be run from the top level of the polymake source tree"
fi

cp -a Packages/debian .
touch ./debian/.autogenerated

# add polymake ignore files to dpkg-source options
./support/list_noexport_files . | sed 's,^./,tar-ignore ,' >> debian/source/options

# A less fragile way of doing this, without building polymake, would be welcome.

base_version=$(sed -n  -e 's/[;"]//g' -e "s/declare\s*[$]Version=//p"  perllib/Polymake.pm)

if [ -z $(command -v git) ]; then
    die "You need a git installation to run this script"
fi

commit=$(git describe --tags --match final_svn_commit |  sed -e s/final_svn_commit// -e s/-/+/g)

version="$base_version$commit"
echo Using version ${version}

if [ -z $(command -v dch) ]; then
    die "You need the 'dch' command from the package 'devscripts'"
fi

dch -v $version -m "git snapshot"

dpkg-buildpackage -S -uc -us

if [ -z $(command -v dcmd) ]; then
    die "You need the 'dcmd' command from the package 'devscripts'"
fi

if [ "$source_only" = 1 ]; then
    exit 0
fi;

( cd $tempdir
  dpkg-source -u -x ../polymake_$version.dsc
  cd polymake-$version
  dpkg-buildpackage -b -jauto -uc -us
  cd ..
  dcmd mv *.changes .. )