Merge pull request #1393 from aptly-dev/improve/debianization

Improve/debianization
This commit is contained in:
André Roth
2024-11-17 17:38:47 +01:00
committed by GitHub
21 changed files with 132 additions and 226 deletions

View File

@@ -1,6 +1,10 @@
.go/
.git/
obj-x86_64-linux-gnu/
obj-aarch64-linux-gnu/
obj-arm-linux-gnueabihf/
obj-i686-linux-gnu/
unit.out
aptly.test
build/
dpkgs/

View File

@@ -142,7 +142,10 @@ jobs:
- name: "Install packages"
run: |
apt-get update
apt-get install -y --no-install-recommends make ca-certificates git curl build-essential devscripts dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf jq
apt-get install -y --no-install-recommends make ca-certificates git curl build-essential devscripts dh-golang jq bash-completion lintian \
binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf \
libc6-dev-i386-cross libc6-dev-armhf-cross libc6-dev-arm64-cross \
gcc-i686-linux-gnu gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: "Checkout repository"

13
.gitignore vendored
View File

@@ -50,21 +50,24 @@ system/files/aptly2_passphrase.gpg~
.go/
obj-x86_64-linux-gnu/
obj-aarch64-linux-gnu/
obj-arm-linux-gnueabihf/
obj-i686-linux-gnu/
# debian
debian/.debhelper/
debian/aptly.debhelper.log
debian/aptly.postrm.debhelper
debian/aptly.substvars
debian/aptly/
debian/debhelper-build-stamp
debian/files
debian/aptly-api/
debian/aptly-api.debhelper.log
debian/aptly-api.postrm.debhelper
debian/*.debhelper
debian/*.debhelper.log
debian/aptly-api.substvars
debian/aptly-dbg.debhelper.log
debian/aptly-dbg.substvars
debian/aptly-dbg/
usr/bin/aptly
dpkgs/
debian/changelog.dpkg-bak
docs/

View File

@@ -107,18 +107,24 @@ dpkg: prepare swagger ## Build debian packages
# set debian version
@if [ "`make -s releasetype`" = "ci" ]; then \
echo CI Build, setting version... ; \
test ! -f debian/changelog.dpkg-bak || mv debian/changelog.dpkg-bak debian/changelog ; \
cp debian/changelog debian/changelog.dpkg-bak ; \
DEBEMAIL="CI <ci@aptly>" dch -v `make -s version` "CI build" ; \
DEBEMAIL="CI <ci@aptly.info>" dch -v `make -s version` "CI build" ; \
fi
# clean
rm -rf obj-i686-linux-gnu obj-arm-linux-gnueabihf obj-aarch64-linux-gnu obj-x86_64-linux-gnu
# Run dpkg-buildpackage
buildtype="any" ; \
@buildtype="any" ; \
if [ "$(DEBARCH)" = "amd64" ]; then \
buildtype="any,all" ; \
fi ; \
echo "\e[33m\e[1mBuilding: $$buildtype\e[0m" ; \
dpkg-buildpackage -us -uc --build=$$buildtype -d --host-arch=$(DEBARCH)
cmd="dpkg-buildpackage -us -uc --build=$$buildtype -d --host-arch=$(DEBARCH)" ; \
echo "$$cmd" ; \
$$cmd
lintian ../*_$(DEBARCH).changes || true
# cleanup
@test -f debian/changelog.dpkg-bak && mv debian/changelog.dpkg-bak debian/changelog || true ; \
@test ! -f debian/changelog.dpkg-bak || mv debian/changelog.dpkg-bak debian/changelog; \
mkdir -p build && mv ../*.deb build/ ; \
cd build && ls -l *.deb
@@ -148,7 +154,7 @@ docker-build: ## Build aptly in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper build
docker-shell: ## Run aptly and other commands in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper || true
@docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper || true
docker-deb: ## Build debian packages in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper dpkg DEBARCH=amd64

1
debian/aptly-api.maintscript vendored Normal file
View File

@@ -0,0 +1 @@
mv_conffile /etc/aptly-api.conf /etc/aptly.conf 1.6~

48
debian/aptly-api.postinst vendored Normal file → Executable file
View File

@@ -1,28 +1,13 @@
#!/bin/sh
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# source debconf library
. /usr/share/debconf/confmodule
case "$1" in
configure)
# create an aptly group and user
configure|reconfigure)
# create an aptly-api group and user
if ! getent passwd aptly-api > /dev/null; then
useradd --system --user-group --create-home --home-dir /var/lib/aptly-api aptly-api
fi
@@ -30,32 +15,17 @@ case "$1" in
# set config file permissions not world readable as it may contain secrets
chown root:aptly-api /etc/aptly.conf
chmod 640 /etc/aptly.conf
;;
if [ -f /etc/aptly-api.conf.migrate ]; then
rootDir=`grep rootDir /etc/aptly-api.conf.migrate | sed 's_/var/lib/aptly-api_~_' | sed -n 's/.\+: "\([^"]\+\)".*/\1/p'`
if [ -n "$rootDir" ]; then
sed -i 's/\(.*"rootDir": "\)[^"]*\(".*\)/\1'$rootDir'\2/' /etc/aptly.conf
fi
echo "backing up /etc/aptly-api.conf to /etc/aptly-api.conf.old..."
mv /etc/aptly-api.conf.migrate /etc/aptly-api.conf.old
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
db_stop
exit 0

