diff --git a/.dockerignore b/.dockerignore index 41db8dbc..9d68dd25 100644 --- a/.dockerignore +++ b/.dockerignore @@ -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/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17f28d64..8085c6e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/.gitignore b/.gitignore index 6b1b2081..673918cb 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/Makefile b/Makefile index 27ccdde1..5294db9a 100644 --- a/Makefile +++ b/Makefile @@ -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 " dch -v `make -s version` "CI build" ; \ + DEBEMAIL="CI " 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 diff --git a/debian/aptly-api.maintscript b/debian/aptly-api.maintscript new file mode 100644 index 00000000..dbc52ad4 --- /dev/null +++ b/debian/aptly-api.maintscript @@ -0,0 +1 @@ +mv_conffile /etc/aptly-api.conf /etc/aptly.conf 1.6~ diff --git a/debian/aptly-api.postinst b/debian/aptly-api.postinst old mode 100644 new mode 100755 index e930a02b..01edd3a1 --- a/debian/aptly-api.postinst +++ b/debian/aptly-api.postinst @@ -1,28 +1,13 @@ #!/bin/sh -# -# see: dh_installdeb(1) set -e -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# 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 diff --git a/debian/aptly-api.preinst b/debian/aptly-api.preinst deleted file mode 100644 index e2543af1..00000000 --- a/debian/aptly-api.preinst +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' -# 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 diff --git a/debian/aptly-api.service b/debian/aptly-api.service index 1d1c0c2e..5e447ace 100644 --- a/debian/aptly-api.service +++ b/debian/aptly-api.service @@ -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 diff --git a/debian/aptly.bash-completion b/debian/aptly.bash-completion new file mode 100644 index 00000000..af08cb0b --- /dev/null +++ b/debian/aptly.bash-completion @@ -0,0 +1 @@ +completion.d/aptly diff --git a/debian/aptly.install b/debian/aptly.install index 777b94c9..27a513c6 100644 --- a/debian/aptly.install +++ b/debian/aptly.install @@ -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 diff --git a/debian/aptly.manpages b/debian/aptly.manpages new file mode 100644 index 00000000..c261d746 --- /dev/null +++ b/debian/aptly.manpages @@ -0,0 +1 @@ +man/aptly.1 diff --git a/debian/changelog b/debian/changelog index 4702c6a8..47d58eb1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 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 Tue, 17 May 2022 22:42:29 +0200 - -aptly (1.4.0+ds1-6) unstable; urgency=medium - - * Conflict on gpgv1 (Closes: #990821) - - -- Sebastien Delafond Thu, 04 Nov 2021 10:24:53 +0100 - -aptly (1.4.0+ds1-5) unstable; urgency=medium - - * Conflict on gnupg1 (Closes: #990821) - - -- Sebastien Delafond 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 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 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 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 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 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 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 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 Sat, 16 Nov 2024 12:44:06 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index b4de3947..00000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/debian/control b/debian/control index 7e9dc545..cf1723e0 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,14 @@ Source: aptly -Section: devel +Section: utils Priority: optional -Maintainer: Debian Go Packaging Team -Uploaders: TODO -Build-Depends: debhelper (>= 11), +Maintainer: André Roth +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 diff --git a/debian/copyright b/debian/copyright index 53815267..cb7fed43 100644 --- a/debian/copyright +++ b/debian/copyright @@ -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 +Copyright: 2014 Andrey Smirnov , 2023 André Roth 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 diff --git a/debian/manpages b/debian/manpages new file mode 100644 index 00000000..6bde59c3 --- /dev/null +++ b/debian/manpages @@ -0,0 +1 @@ +src/github.com/aptly-dev/aptly/man/aptly.1 diff --git a/debian/rules b/debian/rules index 1b4dddd4..1f8bcddd 100755 --- a/debian/rules +++ b/debian/rules @@ -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 diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 00000000..0ae1d291 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,4 @@ +# This file is an addition to the autodep8 tests. + +Test-Command: HOME=/tmp aptly repo create autopkgtest +Restrictions: allow-stderr diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 00000000..7571c2d7 --- /dev/null +++ b/debian/upstream/metadata @@ -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 diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..2c6231d2 --- /dev/null +++ b/debian/watch @@ -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 diff --git a/system/Dockerfile b/system/Dockerfile index c57f27df..b2da26e3 100644 --- a/system/Dockerfile +++ b/system/Dockerfile @@ -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