-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-rpmbuild-local.sh
More file actions
executable file
·59 lines (47 loc) · 981 Bytes
/
test-rpmbuild-local.sh
File metadata and controls
executable file
·59 lines (47 loc) · 981 Bytes
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
#!/bin/bash
set -u
t=${BASH_SOURCE[0]}
t=$(dirname ${t})
t=$(realpath ${t})
syntax() {
echo "testbuild-pkgs -i <input-dir> -n"
}
inputdir=""
keep=0
while getopts "i:k" o; do
case "${o}" in
i)
inputdir=${OPTARG}
;;
k)
keep=1
;;
*)
syntax
exit 1
;;
esac
done
if [ -z "$inputdir" ] ; then
echo error: no input directory specified
echo
syntax
exit 1
fi
test_srpm() {
cleanups () {
rm -rf ${RPM_TARGET_DIR}
}
RPM_TARGET_DIR=`mktemp --tmpdir -d XXXXXXrpm-packaging-testing`
SRPM_FILE=${inputdir}/*.src.rpm
rpm --define "_topdir ${RPM_TARGET_DIR}" -i ${inputdir}/*.src.rpm
find ${RPM_TARGET_DIR}
sudo unshare -n sudo -u ${USER} rpmbuild -ba \
--define "_topdir ${RPM_TARGET_DIR}" \
${RPM_TARGET_DIR}/SPECS/*.spec \
if [[ "$keep" == "0" ]] ; then
cleanups
fi
return 0
}
test_srpm