File: git.release

package info (click to toggle)
xca 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,328 kB
  • sloc: cpp: 30,584; sh: 341; xml: 74; makefile: 56; python: 34
file content (72 lines) | stat: -rwxr-xr-x 1,688 bytes parent folder | download
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
#!/bin/sh

set -e

type git || exit 1
test -s VERSION.txt && test -s changelog && test -d ../qt

export TVERSION="$1"
commit=HEAD
test -z "$2" || commit="$2"

if test -z "$TVERSION"; then
  echo "usage: $0 <VERSION> [commit]"
  echo "   if commit is omitted, 'HEAD' is used"
  exit 1
fi

TAG="RELEASE.$TVERSION"
if git tag | grep "$TAG"; then
  echo Tag $TVERSION already exists
  exit 1
fi

if ! git diff-index --quiet HEAD --; then
  echo "You have local changes, please commit, reset or stash them"
  exit 1
fi

lasttag=$(git describe --abbrev=0 HEAD)
unset unchanged
for i in changelog README.md; do
  if git diff --quiet "$lasttag" -- $i; then
    echo "File $i untouched since $lasttag"
    unchanged="x"
  fi
done

if test -n "$unchanged"; then
  echo "Are you sure to not change the file(s) above?"
  read a
fi

x=$(git grep "^xca $TVERSION " changelog ||
  git grep "^$TVERSION\$" VERSION.txt || :)

if test -n "$x"; then
  echo "$x"
  echo Release $TVERSION already exists
  exit 1
fi

echo "$TVERSION" > VERSION.txt
(
 MSG=$(LANG=C date +"xca $TVERSION %a %b %d %Y")
 echo "$MSG"
 head -c ${#MSG} /dev/zero | tr '\0' '-'
 echo '\n'
 cat changelog
) > changelog.new
mv changelog.new changelog
sed -i "s|\(<releases>\)|\1\n        <release date=\"$(date -I)\" version=\"$TVERSION\" />|"\
	misc/de.hohnstaedt.xca.metainfo.xml

git commit VERSION.txt changelog  misc/de.hohnstaedt.xca.metainfo.xml \
	-m "Prepare XCA $TVERSION"
git tag -a "$TAG" -m "Release version $TVERSION"

# Create the tar.gz
git archive --format=tar.gz --prefix=xca-$TVERSION/ --output xca-$TVERSION.tar.gz "$TAG"
releasedir="$HOME/xca-$TVERSION"
mkdir -p "$releasedir"
cp xca-$TVERSION.tar.gz "$releasedir"