From 823d011fe368e9087e18f97e197c99af7fe6515b Mon Sep 17 00:00:00 2001 From: Farzad Ghanei <644113+farzadghanei@users.noreply.github.com> Date: Sat, 15 Jun 2024 16:26:25 +0200 Subject: [PATCH] feat(packaging): adding debian packaging files [wip] --- Makefile | 9 +++--- build/package/debian/changelog | 9 ++++++ build/package/debian/chkok.manpages | 1 + build/package/debian/control | 12 ++++++++ build/package/debian/copyright | 44 +++++++++++++++++++++++++++++ build/package/debian/rules | 9 ++++++ build/package/debian/source/format | 1 + build/package/pbuilderrc | 20 +++++++++++++ 8 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 build/package/debian/changelog create mode 100644 build/package/debian/chkok.manpages create mode 100644 build/package/debian/control create mode 100644 build/package/debian/copyright create mode 100755 build/package/debian/rules create mode 100644 build/package/debian/source/format create mode 100644 build/package/pbuilderrc diff --git a/Makefile b/Makefile index 861c315..ab1a6f4 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ TIMESTAMP_MINUTE := $(shell date -u +%Y%m%d%H%M) # build OS ?= linux ARCH ?= amd64 -DIST ?= bookworm +DIST ?= trixie # go 1.22 is available in trixie GOLDFLAGS ?= "-s" # by default create a leaner binary GOARCH ?= amd64 @@ -78,6 +78,8 @@ RPM_DEV_SPEC = $(RPM_DEV_TREE)/SPECS/chkok-$(CHKOK_RPM_VERSION).spec # command aliases cowbuilder = env DISTRIBUTION=$(DIST) ARCH=$(ARCH) BASEPATH=/var/cache/pbuilder/base-$(DIST)-$(ARCH).cow cowbuilder +# testing +TEST_SKIP_STATICCHECKS ?= chkok: GOOS=$(OS) GOARCH=$(GOARCH) go build -ldflags $(GOLDFLAGS) cmd/chkok.go @@ -88,7 +90,7 @@ build: chkok test: go test -v -race ./... - ./scripts/staticchecks + if test -z $(TEST_SKIP_STATICCHECKS); then ./scripts/staticchecks; fi install: build @@ -115,11 +117,10 @@ pkg-deb: git checkout -b $(DEB_BUILD_GIT_BRANCH) rm -f $(CHKOK_DEB_UPSTREAM_TARBAL); tar --exclude-backups --exclude-vcs -zcf $(CHKOK_DEB_UPSTREAM_TARBAL) . cp -r build/package/debian debian; git add debian; git commit -m 'add debian dir for packaging v$(CHKOK_DEB_VERSION)' - gbp buildpackage --git-ignore-new --git-verbose --git-pbuilder \ + gbp buildpackage --git-ignore-new --git-ignore-branch --git-verbose --git-pbuilder \ --git-no-create-orig --git-tarball-dir=$(CHKOK_DEB_UPSTREAM_TARBAL_PATH) \ --git-hooks \ --git-dist=$(DIST) --git-arch=$(ARCH) \ - --git-ignore-new --git-ignore-branch \ --git-pbuilder-options='--configfile=$(PBUILDER_RC) --hookdir=$(PBUILDER_HOOKS_DIR) --buildresult=$(PKG_DIST_DIR)' \ -b -us -uc -sa git checkout $(GIT_CURRENT_BRANCH) diff --git a/build/package/debian/changelog b/build/package/debian/changelog new file mode 100644 index 0000000..e847053 --- /dev/null +++ b/build/package/debian/changelog @@ -0,0 +1,9 @@ +chkok (0.3.0-1) UNRELEASED; urgency=low + + [ Farzad Ghanei ] + * Add support for required headers for http runner + * Add maxHeaderBytes configuration for http runner + + [ Farzad Ghanei ] + + -- Farzad Ghanei <644113+farzadghanei@users.noreply.github.com> Sat, 15 Jun 2024 16:18:03 +0100 diff --git a/build/package/debian/chkok.manpages b/build/package/debian/chkok.manpages new file mode 100644 index 0000000..97ce177 --- /dev/null +++ b/build/package/debian/chkok.manpages @@ -0,0 +1 @@ +docs/man/chkok.1 diff --git a/build/package/debian/control b/build/package/debian/control new file mode 100644 index 0000000..15cdca7 --- /dev/null +++ b/build/package/debian/control @@ -0,0 +1,12 @@ +Source: chkok +Maintainer: Farzad Ghanei <644113+farzadghanei@users.noreply.github.com> +Section: misc +Priority: optional +Standards-Version: 4.6.2 +Build-Depends: debhelper-compat (= 13), golang-go (>=1.22), git, ca-certificates + +Package: chkok +Architecture: amd64 +Description: checks attributes of files and sockets + "chkok" checks if attributes of files and sockets match the provided conditions to ensure + system state is as expected. \ No newline at end of file diff --git a/build/package/debian/copyright b/build/package/debian/copyright new file mode 100644 index 0000000..2e71f86 --- /dev/null +++ b/build/package/debian/copyright @@ -0,0 +1,44 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: chkok +Upstream-Contact: Farzad Ghanei +Source: https://github.com/farzadghanei/chkok + +Files: * +Copyright: 2024 Farzad Ghanei <644113+farzadghanei@users.noreply.github.com> +License: MIT + +Files: go-yaml/yaml* +Copyright: Copyright (c) 2006-2011 Kirill Simonov +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. + + + +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/build/package/debian/rules b/build/package/debian/rules new file mode 100755 index 0000000..74b0beb --- /dev/null +++ b/build/package/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f + +%: + dh $@ + + +override_dh_auto_test: + # skip staticchecks on package build + $(MAKE) test TEST_SKIP_STATICCHECKS=1 \ No newline at end of file diff --git a/build/package/debian/source/format b/build/package/debian/source/format new file mode 100644 index 0000000..46ebe02 --- /dev/null +++ b/build/package/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) \ No newline at end of file diff --git a/build/package/pbuilderrc b/build/package/pbuilderrc new file mode 100644 index 0000000..432e398 --- /dev/null +++ b/build/package/pbuilderrc @@ -0,0 +1,20 @@ +# configurations for pbuilder/cowbuilder +# can be set via ~/.pbuilderrc + +# by defualt don't sign the deb package +AUTO_DEBSIGN=${AUTO_DEBSIGN:-no} + +# configure where to place the built packages +BUILDRESULT=${PKG_DIST_DIR:-../} + +# apt repository components +COMPONENTS=${COMPONENTS:-"main universe"} + +# enable networking in pbuilder env so go can download package dependencies +USENETWORK=yes + +# set $HOME var to $BUILDDIR so commands that need $HOME env var would work +BUILD_HOME=$BUILDDIR + +# set debbuild opts so dpkg-buildpackage skips signing packages +DEBBUILDOPTS=${DEBBUILDOPTS:-"-us -uc -I -i"}