-
Notifications
You must be signed in to change notification settings - Fork 11
/
build_packages
executable file
·64 lines (54 loc) · 1.98 KB
/
build_packages
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
#!/bin/bash
# make bash behave
set -euo pipefail
IFS=$'\n\t'
pgversions='9.4 9.5'
topdir=$(pwd)
packagesdir=${topdir}/packages
badusage=64
if [ "$#" -ne 2 ]; then
echo "$0: project and build type required" >&2
exit $badusage
fi
project=$1
buildtype=$2
name=$(git config --get user.name)
email=$(git config --get user.email)
packager="${name} <${email}>"
mkdir -p "${packagesdir}"
while read -r line; do
IFS=',' read -r os release <<< "$line"
if [ -z "${release}" ]; then
outputdir="${packagesdir}/${os}"
else
outputdir="${packagesdir}/${os}-${release}"
fi
mkdir -p "${outputdir}"
if [[ "${os}" = 'debian' ]] || [[ "${os}" = 'ubuntu' ]]; then
docker run --rm -v "${outputdir}:/packages" \
-e "GITHUB_TOKEN=${GITHUB_TOKEN}" \
-e "DEBFULLNAME=${name}" -e "DEBEMAIL=${email}" \
"citusdata/packaging:${os}-${release}-all" "$project" "$buildtype"
elif [[ "${os}" = 'centos' ]] || [[ "${os}" = 'fedora' ]] || [[ "${os}" = 'oraclelinux' ]]; then
# redhat variants need to build each PostgreSQL version separately
IFS=' '
for pgversion in ${pgversions}; do
pgshort=${pgversion//./}
docker run --rm -v "${outputdir}:/packages" \
-e "GITHUB_TOKEN=${GITHUB_TOKEN}" \
-e "RPM_PACKAGER=${packager}" \
"citusdata/packaging:${os}-${release}-pg${pgshort}" "$project" "$buildtype"
done
elif [[ "${os}" = 'pgxn' ]]; then
if [[ "${project}" = 'citus' ]] && [[ "${buildtype}" = 'release' ]]; then
docker run --rm -v "${outputdir}:/packages" \
-e "GITHUB_TOKEN=${GITHUB_TOKEN}" \
"citusdata/packaging:${os}-all" "$project" "$buildtype"
else
echo "skipping PGXN... unsupported for this build" >&2
fi
else
echo "$0: unrecognized OS -- ${os}" >&2
exit $badusage
fi
done <"${topdir}/os-list.csv"