-
Notifications
You must be signed in to change notification settings - Fork 1
/
mme-all
executable file
·100 lines (84 loc) · 2.32 KB
/
mme-all
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/sh -x
# mme-all sp4
set -o errexit
GIT=""
USAGE=false
BRANCH=true
while getopts hrg:B FLAG; do
case $FLAG in
h) USAGE=true;;
r) PKG="$OPTARG";;
g) GIT="$OPTARG";;
B) BRANCH=false;;
*) USAGE=true; RC=1;;
esac
done
shift $((OPTIND-1))
if $USAGE; then
set +x
# Remember to update README.md when changing this
echo "Usage: $0 [options] SHORT_PRJ [build options]"
echo
echo " where SHORT_PRJ is sp4 or sp3 (for SLE11), sle10sp4 ..."
echo
echo "Options:"
echo " -h Help"
echo " -r <RPM name>; defaults to contents of RPMNAME"
echo " -g <git URL> clone from here instead;"
echo " defaults to CWD if .git/ exists"
echo " -B Don't branch the OBS project"
echo
echo "Build options:"
echo " anything for 'osc build'; --no-verify or -x strace may be useful"
exit $RC
fi
if [ -d ".git" ]; then
GIT=$(pwd)
fi
if [ -f RPMNAME ]; then
PKG=$(cat RPMNAME)
fi
SHORT_PRJ=$1
shift 1
# set OSC_BUILD_ROOT
. mme-env "$PKG" "$SHORT_PRJ"
if test $PKG = yast2-devtools; then
# yast2-devtools needs to bootstrap via an older RPM
EXTRA_BUILD="-x yast2-devtools"
fi
OSC_WORK=`mme-getpac $($BRANCH || echo -B) "$PKG" "$SHORT_PRJ"`
cd $OSC_WORK
#caching build before I work on the package:
if [ -f $OSC_BUILD_ROOT/usr/src/packages/SOURCES/$PKG.changes ]; then
: assuming the package has been built, recently
else
# short circuit the first build
# But we must check that it really got that far
SUCCESS_FILE=/tmp/build-root-ready
rm -f $OSC_BUILD_ROOT/$SUCCESS_FILE
sed -i -e "/^%build/atouch $SUCCESS_FILE; exit 1" $PKG.spec
osc build --build-uid=caller "$EXTRA_BUILD" "$@" || :
rm $OSC_BUILD_ROOT/$SUCCESS_FILE # fails if not present
fi
# WTF? "BuildService API error: can't verify packages due to lack of GPG keys"
# retry with --no-verify
#make a tarball in the chroot:
mkdir -p $OSC_BUILD_ROOT/tmp
VCS=`mktemp -d $OSC_BUILD_ROOT/tmp/$PKG-XXXX`
cd $VCS
mme-getvcs -g "$GIT" $PKG $SHORT_PRJ
mme-makepac --clone $VCS/.mme-makepac
NEW_PKG=$OSC_BUILD_ROOT$(mme-chroot sh -c "
cd ${VCS#$OSC_BUILD_ROOT}
./.mme-makepac $PKG $SHORT_PRJ
")
rm -v $OSC_WORK/*.tar.*
cp -av $NEW_PKG/* $OSC_WORK
cd $OSC_WORK
osc ar
osc build --build-uid=caller -k /tmp "$@"
rm -rf $VCS
echo DONE. Suggestion:
: cd `pwd`
: osc ci
: osc sr