chiark / gitweb /
Debian build: ./newVersion updates debian/changelog too.
[wiringPi.git] / newVersion
1 #!/bin/sh -e
2 #
3 # newVersion:
4 #       Utility to create the version.h include file for the gpio command.
5 #       and the Debian package
6 #
7 #       Copyright (c) 2012-2015 Gordon Henderson
8 #################################################################################
9 # This file is part of wiringPi:
10 #       Wiring Compatable library for the Raspberry Pi
11 #
12 #    wiringPi is free software: you can redistribute it and/or modify
13 #    it under the terms of the GNU Lesser General Public License as published by
14 #    the Free Software Foundation, either version 3 of the License, or
15 #    (at your option) any later version.
16 #
17 #    wiringPi is distributed in the hope that it will be useful,
18 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
19 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 #    GNU Lesser General Public License for more details.
21 #
22 #    You should have received a copy of the GNU Lesser General Public License
23 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
24 #################################################################################
25
26 echo Updating to version: `cat VERSION`
27
28 rm -f gpio/version.h
29 echo "#define VERSION \"`cat VERSION`\"" > gpio/version.h
30
31 rm -f debian-template/wiringPi/DEBIAN/control
32 cat > debian-template/wiringPi/DEBIAN/control <<EOF
33 Package: wiringpi
34 Version: `cat VERSION`
35 Section: libraries
36 Priority: optional
37 Architecture: armhf
38 Depends: libc6
39 Maintainer: Gordon Henderson <projects@drogon.net>
40 Description: The wiringPi libraries, headers and gpio command
41   Libraries to allow GPIO access on a Raspberry Pi from C and C++
42   programs as well as from the command-line
43 EOF
44
45 changelog=$(dpkg-parsechangelog)
46 olddebversion=$(printf "%s" "$changelog" |
47  sed -n '/^Version: / { s/^Version: //; p; q }')
48 newversion=`cat VERSION`
49
50 if [ x"$olddebversion" != x"$newversion" ]; then
51    clog=debian/changelog
52    datestamp=$(date -R)
53    cat <<END - $clog >$clog.new
54 wiringpi ($newversion) RASPBIAN; urgency=medium
55
56   * New upstream version
57
58  -- Gordon Henderson <projects@drogon.net>  $datestamp
59
60 END
61   mv -f $clog.new $clog
62 fi