Debian Codegraph @

make-source-tarball

raw
1 #!/bin/bash
2 #
3 # make-source-tarball
4 # create a source release tarball for CafeOBJ
5 #
6 # Copyright (c) 2014-2015, Norbert Preining. All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 #
15 # * Redistributions in binary form must reproduce the above
16 # copyright notice, this list of conditions and the following
17 # disclaimer in the documentation and/or other materials
18 # provided with the distribution.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
21 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #
32
33 set -e
34
35 version=$1
36 shift
37
38 if [ x$version = x ] ; then
39 echo "Usage: make-source-tarball VERSION" >&2
40 exit
41 fi
42
43 # consistency checks
44
45 # check version numbers
46 pver=`grep ^PACKAGE_VERSION= configure | sed -e "s/^.*='//" -e "s/'$//"`
47 pmin=`grep ^VMINOR= configure | sed -e "s/^.*=//"`
48
49 if [ ! "x$pver$pmin" = "x$version" ] ; then
50 echo "Version mismatch: cmd line: $version, configure: $pver$pmin" >&2
51 exit 1
52 fi
53
54 # check git status
55 if ! git status --ignored | grep -q 'nothing to commit, working tree clean' ; then
56 echo "git repo in unclean state, call git status --ignored!" >&2
57 exit 1
58 fi
59
60 # the directory cannot exist, since otherwise the above git status would
61 # have failed
62 mkdir cafeobj-$version
63 tar --exclude=cafeobj-$version \
64 --exclude=.git \
65 --exclude=.gitignore \
66 --exclude=tswd \
67 -cvf - . | tar -C cafeobj-$version -xvf -
68 tar --owner=0 --group=0 -cvzf cafeobj-$version.tar.gz cafeobj-$version
69 rm -rf cafeobj-$version
70
71
72