-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-package-from-commitid
executable file
·99 lines (89 loc) · 2.62 KB
/
build-package-from-commitid
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
#!/bin/bash
usage="Usage: $(basename $0) -c COMMIT_ID [-i] [-n] [-b BUILD_NUMBER] [-t TEMP_BRANCH] [-s BUILD_SUFFIX] [-g GEN_VERS_STR_ARGS]"
commitID=""
buildNum="1"
buildSuffix="~autobuild"
tempBranch="build"
interactive=""
noBuild=""
shaderc=""
genVersArgs=""
while getopts ":c:b:t:s:g:in" options; do
case $options in
c ) commitID="${OPTARG}";;
b ) buildNum="${OPTARG}";;
t ) tempBranch="${OPTARG}";;
s ) buildSuffix="${OPTARG}";;
g ) genVersArgs="${OPTARG}";;
i ) interactive="TRUE";;
n ) noBuild="TRUE";;
* ) echo $usage
exit 1;;
esac
done
if [ -z "$commitID" ]; then
echo $usage
exit 1
fi
git reset --hard
git clean -f
git checkout debian-unstable
newVersion="$($(dirname $(readlink -f $0))/generate-version-string -v -u ${commitID} ${genVersArgs})"
if [ "$interactive" ]; then
newVersion=$(zenity --entry \
--title="Version String" \
--text="Verify/modify Version string for this build" \
--entry-text="$newVersion")
fi
[ -z "$newVersion" ] && exit 1
git checkout -B upstream-unstable
git reset --hard ${commitID}
# I'm shaderc, and I'm special...
if [ -e update_shaderc_sources.py ]; then
# Check out actual shaderc source, along with other dependencies
rm -fr src
./update_shaderc_sources.py
find src -name .git | xargs rm -fr
git add src
git ci -m "Update shaderc upstream sources"
fi
git checkout -B ${tempBranch}
git checkout debian-unstable -- debian
cimsg="merge debian packaging"
if [ "$interactive" ]; then
cimsg=$(zenity --entry \
--title="Add Debian packaging" \
--text="Enter a comment for this commit" \
--entry-text="$cimsg")
fi
[ -z "$cimsg" ] && exit 1
git commit -m "$cimsg"
cimsg="merge debian-unstable branch to connect histories"
if [ "$interactive" ]; then
cimsg=$(zenity --entry \
--title="debian-unstable branch merge" \
--text="Enter a comment for this commit " \
--entry-text="$cimsg")
fi
[ -z "$cimsg" ] && exit 1
git merge debian-unstable -s ours -m "$cimsg"
echo "Building Package Version: $newVersion"
# Update changelog:
cimsg="Automated package build"
if [ "$interactive" ]; then
cimsg=$(zenity --entry \
--title="update debian/changelog" \
--text="Enter a comment for the changelog" \
--entry-text="$cimsg")
fi
[ -z "$cimsg" ] && exit 1
dch -r --distribution=unstable ""
dch --newversion "${newVersion}" "$cimsg"
# Commit changelog and kick off a build..
if [ -z "$noBuild" ]; then
git add debian/changelog
echo "$(git rev-parse $commitID)" > debian/lunarg-build-commit
git add debian/lunarg-build-commit
git commit -m "$cimsg"
cowbuild-package-lunarg -b "${buildNum}" -s "${buildSuffix}"
fi