View File

@@ -1,38 +0,0 @@
#!/bin/sh
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
if [ -f /etc/aptly-api.conf ]; then
echo "migrating /etc/aptly-api.conf ..."
mv /etc/aptly-api.conf /etc/aptly-api.conf.migrate
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@@ -9,7 +9,7 @@ Group=aptly-api
Environment=TERM=dumb
WorkingDirectory=~
EnvironmentFile=/etc/default/aptly-api
ExecStart=/usr/bin/aptly api serve -config=/etc/aptly.conf -listen=${LISTEN_ADDRESS}
ExecStart=/usr/bin/aptly api serve -config=/etc/aptly.conf -no-lock -listen=${LISTEN_ADDRESS}
[Install]
WantedBy=multi-user.target

1
debian/aptly.bash-completion vendored Normal file
View File

@@ -0,0 +1 @@
completion.d/aptly

View File

@@ -1,6 +1,2 @@
build/aptly usr/bin/
README.rst usr/share/aptly/
LICENSE usr/share/aptly/
AUTHORS usr/share/aptly/
completion.d/_aptly usr/share/zsh/vendor-completions/
completion.d/aptly usr/share/bash-completion/completions/
usr/bin/aptly
completion.d/_aptly usr/share/zsh/vendor-completions

1
debian/aptly.manpages vendored Normal file
View File

@@ -0,0 +1 @@
man/aptly.1

93
debian/changelog vendored
View File

