aboutsummaryrefslogtreecommitdiff
path: root/prepare-release
blob: e8805b414c6520a39db6bf568607b3fe0bfa48d8 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash

if [ $# -lt 1 ] ; then
  echo "Version has to be specified"
  exit 1
fi

V_TXT="$1"

cd "$(dirname "$0")"

V_DATE_MDY="$( date '+%m/%d/%Y' )"
V_DATE_YMD="$( date '+%Y-%m-%d' )"
V_DATE_RFC="$( date -R )"

V_USER_NAME="$(git config user.name)"
V_USER_EMAIL="$(git config user.email)"

DEBIAN_NATIVE=1

sed --in-place \
  -e 's#^\([\t ]*\)versionText = "Version [^"]*\\n";.*$#\1versionText = "Version '"$V_TXT"'\\n";#' \
  qtmips_gui/aboutdialog.cpp

sed --in-place \
  -e 's#^\([\t ]*\)app.setApplicationVersion("[^"]*");.*$#\1app.setApplicationVersion("'"$V_TXT"'");#' \
  qtmips_gui/main.cpp

sed --in-place \
  -e 's#^\([\t ]*\)app.setApplicationVersion("[^"]*");.*$#\1app.setApplicationVersion("'"$V_TXT"'");#' \
  qtmips_cli/main.cpp

if [ $DEBIAN_NATIVE -eq 1 ] ; then

if grep -q "qtmips ($V_TXT)" debian/changelog ; then
sed --in-place \
  -e '1,/^ -- .*$/s/^ -- .*$/'" -- $V_USER_NAME <$V_USER_EMAIL>  $V_DATE_RFC/" \
  debian/changelog
else
cat >debian/changelog.tmp <<EOF
qtmips ($V_TXT) unstable; urgency=medium

  * Debian package updated to version $V_TXT.

 -- $V_USER_NAME <$V_USER_EMAIL>  $V_DATE_RFC

EOF
cat debian/changelog >>debian/changelog.tmp
mv debian/changelog.tmp debian/changelog
fi

nedit-nc debian/changelog

fi # DEBIAN_NATIVE

sed --in-place \
  -e 's#^\(Version:[\t ]*\)[^ ]\+ *$#\1'"$V_TXT"'#' \
  qtmips.spec

if [ $DEBIAN_NATIVE -eq 1 ] ; then

echo Press enter to continue
read x

git add debian/changelog qtmips_gui/aboutdialog.cpp \
        qtmips_gui/main.cpp qtmips.spec

fi # DEBIAN_NATIVE

echo >.git/GITGUI_MSG "Version updated to $V_TXT"

git gui

git tag -d v$V_TXT

git tag -s v$V_TXT

if [ $DEBIAN_NATIVE -eq 0 ] ; then

gbp import-ref --upstream-version=$V_TXT --upstream-tag=v$V_TXT --debian-branch=debian/master

git checkout debian/master -- .

gbp dch --debian-branch=debian/master --release

fi # !DEBIAN_NATIVE

rm -rf ../debian-test-build

mkdir -p ../debian-test-build/qtmips-$V_TXT

cp -xa . ../debian-test-build/qtmips-$V_TXT

cd ../debian-test-build/qtmips-$V_TXT || exit 1

if [ -x  /usr/lib/obs-build/changelog2spec ] ; then
  /usr/lib/obs-build/changelog2spec debian/changelog >../qtmips.changes
fi

dpkg-buildpackage