forked from xenserver/planex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mksrpm
executable file
·54 lines (43 loc) · 1.24 KB
/
mksrpm
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
#!/usr/bin/env bash
TMPDIR=$(mktemp --tmpdir -d mksrpm.XXXXXXXXX)
cleanup() {
if [ -n "$TMPDIR" ]; then
rm -rf "$TMPDIR"
fi
}
ecleanup() {
cleanup
exit 1
}
trap ecleanup EXIT
trap ecleanup INT
trap cleanup TERM
set -e
MOCKCFG=$1; shift
HERE=$(dirname $0)
cd "$HERE"
SPECVER=$(rpmspec -q --qf '%{version}' "$HERE/planex.spec")
SRCVER=$(cat "$HERE/config/version")
echo "*** GENERATE PYTHON SOURCE DIST ***"
python setup.py sdist
echo "*** SET UP RPM SPEC FILE ***"
cp "$HERE/planex.spec" "$HERE/dist/planex.spec"
if [ "$SPECVER" != "$SRCVER" ]; then
echo "**** Forcing planex.spec ($SPECVER) to match source ($SRCVER)"
rpmdev-bumpspec -n "$SRCVER" "$HERE/dist/planex.spec"
fi
echo "*** GENERATE SOURCE RPM ***"
mkdir -p "$TMPDIR/SRPM"
mock -r "$MOCKCFG" --buildsrpm \
--spec "$HERE/dist/planex.spec" \
--source "$HERE/dist" \
--resultdir="$TMPDIR/SRPM"
## Build a miniplanex. This is for Koji and other planes where none of
## the mock/createrepo stuff is ever used.
mkdir -p "$TMPDIR/RPM"
echo "*** REBUILD SOURCE RPM ***"
mock -r "$MOCKCFG" --rebuild \
--define "miniplanex 1" \
--resultdir="$TMPDIR/RPM" "$TMPDIR/SRPM"/*.src.rpm
echo "*** COPY PACKAGES TO dist/ ***"
cp -v "$TMPDIR/RPM"/*.rpm "$HERE/dist/"