This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_packages.sh
executable file
·103 lines (90 loc) · 3.08 KB
/
build_packages.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
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
101
102
103
#!/bin/bash
PACKAGE_BRANCH=master
REPO_ROOT=${HOME}/repo/${PACKAGE_BRANCH}
# targets to build for
TARGET_LIST=(\
epel-7-x86_64 \
fedora-32-x86_64 \
fedora-33-x86_64 \
fedora-32-aarch64 \
fedora-33-aarch64 \
)
# list of packages to build, *in this order*
PACKAGE_LIST=(\
vpn-ca \
vpn-daemon \
php-fkooman-secookie \
php-saml-sp \
php-saml-sp-artwork-eduVPN \
php-fkooman-jwt \
php-fkooman-otp-verifier \
php-fkooman-oauth2-server \
php-fkooman-sqlite-migrate \
php-LC-openvpn-connection-manager \
php-LC-common \
vpn-server-api \
vpn-server-node \
vpn-user-portal \
vpn-portal-artwork-eduVPN \
vpn-portal-artwork-LC \
php-json-signer \
vpn-maint-scripts \
)
# update the repositories with RPM spec files
for PACKAGE_NAME in "${PACKAGE_LIST[@]}"
do
# if we already have the package git repository, simply update it
if [ -d "${PACKAGE_NAME}" ]
then
(
cd ${PACKAGE_NAME}
git checkout ${PACKAGE_BRANCH}
git pull origin ${PACKAGE_BRANCH}
)
else
# otherwise, clone it
git clone -b ${PACKAGE_BRANCH} https://git.tuxed.net/rpm/${PACKAGE_NAME}
fi
done
for TARGET_NAME in "${TARGET_LIST[@]}"
do
echo "**********************************************************"
echo "* Building ${TARGET_NAME}..."
echo "**********************************************************"
# determine ARCH based on target name
ARCH=$(echo ${TARGET_NAME} | cut -d '-' -f 3)
SRPM_LIST=""
# generate source RPMs for all the packages and add them to the list of
# packages that need to be (re)build
for PACKAGE_NAME in "${PACKAGE_LIST[@]}"
do
# generate source RPM
cp ${PACKAGE_NAME}/SOURCES/* ${HOME}/rpmbuild/SOURCES
spectool -g -R ${PACKAGE_NAME}/SPECS/${PACKAGE_NAME}.spec
SRPM_FILE=$(rpmbuild -bs "${PACKAGE_NAME}/SPECS/${PACKAGE_NAME}".spec | grep Wrote | cut -d ':' -f 2 | xargs)
PACKAGE_NAME=$(basename "${SRPM_FILE}" .src.rpm)
# check whether we already have a build of this exact version, if not,
# add it to the list
if [ ! -f "${REPO_ROOT}/results/${TARGET_NAME}/${PACKAGE_NAME}/success" ]
then
SRPM_LIST="${SRPM_LIST} ${SRPM_FILE}"
fi
done
# only call mock when we have something to do...
if [ "" = "${SRPM_LIST}" ]
then
echo "*** No (new) packages to build!"
# continue with the next TARGET
continue
fi
echo "**********************************************************"
echo "* Building (${TARGET_NAME}): ${SRPM_LIST}..."
echo "**********************************************************"
mock --chain -r "${TARGET_NAME}" --localrepo="${REPO_ROOT}" --arch "${ARCH}" ${SRPM_LIST}
# the mock "sign" plugin is broken
# @see https://github.com/rpm-software-management/mock/issues/476
# sign (all) packages
rpmsign --addsign $(find ${REPO_ROOT}/results/${TARGET_NAME} -type f | grep \.rpm$ | xargs)
# recreate the repository
createrepo_c ${REPO_ROOT}/results/${TARGET_NAME}
done