From 4ae1834e89a1b43d0d54b817397208232f5835a0 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Mon, 22 Aug 2016 12:59:37 +0200 Subject: Honeycomb deb packaging Change-Id: I6f029ef9236cbd3f7f20fd8e44f83b15cdedc5db Signed-off-by: Maros Marsalek --- common/minimal-distribution-parent/pom.xml | 12 +++++--- packaging/deb/.gitignore | 5 ++++ packaging/deb/debian/compat | 1 + packaging/deb/debian/control | 13 +++++++++ packaging/deb/debian/copyright | 23 +++++++++++++++ packaging/deb/debian/rules | 32 +++++++++++++++++++++ packaging/deb/debian/source/format | 1 + packaging/deb/debuild.sh | 45 ++++++++++++++++++++++++++++++ packaging/deb/honeycomb.conf | 8 ++++++ packaging/rpm/honeycomb.service | 2 +- packaging/rpm/rpmbuild.sh | 1 + 11 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 packaging/deb/.gitignore create mode 100644 packaging/deb/debian/compat create mode 100644 packaging/deb/debian/control create mode 100644 packaging/deb/debian/copyright create mode 100755 packaging/deb/debian/rules create mode 100644 packaging/deb/debian/source/format create mode 100755 packaging/deb/debuild.sh create mode 100644 packaging/deb/honeycomb.conf diff --git a/common/minimal-distribution-parent/pom.xml b/common/minimal-distribution-parent/pom.xml index bfc0aef6b..36514dfe6 100644 --- a/common/minimal-distribution-parent/pom.xml +++ b/common/minimal-distribution-parent/pom.xml @@ -146,15 +146,19 @@ log.info "Generating shell exec script" def args = properties.getOrDefault("exec.parameters", "") log.debug "Additional shell exec script properties: ${args}" - def scriptContent = "java ${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar &" + def scriptContent = "java ${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar" log.info "Generating shell exec script as ${scriptContent}" def scriptParent = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources") scriptParent.toFile().mkdirs() def scriptPath = Paths.get(scriptParent.toString(), "honeycomb") log.info "Writing shell exec script to ${scriptPath}" - scriptPath.toFile().text = "#!/bin/sh -" - scriptPath.toFile().text += "\n" - scriptPath.toFile().text += scriptContent + scriptContent = "#!/bin/sh -\n" + scriptContent + scriptPath.toFile().text = scriptContent + scriptPath.toFile().setExecutable(true) + + scriptPath = Paths.get(scriptParent.toString(), "honeycomb-start") + log.info "Writing shell exec script to ${scriptPath}" + scriptPath.toFile().text = scriptContent + " &" scriptPath.toFile().setExecutable(true) diff --git a/packaging/deb/.gitignore b/packaging/deb/.gitignore new file mode 100644 index 000000000..79f1221ce --- /dev/null +++ b/packaging/deb/.gitignore @@ -0,0 +1,5 @@ +*.tar.xz +*.tar.gz +honeycomb-*/ +*.deb +*.changes \ No newline at end of file diff --git a/packaging/deb/debian/compat b/packaging/deb/debian/compat new file mode 100644 index 000000000..ec635144f --- /dev/null +++ b/packaging/deb/debian/compat @@ -0,0 +1 @@ +9 diff --git a/packaging/deb/debian/control b/packaging/deb/debian/control new file mode 100644 index 000000000..98ca224c4 --- /dev/null +++ b/packaging/deb/debian/control @@ -0,0 +1,13 @@ +Source: honeycomb +Section: misc +Priority: optional +Maintainer: fd.io/honeycomb +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.6 +Homepage: https://wiki.fd.io/view/Honeycomb +Vcs-Browser: https://git.fd.io/cgit/honeycomb/tree/ + +Package: honeycomb +Architecture: all +Depends: vpp, openjdk-8-jdk | openjdk-8-jre +Description: Honeycomb agent for VPP diff --git a/packaging/deb/debian/copyright b/packaging/deb/debian/copyright new file mode 100644 index 000000000..ad3a88c26 --- /dev/null +++ b/packaging/deb/debian/copyright @@ -0,0 +1,23 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: honeycomb +Source: https://git.fd.io/cgit/honeycomb/tree/ + +Files: * +Copyright: 2016 Cisco and/or its affiliates +License: Apache-2.0 + Copyright (c) 2016 Cisco and/or its affiliates. + . + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/packaging/deb/debian/rules b/packaging/deb/debian/rules new file mode 100755 index 000000000..5c1cebc20 --- /dev/null +++ b/packaging/deb/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + +# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +# main packaging script based on dh7 syntax +%: + dh $@ + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- \ +# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + + + + diff --git a/packaging/deb/debian/source/format b/packaging/deb/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/packaging/deb/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/packaging/deb/debuild.sh b/packaging/deb/debuild.sh new file mode 100755 index 000000000..95327fa35 --- /dev/null +++ b/packaging/deb/debuild.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -xe +DIR=$(dirname $0) +DIR=$(readlink -f $DIR) +VERSION=$(${DIR}/../rpm/version) +RELEASE=$(${DIR}/../rpm/release) +PACKAGING_ROOT=${DIR}/honeycomb-${VERSION} + +# Copy and unpack the archive with vpp-integration distribution +ARCHIVE_DIR=${DIR}/../../vpp-integration/minimal-distribution/target/ +ARCHIVE=${ARCHIVE_DIR}/vpp-integration-distribution-1.0.0-SNAPSHOT-hc.tar.gz +cp ${ARCHIVE} ${DIR} +ARCHIVE=${DIR}/vpp-integration-distribution-${VERSION}-SNAPSHOT-hc.tar.gz +tar -xf ${ARCHIVE} -C ${DIR}/ + +# Create packaging root +rm -rf ${PACKAGING_ROOT} +mkdir ${PACKAGING_ROOT} + +# Copy contents of tar.gz +mv ${DIR}/vpp-integration-distribution-${VERSION}-SNAPSHOT/ ${PACKAGING_ROOT}/ +cp -r ${DIR}/debian/ ${PACKAGING_ROOT} + +# Upstart configuration +cp ${DIR}/honeycomb.conf ${PACKAGING_ROOT} + +# Changelog file +cat <> ${PACKAGING_ROOT}/debian/changelog +honeycomb (${VERSION}-${RELEASE}) unstable; urgency=low + + * Initial release + + -- mmarsale Mon, 22 Aug 2016 09:41:37 +0200 +EOT + +# Install instructions +cat <> ${PACKAGING_ROOT}/debian/install +vpp-integration-distribution-${VERSION}-SNAPSHOT/* /opt/honeycomb/ +honeycomb.conf /etc/init/ +EOT + +# Build deb binary only package +cd ${PACKAGING_ROOT} +dpkg-buildpackage -b +cd - \ No newline at end of file diff --git a/packaging/deb/honeycomb.conf b/packaging/deb/honeycomb.conf new file mode 100644 index 000000000..e9c7fb932 --- /dev/null +++ b/packaging/deb/honeycomb.conf @@ -0,0 +1,8 @@ +description "honeycomb agent for VPP" +author "fd.io/honeycomb " + +manual + +script + exec /opt/honeycomb/honeycomb +end script \ No newline at end of file diff --git a/packaging/rpm/honeycomb.service b/packaging/rpm/honeycomb.service index 8a2a46864..1746681ef 100644 --- a/packaging/rpm/honeycomb.service +++ b/packaging/rpm/honeycomb.service @@ -5,7 +5,7 @@ After=vpp.service [Service] Type=forking -ExecStart=/opt/honeycomb/honeycomb +ExecStart=/opt/honeycomb/honeycomb-start [Install] WantedBy=multi-user.target diff --git a/packaging/rpm/rpmbuild.sh b/packaging/rpm/rpmbuild.sh index 2cbb20482..f9e9795fc 100755 --- a/packaging/rpm/rpmbuild.sh +++ b/packaging/rpm/rpmbuild.sh @@ -10,3 +10,4 @@ cp ${DIR}/honeycomb.spec ${DIR}/SOURCES/ cd ${DIR} rpmbuild -bb --define "_topdir ${DIR}" ${DIR}/honeycomb.spec cd - + -- cgit 1.2.3-korg