Skip to content

Commit 8069ee9

Browse files
committed
Create a simple shell script to automate tagging an EGit release
It is necessary to update the Eclipse MANIFEST.MF files with our current version number when we cut a new release of the project. This script automates that edit. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent bb4dd1f commit 8069ee9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tag_egit.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
# Updates MANIFEST.MF files for EGit plugins.
4+
5+
v=$1
6+
if [ -z "$v" ]
7+
then
8+
echo >&2 "usage: $0 version"
9+
exit 1
10+
fi
11+
12+
MF=$(git ls-files | grep META-INF/MANIFEST.MF)
13+
FX=org.spearce.egit-feature/feature.xml
14+
SX=org.spearce.egit-updatesite/site.xml
15+
ALL="$MF $FX $SX"
16+
17+
replace() {
18+
version=$1
19+
20+
perl -pi -e 's/^(Bundle-Version:).*/$1 '$version/ $MF
21+
perl -pi -e '
22+
if (/^.*version=/ && ++$f == 2) {
23+
s/^(.*version)=".*"/$1="'$version'"/
24+
}' $FX
25+
perl -pi -e '
26+
next if /^<\?xml/;
27+
s/(egit_).*?(.jar)/${1}'$version'$2/;
28+
s/(version)=".*?"/$1="'$version'"/;
29+
' $SX
30+
}
31+
32+
replace $v
33+
git commit -s -m "EGit $v" $ALL &&
34+
c=$(git rev-parse HEAD) &&
35+
36+
replace $v.qualifier &&
37+
git commit -s -m "Re-add version qualifier suffix to $v" $ALL &&
38+
39+
echo &&
40+
tagcmd="git tag -s -m 'EGit $v' v$v $c" &&
41+
if ! eval $tagcmd
42+
then
43+
echo >&2
44+
echo >&2 "Tag with:"
45+
echo >&2 " $tagcmd"
46+
exit 1
47+
fi || exit

0 commit comments

Comments
 (0)