summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Marano <zmarano@google.com>2016-05-19 14:03:27 -0700
committerZach Marano <zmarano@google.com>2016-05-19 14:03:27 -0700
commit1792e26ed216263b59017ca04162b3e082a45d45 (patch)
tree969a9a7c69b404e1223d4165100558d03447e480
parent55272466477ee72827e6ee590fe322430307eb60 (diff)
parent55d654ff2781c6d4cc723f5d7edc04cbe9429ddf (diff)
downloadgoogle-compute-image-packages-1792e26ed216263b59017ca04162b3e082a45d45.tar.gz
Merge pull request #241 from zmarano/development
Create deb and rpm packages per distro.
-rwxr-xr-xpackage.sh46
-rwxr-xr-xsetup.py2
2 files changed, 29 insertions, 19 deletions
diff --git a/package.sh b/package.sh
index 57de839..ca92851 100755
--- a/package.sh
+++ b/package.sh
@@ -15,30 +15,40 @@
# Build the Linux guest environment deb and rpm packages.
-TIMESTAMP="$(date -u +%Y%m%d%H%M%S)"
+TIMESTAMP="$(date +%s)"
-for CONFIG in 'systemd' 'sysvinit' 'upstart'; do
- export CONFIG="$CONFIG"
+function build_distro() {
+ declare -r distro="$1"
+ declare -r pkg_type="$2"
+ declare -r init_config="$3"
+ declare -r py_path="$4"
+ declare name='google-compute-engine'
- fpm \
- -s python \
- -t deb \
- --no-python-fix-name \
- --python-install-bin '/usr/bin' \
- --python-install-lib '/usr/lib/python2.7/dist-packages' \
- --after-install "package/$CONFIG/postinst.sh" \
- --before-remove "package/$CONFIG/prerm.sh" \
- --iteration "0.$TIMESTAMP" \
- setup.py
+ export CONFIG="$init_config"
+
+ if [[ "${pkg_type}" == 'deb' ]]; then
+ name="$name-$distro"
+ fi
fpm \
+ -n "${name}" \
-s python \
- -t rpm \
+ -t "${pkg_type}" \
+ -m 'gc-team@google.com' \
--no-python-fix-name \
--python-install-bin '/usr/bin' \
- --python-install-lib '/usr/lib/python2.7/site-packages' \
- --after-install "package/$CONFIG/postinst.sh" \
- --before-remove "package/$CONFIG/prerm.sh" \
+ --python-install-lib "$py_path" \
+ --rpm-dist "$distro" \
+ --after-install "package/${init_config}/postinst.sh" \
+ --before-remove "package/${init_config}/prerm.sh" \
--iteration "0.$TIMESTAMP" \
setup.py
-done
+}
+
+# RHEL/CentOS
+build_distro 'el6' 'rpm' 'upstart' '/usr/lib/python2.6/site-packages'
+build_distro 'el7' 'rpm' 'systemd' '/usr/lib/python2.7/site-packages'
+
+# Debian
+build_distro 'deb7' 'deb' 'sysvinit' '/usr/lib/python2.7/dist-packages'
+build_distro 'deb8' 'deb' 'systemd' '/usr/lib/python2.7/dist-packages'
diff --git a/setup.py b/setup.py
index a0f04af..1f7446a 100755
--- a/setup.py
+++ b/setup.py
@@ -57,7 +57,7 @@ setuptools.setup(
install_requires=['boto>=2.25.0'],
license='Apache Software License',
long_description='Google Compute Engine guest environment.',
- name='google-compute-engine-%s' % os.environ['CONFIG'],
+ name='google-compute-engine',
packages=setuptools.find_packages(),
scripts=glob.glob('scripts/*'),
url='https://github.com/GoogleCloudPlatform/compute-image-packages',