Skip to content

Commit

Permalink
feat(packaging): adding debian packaging files [wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
farzadghanei committed Jun 16, 2024
1 parent 701fb83 commit 823d011
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions build/package/debian/changelog
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions build/package/debian/chkok.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/man/chkok.1
12 changes: 12 additions & 0 deletions build/package/debian/control
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 44 additions & 0 deletions build/package/debian/copyright
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions build/package/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/make -f

%:
dh $@


override_dh_auto_test:
# skip staticchecks on package build
$(MAKE) test TEST_SKIP_STATICCHECKS=1
1 change: 1 addition & 0 deletions build/package/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
20 changes: 20 additions & 0 deletions build/package/pbuilderrc
Original file line number Diff line number Diff line change
@@ -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"}

0 comments on commit 823d011

Please sign in to comment.