From 7043d6794544e8a4c72fb2d140dc7f705639c04b Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 19 Aug 2022 17:02:18 +0200 Subject: [PATCH] Build debian packages using specification files instead of shell script. --- Makefile | 11 ++++++----- debian/.gitignore | 7 +++++++ debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 17 +++++++++++++++++ debian/copyright | 27 +++++++++++++++++++++++++++ debian/rules | 15 +++++++++++++++ debian/source/format | 1 + scripts/package_debian.sh | 34 ---------------------------------- 9 files changed, 79 insertions(+), 39 deletions(-) create mode 100644 debian/.gitignore create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format delete mode 100755 scripts/package_debian.sh diff --git a/Makefile b/Makefile index 52e4a36..9f5d047 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,12 @@ PROGRAM_NAME=eosio-api-healthcheck export GOOS = $(shell go env GOOS) export GOARCH = $(shell go env GOARCH) +DPKG_BUILDPACKAGE = dpkg-buildpackage +DPKG_BUILDPACKAGE_FLAGS = -us -uc + SOURCES=src/main.go src/server.go src/parse_request.go -.PHONY: all build/$(PROGRAM_NAME) clean +.PHONY: all build/$(PROGRAM_NAME) clean package_debian all: build build: build/$(PROGRAM_NAME) @@ -26,10 +29,8 @@ install: build package: PKGROOT=$(DESTDIR) BUILDDIR=$(realpath build) scripts/package.sh $(PKGTYPE) -package_debian: PKGTYPE = debian -package_debian: GOOS = linux -package_debian: DESTDIR = build/debroot -package_debian: install package +package_debian: + $(DPKG_BUILDPACKAGE) $(DPKG_BUILDPACKAGE_FLAGS) package_freebsd: PKGTYPE = freebsd package_freebsd: GOOS = freebsd diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000..ae756e1 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,7 @@ +.debhelper/* +*.debhelper +*.log +*-stamp +*.substvars +files +pkgroot/* diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..4533f5e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +eosio-api-healthcheck (1.2.3) unstable; urgency=medium + + * + + -- Henrik Hautakoski Fri, 19 Aug 2022 16:29:56 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..ab2df75 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: eosio-api-healthcheck +Section: introspection +Build-Depends: + debhelper (>= 11) +Standards-Version: 4.0.0 +Vcs-Git: https://github.com/eosswedenorg/eos-api-healthcheck.git +Vcs-Browser: https://github.com/eosswedenorg/eos-api-healthcheck +Priority: optional +Maintainer: Henrik Hautakoski + +Package: eosio-api-healthcheck +Section: introspection +Priority: optional +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Homepage: https://github.com/eosswedenorg/eos-api-healthcheck +Description: HAproxy healthcheck program for EOSIO API. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..541e2ad --- /dev/null +++ b/debian/copyright @@ -0,0 +1,27 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: eosio-api-healthcheck +Upstream-Contact: Henrik Hautakoski +Source: https://github.com/eosswedenorg/eos-api-healthcheck.git + +Files: * +Copyright: 2020-2022 Sw/eden +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..66b28b5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/default.mk + +INSTALL_FLAGS := GOOS=linux + +%: + dh $@ -P debian/pkgroot + +override_dh_auto_build: +override_dh_auto_install: + dh_auto_install --buildsystem=makefile -- $(INSTALL_FLAGS) + +override_dh_usrlocal: +override_dh_gconf: diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/scripts/package_debian.sh b/scripts/package_debian.sh deleted file mode 100755 index 1a7e9df..0000000 --- a/scripts/package_debian.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [[ -f /etc/upstream-release/lsb-release ]]; then - source /etc/upstream-release/lsb-release -elif [[ -f /etc/lsb-release ]]; then - source /etc/lsb-release -else - echo "ERROR: could not determine debian release." - exit 1 -fi - -DISTRIB_ID=$(echo $DISTRIB_ID | tr '[:upper:]' '[:lower:]') - -# Default to 1 if no release is set. -if [[ -z $RELEASE ]]; then - RELEASE="1" -fi - -PACKAGE_FULLNAME="${PROGRAM_NAME}_${PROGRAM_VERSION}-${RELEASE}-${DISTRIB_ID}-${DISTRIB_RELEASE}_amd64" - -# Create debian files. -mkdir -p ${PKGROOT}/DEBIAN -echo "Package: ${PROGRAM_NAME} -Version: ${PROGRAM_VERSION}-${RELEASE} -Section: introspection -Priority: optional -Architecture: amd64 -Homepage: https://github.com/eosswedenorg/eos-api-healthcheck -Maintainer: Henrik Hautakoski -Description: ${PROGRAM_DESCRIPTION}" &> ${PKGROOT}/DEBIAN/control - -cat ${PKGROOT}/DEBIAN/control - -fakeroot dpkg-deb --build ${PKGROOT} ${BUILDDIR}/${PACKAGE_FULLNAME}.deb