This repository has been archived by the owner on Apr 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgenerate-deb
executable file
·77 lines (65 loc) · 1.75 KB
/
generate-deb
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
#! /bin/sh
create_source_dist()
(
cd source
python setup.py sdist 1>&2
gcs_version=$(cat globus/connect/server/version)
cd "$OLDPWD"
mv source/dist/globus_connect_server-${gcs_version}.tar.gz .
echo globus_connect_server-${gcs_version}.tar.gz
)
download_include_binaries()
(
packaging_dir="$1"
include_binaries_file="${packaging_dir}/debian/globus-connect-server/debian/source/include-binaries"
binaries=""
while read line; do
wheel="${line%%-*}"
wheel_version="${line#*-}"
wheel_version="${wheel_version%%-*}"
mkdir -p "$wheel"
pip download -q -d "$wheel" --no-deps "$wheel==$wheel_version"
if [ $? = 0 ]; then
for f in "$wheel"/*; do
mv "$f" .
echo "${f##*/}"
done
fi
rmdir "$wheel"
done < "$include_binaries_file"
)
unpack_sources()
(
gcs_source="$1"
include_binaries="$2"
build_dir="$3"
rm -rf "${build_dir}"
mkdir -p "${build_dir}"
tar --strip 1 -C "${build_dir}" -zxf "${gcs_source}"
for binary in $include_binaries; do
cp "${binary}" "${build_dir}"
done
)
debianize()
(
packaging_dir="$1"
build_dir="$2"
changelog="${build_dir}/debian/changelog"
cp -R ${packaging_dir}/debian/globus-connect-server/debian ${build_dir}/debian
sed -e "s/@distro@/$(lsb_release -cs)/g" \
< "${changelog}.in" \
> "${changelog}"
)
build_packages()
(
build_dir="$1"
cd "${build_dir}"
dpkg-buildpackage -uc -b
)
# MAIN
build_dir="build/globus-connect-server"
source_dist="$(create_source_dist)"
include_binaries="$(download_include_binaries "$(dirname "$0")/packaging")"
unpack_sources "$source_dist" "${include_binaries}" "${build_dir}"
debianize "$(dirname "$0")/packaging" "${build_dir}"
build_packages "${build_dir}"