-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpack-and-build-trunkg.sh
executable file
·65 lines (58 loc) · 1.55 KB
/
pack-and-build-trunkg.sh
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
#!/bin/sh
# Usage: $0 package-dir opt-name
if test -z "$1" -o -z "$2"; then
echo Usage: $0 gcc-branch package-dir
exit 1
fi
package=gcc
toplevel=$1
packagedir=$2
if ! test -e .git; then
echo "Need to run inside git working copy"
exit 1;
fi
git fetch || exit 1
git rev-parse $toplevel || exit 1
rev=`git rev-parse $toplevel`
v=`git show $rev:gcc/BASE-VER`
# use the count from git gcc-descr with 13+
if test "`echo $v | cut -d '.' -f 1`" -ge "13"; then
r=`git gcc-descr $toplevel | sed -e 's/.*-\([0-9]*\)-.*/\1/'`
else
# use gcc-BASE-VER+r<number of commits on the branch>
r=`git rev-list --count $rev ^origin/master`
fi
if test "`echo $v | cut -d '.' -f 1`" -lt "5"; then
if test "`git show $rev:gcc/DEV-PHASE`" == "prerelease"; then
v=`echo $v | cut -d '.' -f 1-2 | tr -d '\n'; echo -n .; echo $v | cut -d '.' -f 3 | tr '0123456789' '0012345678'`
fi
if test "`git show $rev:gcc/DEV-PHASE`" == ""; then
pkg="$package-$v"
else
pkg="$package-$v+git$r"
fi
else
pkg="$package-$v+git$r"
fi
if ! test -z "$3"; then
pkg="$3"
fi
echo $pkg
if test -e $pkg; then
echo oops, local $pkg exists
exit 1
fi
mkdir -p $pkg/gcc
echo "[revision $rev]" > $pkg/gcc/REVISION
git archive --format=tar --prefix=$pkg/ -o $packagedir/$pkg.tar $rev
tar rvf $packagedir/$pkg.tar $pkg/gcc/REVISION
rm -Rf $pkg
xz -T0 $packagedir/$pkg.tar
ls -l $packagedir/$pkg.tar.xz
cd $packagedir
mv gcc.spec.in gcc.spec.in.old
sed -e "s/Version:.*$/Version: ${v}+git$r/;" \
< gcc.spec.in.old > gcc.spec.in
chmod 755 pre_checkin.sh
./pre_checkin.sh
rm gcc.spec.in.old