@@ -1,92 +1,5 @@
aptly (1.6.0~beta1) stable; urgency=medium
aptly (1.6.0~rc1) stable; urgency=medium
* upstream aptly debianization
* release candidate
-- André Roth <neolynx@gmail.com> Tue, 17 Sep 2024 16:47:44 +0200
aptly (1.5.0+ds1-1) unstable; urgency=medium
* Team upload.
* New upstream release (Closes: #1022721), including fix for "Order of
fields in Packages/Sources is unpredictable" (Closes: #907121).
-- Roland Mas <lolando@debian.org> Tue, 31 Jan 2023 14:47:04 +0100
aptly (1.4.0+ds1-7) unstable; urgency=medium
* Team upload.
* Add support for zstd compression (Closes: #1010465)
-- Anton Gladky <gladk@debian.org> Tue, 17 May 2022 22:42:29 +0200
aptly (1.4.0+ds1-6) unstable; urgency=medium
* Conflict on gpgv1 (Closes: #990821)
-- Sebastien Delafond <seb@debian.org> Thu, 04 Nov 2021 10:24:53 +0100
aptly (1.4.0+ds1-5) unstable; urgency=medium
* Conflict on gnupg1 (Closes: #990821)
-- Sebastien Delafond <seb@debian.org> Thu, 14 Oct 2021 18:43:04 +0200
aptly (1.4.0+ds1-4) unstable; urgency=medium
* Install correct bash completion snippet (Closes: #984979)
-- Sebastien Delafond <seb@debian.org> Thu, 11 Mar 2021 15:20:57 +0100
aptly (1.4.0+ds1-3) unstable; urgency=medium
* Fix s3 etag issue (Closes: #983877)
* Bump-up d/watch version
* Bump-up Standards-Version
-- Sebastien Delafond <seb@debian.org> Wed, 03 Mar 2021 10:50:51 +0100
aptly (1.4.0+ds1-2) unstable; urgency=medium
* Use pipeline from salsa-ci-team
* Allow reprotest failure
* Pass version from d/rules (Closes: #968585)
-- Sebastien Delafond <seb@debian.org> Fri, 21 Aug 2020 10:13:44 +0200
aptly (1.4.0+ds1-1) unstable; urgency=medium
* New upstream version 1.4.0+ds1
* Rediff patches
* Depend on gnupg 2
-- Sebastien Delafond <seb@debian.org> Sun, 22 Dec 2019 15:16:25 +0100
aptly (1.3.0+ds1-4) unstable; urgency=medium
[ Debian Janitor ]
* Rename obsolete path debian/tests/control.autodep8 to debian/tests/control.
* Use secure URI in Homepage field.
* Bump debhelper from old 11 to 12.
* Set debhelper-compat version in Build-Depends.
[ Sébastien Delafond ]
* Bump up Standards-Version
-- Sebastien Delafond <seb@debian.org> Sun, 22 Dec 2019 14:10:19 +0100
aptly (1.3.0+ds1-3) unstable; urgency=medium
* Build-Depend on golang-golang-x-tools-dev instead of golang-go.tools (Closes: #945884)
* Lintian fix
-- Sebastien Delafond <seb@debian.org> Sat, 21 Dec 2019 10:29:09 +0100
aptly (1.3.0+ds1-2.3) unstable; urgency=medium
* Non-maintainer upload.
* Remove myself from uploaders.
-- Alexandre Viau <aviau@debian.org> Sun, 15 Sep 2019 19:27:47 -0400
# Older entries have been removed from this changelog.
# To read the complete changelog use `apt changelog aptly`.
-- André Roth <neolynx@gmail.com> Sat, 16 Nov 2024 12:44:06 +0100

1
debian/compat vendored
View File

@@ -1 +0,0 @@
11

64
debian/control vendored
View File

@@ -1,14 +1,14 @@
Source: aptly
Section: devel
Section: utils
Priority: optional
Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org>
Uploaders: TODO <admin@lepton.exnihilo>
Build-Depends: debhelper (>= 11),
Maintainer: André Roth <neolynx@gmail.com>
Build-Depends: bash-completion,
debhelper-compat (= 13),
dh-golang,
golang-go,
golang-github-aleksi-pointer-dev,
golang-github-awalterschulze-gographviz-dev,
golang-github-aws-aws-sdk-go-v2-dev,
golang-github-aws-aws-sdk-go-v2-dev (>= 1.24.1),
golang-github-aws-smithy-go-dev,
golang-github-azure-azure-pipeline-go-dev,
golang-github-azure-azure-storage-blob-go-dev,
@@ -54,7 +54,7 @@ Build-Depends: debhelper (>= 11),
golang-github-prometheus-procfs-dev,
golang-github-protonmail-go-crypto-dev,
golang-github-rivo-uniseg-dev,
golang-github-rs-zerolog-dev,
golang-github-rs-zerolog-dev (>= 1.29.1),
golang-github-saracen-walker-dev,
golang-github-smira-commander-dev,
golang-github-smira-flag-dev,
@@ -78,19 +78,51 @@ Build-Depends: debhelper (>= 11),
golang-go.uber-zap-dev,
golang-etcd-server-dev (>= 3.5.15-7),
git
Standards-Version: 4.2.1
Homepage: https://github.com/aptly-dev/aptly
Vcs-Browser: https://salsa.debian.org/go-team/packages/aptly
Vcs-Git: https://salsa.debian.org/go-team/packages/aptly.git
Standards-Version: 4.7.0
Homepage: https://www.aptly.info
Vcs-Git: https://github.com/aptly-dev/aptly.git
Vcs-Browser: https://github.com/aptly-dev/aptly
XS-Go-Import-Path: github.com/aptly-dev/aptly
Testsuite: autopkgtest-pkg-go
Package: aptly
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}, bzip2, xz-utils, adduser, gpg (>= 2.2.12)
Depends: ${misc:Depends}, ${shlibs:Depends}, bzip2, xz-utils, gpgv, gpg
Suggests: graphviz
Conflicts: gnupg1, gpgv1
Built-Using: ${misc:Static-Built-Using}, ${misc:Built-Using}
Description: Debian repository management tool
aptly is a Swiss army knife for Debian repository management.
Description: Swiss army knife for Debian repository management - main package
It offers several features making it easy to manage Debian package
repositories:
.
- make mirrors of remote Debian/Ubuntu repositories, limiting by
components/architectures
- take snapshots of mirrors at any point in time, fixing state of
repository at some moment of time
- publish snapshot as Debian repository, ready to be consumed by apt
- controlled update of one or more packages in snapshot from upstream
mirror, tracking dependencies
- merge two or more snapshots into one
.
This is the main package, it contains the aptly command-line utility.
Package: aptly-api
Architecture: any
Depends: ${misc:Depends}, aptly
Description: Swiss army knife for Debian repository management - API
It offers several features making it easy to manage Debian package
repositories:
.
- make mirrors of remote Debian/Ubuntu repositories, limiting by
components/architectures
- take snapshots of mirrors at any point in time, fixing state of
repository at some moment of time
- publish snapshot as Debian repository, ready to be consumed by apt
- controlled update of one or more packages in snapshot from upstream
mirror, tracking dependencies
- merge two or more snapshots into one
.
This package contains the aptly-api service.
Package: aptly-dbg
Architecture: any
@@ -98,9 +130,3 @@ Depends: ${misc:Depends}
Built-Using: ${misc:Static-Built-Using}, ${misc:Built-Using}
Description: Debian repository management tool (debug files)
Debug symbols for aptly
Package: aptly-api
Architecture: all
Depends: ${misc:Depends}, aptly
Description: Debian repository management tool (REST API server)
systemd service and configuration for aptly

3
debian/copyright vendored
View File

@@ -1,10 +1,9 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: aptly
Source: http://www.aptly.info
Files-Excluded: vendor/*
Files: *
Copyright: 2014 Andrey Smirnov <me@smira.ru>
Copyright: 2014 Andrey Smirnov <me@smira.ru>, 2023 André Roth <neolynx@gmail.com>
License: Expat
Comment: Some of aptly's vendored dependencies are already in Debian, and
Alexandre Viau is well on his way to packaging the rest of them so that

1
debian/manpages vendored Normal file
View File

@@ -0,0 +1 @@
src/github.com/aptly-dev/aptly/man/aptly.1

41
debian/rules vendored
View File

@@ -6,38 +6,43 @@ export GOPATH=$(shell pwd)/.go
export DEB_BUILD_OPTIONS=crossbuildcanrunhostbinaries
export GOARCH := $(shell if [ $(DEB_TARGET_ARCH) = "i386" ]; then echo "386"; elif [ $(DEB_TARGET_ARCH) = "armhf" ]; then echo "arm"; else echo $(DEB_TARGET_ARCH); fi)
export CGO_ENABLED=1
ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE))
export CC=$(DEB_HOST_GNU_TYPE)-gcc
endif
%:
dh $@ --buildsystem=golang --with=golang
dh $@ --buildsystem=golang --with=golang,bash-completion
override_dh_auto_clean:
rm -rf build/
rm -rf obj-$(DEB_TARGET_GNU_TYPE)/
dh_auto_clean
override_dh_auto_build:
echo $(DEB_VERSION) > VERSION
go build -o build/aptly
# when dependencies fully debianized:
# echo $(DEB_VERSION) > obj-$(DEB_TARGET_GNU_TYPE)/src/github.com/aptly-dev/aptly/VERSION
# dh_auto_build
override_dh_auto_test:
# run during autopkgtests
override_dh_auto_install:
dh_auto_install -- --no-source
mkdir -p build
test -f debian/tmp/usr/bin/aptly && mv debian/tmp/usr/bin/aptly build/ || true
mkdir -p debian/aptly/usr/share/man/man1/
cp man/aptly.1 debian/aptly/usr/share/man/man1
gzip debian/aptly/usr/share/man/man1/aptly.1
override_dh_strip:
dh_strip --dbg-package=aptly-dbg
# only with full debian dependencies:
override_dh_golang:
override_dh_golang: # fails on non native debian build
# not needed with golang, fails with cross compiling
# override_dh_makeshlibs:
# override_dh_makeshlibs: # fails with cross compiling on non native debian build
override_dh_dwz: # somehow dwz works only with certain newer debhelper versions
dhver=`dpkg-query -f '$${Version}' -W debhelper`; (dpkg --compare-versions "$$dhver" lt 13 || test "$$dhver" = "13.3.4" || test "$$dhver" = "13.6ubuntu1") || dh_dwz
override_dh_shlibdeps:
ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE))
LD_LIBRARY_PATH=/usr/$(DEB_HOST_GNU_TYPE)/lib:$$LD_LIBRARY_PATH dh_shlibdeps
else
dh_shlibdeps
endif
override_dh_auto_build:
echo $(DEB_VERSION) > VERSION
go build -buildmode=pie -o usr/bin/aptly

4
debian/tests/control vendored Normal file
View File

@@ -0,0 +1,4 @@
# This file is an addition to the autodep8 tests.
Test-Command: HOME=/tmp aptly repo create autopkgtest
Restrictions: allow-stderr

5
debian/upstream/metadata vendored Normal file
View File

@@ -0,0 +1,5 @@
---
Bug-Database: https://github.com/aptly-dev/aptly/issues
Bug-Submit: https://github.com/aptly-dev/aptly/issues/new
Repository: https://github.com/aptly-dev/aptly.git
Repository-Browse: https://github.com/aptly-dev/aptly

5
debian/watch vendored Normal file
View File

@@ -0,0 +1,5 @@
version=4
opts=\
repacksuffix=+ds1,\
dversionmangle=s/\+ds\d*$// \
https://github.com/aptly-dev/aptly/tags .*/v(\d[\d\.]*)\.tar\.gz debian uupdate

View File

@@ -6,7 +6,9 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg b
golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports \
make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage \
g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev && \
binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev lintian \
libc6-dev-i386-cross libc6-dev-armhf-cross libc6-dev-arm64-cross \
gcc-i686-linux-gnu gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN useradd -m --shell /bin/bash --home-dir /var/lib/aptly aptly