-
Notifications
You must be signed in to change notification settings - Fork 29
/
build_rpms.sh
executable file
·59 lines (50 loc) · 1.81 KB
/
build_rpms.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
#! /bin/bash
# this is the sourcedir
topdir=$PWD
echo I: VERSION is $VERSION
# Get the options passed by the Makefile
while getopts ":d:v:t:p:i:" o; do
case "${o}" in
d)
DISTRO=${OPTARG}
;;
v)
DISTROVERSION=${OPTARG}
;;
t)
TARGET_DIR=${OPTARG}
;;
p)
RPM_DIR=${OPTARG}
;;
i)
CONTAINER=${OPTARG}
esac
done
# Use docker if a container is specified, otherwise just run locally
# None -> Backwards compat
if [ x"${CONTAINER}" != "x" -a "${CONTAINER}" != "None" ]; then
BUILD_DEPS="dnf install -y python3 rpm-build"
if [ "${TARGET_DIR}" == "ttbd" ]; then
# Find the build dependencies from the generated setup.cfg file
BUILD_DEPS+=$(awk '/build_requires/ && \
!f{f=1;x=$0;sub(/[^ ].*/,"",x);x=x" ";next} \
f {if (substr($0,1,length(x))==x) \
{sub(/^[ \t]+/, "");printf " %s",$0;} else f=0}' \
ttbd/setup.cfg)
fi
BDIST_OPTS="--dist-dir=$topdir/dist/ --bdist-base=$topdir/dist/"
RUN_SETUP="python3 ./setup.py bdist_rpm ${BDIST_OPTS}"
# --rm
podman run \
-v $HOME/.cache/dnf:/var/cache/dnf -v ${PWD}:${PWD} \
--env VERSION="$VERSION" \
--env HTTP_PROXY=${HTTP_PROXY} --env http_proxy=${http_proxy} \
--env HTTPS_PROXY=${HTTPS_PROXY} --env https_proxy=${https_proxy} \
${DISTRO}:${DISTROVERSION} \
/bin/bash -c "dnf install -y python-yaml rpm-build; cd $topdir/${TARGET_DIR}; $topdir/nreqs.py install build.nreqs.yaml; ${RUN_SETUP}"
else
cd ${PWD}/${TARGET_DIR}
$topdir/nreqs.py install build.nreqs.yaml
python3 ./setup.py bdist_rpm --dist-dir=${RPM_DIR}/ --bdist-base=${PWD}/dist/
fi