From f7f220aa18840545541ebb8de917cc4ad42644f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sun, 21 Apr 2024 21:51:42 +0200 Subject: [PATCH] debianize - fix make version on debian - update gitignore - add aptly-api and service - install zsh completion - add debug package - move aptly data from orig deb package - do not add shell for service user - use 8080 as default port --- .gitignore | 18 ++ Makefile | 13 +- aptly-api.service | 12 - aptly.service | 12 - debian/aptly-api.default | 2 + debian/aptly-api.postinst | 52 ++++ debian/aptly-api.preinst | 40 +++ debian/aptly-api.service | 15 + debian/aptly.bash-completion | 576 +++++++++++++++++++++++++++++++++++ debian/aptly.conf | 33 ++ debian/aptly.install | 6 + debian/changelog | 92 ++++++ debian/compat | 1 + debian/control | 69 +++++ debian/copyright | 54 ++++ debian/rules | 42 +++ debian/source/format | 1 + upload-artifacts.sh | 1 + 18 files changed, 1012 insertions(+), 27 deletions(-) delete mode 100644 aptly-api.service delete mode 100644 aptly.service create mode 100644 debian/aptly-api.default create mode 100644 debian/aptly-api.postinst create mode 100644 debian/aptly-api.preinst create mode 100644 debian/aptly-api.service create mode 100644 debian/aptly.bash-completion create mode 100644 debian/aptly.conf create mode 100644 debian/aptly.install 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 diff --git a/.gitignore b/.gitignore index c0ef9eae..55fc4590 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,21 @@ pgp/keyrings/.#* *.creds .go/ +obj-x86_64-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/aptly-api.substvars +debian/aptly-dbg.debhelper.log +debian/aptly-dbg.substvars +debian/aptly-dbg/ + diff --git a/Makefile b/Makefile index 818deabb..3a3f3b0b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ GOVERSION=$(shell go version | awk '{print $$3;}') GOPATH=$(shell go env GOPATH) -TAG="$(shell git describe --tags --always)" -VERSION=$(shell echo $(TAG) | sed 's@^v@@' | sed 's@-@+@g' | tr -d '\n') +VERSION=$(shell make version) PACKAGES=context database deb files gpg http query swift s3 utils PYTHON?=python3 TESTS?= @@ -105,7 +104,15 @@ man: ## Create man pages make -C man version: ## Print aptly version - @echo $(VERSION) + @if which dpkg-parsechangelog > /dev/null 2>&1; then \ + if git describe --exact-match --tags HEAD >/dev/null 2>&1; then \ + dpkg-parsechangelog -S Version; \ + else \ + echo `dpkg-parsechangelog -S Version`+`git describe --tags | cut -d - -f2- | sed s/-/+/g`; \ + fi \ + else \ + git describe --tags --always | sed 's@^v@@' | sed 's@-@+@g'; \ + fi build: ## Build aptly go mod tidy diff --git a/aptly-api.service b/aptly-api.service deleted file mode 100644 index 40fe7879..00000000 --- a/aptly-api.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=APT repository API -After=network.target -Documentation=man:aptly(1) -Documentation=https://www.aptly.info/doc/api/ - -[Service] -Type=simple -ExecStart=/usr/bin/aptly api serve -no-lock -listen=127.0.0.1:8081 - -[Install] -WantedBy=multi-user.target diff --git a/aptly.service b/aptly.service deleted file mode 100644 index a22e56ca..00000000 --- a/aptly.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=APT repository server -After=network.target -Documentation=man:aptly(1) -Documentation=https://www.aptly.info/doc/commands/ - -[Service] -Type=simple -ExecStart=/usr/bin/aptly serve -listen=127.0.0.1:8080 - -[Install] -WantedBy=multi-user.target diff --git a/debian/aptly-api.default b/debian/aptly-api.default new file mode 100644 index 00000000..a407ec52 --- /dev/null +++ b/debian/aptly-api.default @@ -0,0 +1,2 @@ +# Default settings for aptly-api +LISTEN_ADDRESS='localhost:8080' diff --git a/debian/aptly-api.postinst b/debian/aptly-api.postinst new file mode 100644 index 00000000..79305ab0 --- /dev/null +++ b/debian/aptly-api.postinst @@ -0,0 +1,52 @@ +#!/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 + if ! getent passwd aptly-api > /dev/null; then + useradd --system --user-group --create-home --home-dir /var/lib/aptly-api aptly-api + fi + + # set config file permissions not world readable as it may contain secrets + chown root:aptly-api /etc/aptly.conf + chmod 640 /etc/aptly.conf + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + 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 new file mode 100644 index 00000000..f43e3ebe --- /dev/null +++ b/debian/aptly-api.preinst @@ -0,0 +1,40 @@ +#!/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 to /etc/aptly.conf ..." + cp /etc/aptly-api.conf /etc/aptly.conf + mv /etc/aptly-api.conf /etc/aptly-api.conf.old + sed -i 's_/var/lib/aptly-api_~/.aptly_' /etc/aptly.conf + 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 new file mode 100644 index 00000000..1d1c0c2e --- /dev/null +++ b/debian/aptly-api.service @@ -0,0 +1,15 @@ +[Unit] +Description=Aptly REST API +After=network.target +Documentation=man:aptly(1) + +[Service] +User=aptly-api +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} + +[Install] +WantedBy=multi-user.target diff --git a/debian/aptly.bash-completion b/debian/aptly.bash-completion new file mode 100644 index 00000000..9cfd752f --- /dev/null +++ b/debian/aptly.bash-completion @@ -0,0 +1,576 @@ +#!/bin/bash + +# (The MIT License) +# +# Copyright (c) 2014 Andrey Smirnov +# +# 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. + +__aptly_mirror_list() +{ + aptly mirror list -raw +} + +__aptly_repo_list() +{ + aptly repo list -raw +} + +__aptly_snapshot_list() +{ + aptly snapshot list -raw +} + +__aptly_published_distributions() +{ + aptly publish list -raw | cut -d ' ' -f 2 | sort | uniq +} + +__aptly_published_prefixes() +{ + aptly publish list -raw | cut -d ' ' -f 1 | sort | uniq +} + +__aptly_prefixes_for_distribution() +{ + aptly publish list -raw | awk -v dist="$1" '{ if (dist == $2) print $1 }' | sort | uniq +} + +_aptly() +{ + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + commands="api config db graph mirror package publish repo serve snapshot task version" + options="-architectures= -config= -dep-follow-all-variants -dep-follow-recommends -dep-follow-source -dep-follow-suggests" + + db_subcommands="cleanup recover" + mirror_subcommands="create drop show list rename search update" + publish_subcommands="drop list repo snapshot switch update" + snapshot_subcommands="create diff drop filter list merge pull rename search show verify" + repo_subcommands="add copy create drop edit import list move remove rename search show" + package_subcommands="search show" + task_subcommands="run" + config_subcommands="show" + api_subcommands="serve" + + local cmd subcmd numargs numoptions i + + numargs=0 + numoptions=0 + + for (( i=1; i < $COMP_CWORD; i++ )); do + if [[ -n "$cmd" ]]; then + if [[ ! -n "$subcmd" ]]; then + subcmd=${COMP_WORDS[i]} + numargs=$(( COMP_CWORD - i - 1 )) + else + if [[ "${COMP_WORDS[i]}" == -* ]]; then + numoptions=$(( numoptions + 1 )) + numargs=$(( numargs - 1 )) + fi + fi + else + if [[ ! "${COMP_WORDS[i]}" == -* ]]; then + cmd=${COMP_WORDS[i]} + fi + fi + done + + if [[ ! -n "$cmd" ]]; + then + case "$cur" in + -*) + COMPREPLY=($(compgen -W "${options}" -- ${cur})) + return 0 + ;; + *) + COMPREPLY=($(compgen -W "${commands}" -- ${cur})) + return 0 + ;; + esac + fi + + if [[ ! -n "$subcmd" ]]; + then + case "$prev" in + "db") + COMPREPLY=($(compgen -W "${db_subcommands}" -- ${cur})) + return 0 + ;; + "mirror") + COMPREPLY=($(compgen -W "${mirror_subcommands}" -- ${cur})) + return 0 + ;; + "repo") + COMPREPLY=($(compgen -W "${repo_subcommands}" -- ${cur})) + return 0 + ;; + "snapshot") + COMPREPLY=($(compgen -W "${snapshot_subcommands}" -- ${cur})) + return 0 + ;; + "publish") + COMPREPLY=($(compgen -W "${publish_subcommands}" -- ${cur})) + return 0 + ;; + "package") + COMPREPLY=($(compgen -W "${package_subcommands}" -- ${cur})) + return 0 + ;; + "task") + COMPREPLY=($(compgen -W "${task_subcommands}" -- ${cur})) + return 0 + ;; + "config") + COMPREPLY=($(compgen -W "${config_subcommands}" -- ${cur})) + return 0 + ;; + "api") + COMPREPLY=($(compgen -W "${api_subcommands}" -- ${cur})) + return 0 + ;; + *) + ;; + esac + fi + + case "$cmd" in + "mirror") + case "$subcmd" in + "create") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-filter= -filter-with-deps -force-components -ignore-signatures -keyring= -with-sources -with-udebs" -- ${cur})) + return 0 + fi + fi + ;; + "edit") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-filter= -filter-with-deps -with-sources -with-udebs" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + fi + return 0 + fi + ;; + "show") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-packages" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + fi + return 0 + fi + ;; + "search") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-deps" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + fi + return 0 + fi + ;; + "rename") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + return 0 + fi + ;; + "drop") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-force" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + fi + return 0 + fi + ;; + "list") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "-raw" -- ${cur})) + return 0 + fi + ;; + "update") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-force -download-limit= -ignore-checksums -ignore-signatures -keyring=" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + fi + return 0 + fi + ;; + esac + ;; + "repo") + case "$subcmd" in + "add") + case $numargs in + 0) + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-force-replace -remove-files" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + ;; + 1) + local files=$(find . -mindepth 1 -maxdepth 1 \( -type d -or -name \*.deb -or -name \*.dsc \) -exec basename {} \;) + COMPREPLY=($(compgen -W "${files}" -- ${cur})) + return 0 + ;; + esac + ;; + "copy"|"move") + case $numargs in + 0) + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-deps -dry-run" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + ;; + 1) + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + return 0 + ;; + esac + ;; + "create") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-comment= -distribution= -component=" -- ${cur})) + return 0 + fi + fi + ;; + "drop") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-force" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + fi + ;; + "edit") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-comment= -distribution= -component=" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + fi + ;; + "search") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-deps" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + fi + ;; + "list") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "-raw" -- ${cur})) + return 0 + fi + ;; + "import") + case $numargs in + 0) + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-deps -dry-run" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + fi + return 0 + ;; + 1) + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + return 0 + ;; + esac + ;; + "remove") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-dry-run" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + fi + ;; + "show") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-packages" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + return 0 + fi + ;; + "rename") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + return 0 + fi + ;; + esac + ;; + "snapshot") + case "$subcmd" in + "create") + case $numargs in + 1) + COMPREPLY=($(compgen -W "from empty" -- ${cur})) + return 0 + ;; + 2) + if [[ "$prev" == "from" ]]; then + COMPREPLY=($(compgen -W "mirror repo" -- ${cur})) + return 0 + fi + ;; + 3) + if [[ "$prev" == "mirror" ]]; then + COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur})) + return 0 + fi + if [[ "$prev" == "repo" ]]; then + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + return 0 + fi + ;; + esac + ;; + "diff") + if [[ $numargs -eq 0 ]] && [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-only-matching" -- ${cur})) + return 0 + fi + + if [[ $numargs -lt 2 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + return 0 + fi + ;; + "drop") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-force" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + fi + return 0 + fi + ;; + "list") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "-raw -sort=" -- ${cur})) + return 0 + fi + ;; + "merge") + if [[ $numargs -gt 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-latest" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + fi + return 0 + fi + ;; + "pull") + if [[ $numargs -eq 0 ]] && [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-all-matches -dry-run -no-deps -no-remove" -- ${cur})) + return 0 + fi + + if [[ $numargs -lt 2 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + return 0 + fi + ;; + "filter") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-deps" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + fi + return 0 + fi + ;; + "show") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-packages" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + fi + return 0 + fi + ;; + "search") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-deps" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + fi + return 0 + fi + ;; + "rename") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + return 0 + fi + ;; + "verify") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + return 0 + fi + ;; + esac + ;; + "publish") + case "$subcmd" in + "snapshot"|"repo") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-batch -force-overwrite -distribution= -component= -gpg-key= -keyring= -label= -origin= -passphrase= -passphrase-file= -secret-keyring= -skip-signing" -- ${cur})) + else + if [[ "$subcmd" == "snapshot" ]]; then + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_repo_list)" -- ${cur})) + fi + fi + return 0 + fi + + if [[ $numargs -eq 1 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_published_prefixes)" -- ${cur})) + return 0 + fi + ;; + "list") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "-raw" -- ${cur})) + return 0 + fi + ;; + "update") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-batch -force-overwrite -gpg-key= -keyring= -passphrase= -passphrase-file= -secret-keyring= -skip-signing" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_published_distributions)" -- ${cur})) + fi + return 0 + fi + + if [[ $numargs -eq 1 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_prefixes_for_distribution $prev)" -- ${cur})) + return 0 + fi + ;; + "switch") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-batch -force-overwrite -component= -gpg-key= -keyring= -passphrase= -passphrase-file= -secret-keyring= -skip-signing" -- ${cur})) + else + COMPREPLY=($(compgen -W "$(__aptly_published_distributions)" -- ${cur})) + fi + return 0 + fi + + if [[ $numargs -eq 1 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_prefixes_for_distribution $prev)" -- ${cur})) + return 0 + fi + + if [[ $numargs -ge 2 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_snapshot_list)" -- ${cur})) + return 0 + fi + ;; + "drop") + if [[ $numargs -eq 0 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_published_distributions)" -- ${cur})) + return 0 + fi + + if [[ $numargs -eq 1 ]]; then + COMPREPLY=($(compgen -W "$(__aptly_prefixes_for_distribution $prev)" -- ${cur})) + return 0 + fi + ;; + esac + ;; + "package") + case "$subcmd" in + "show") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-with-files -with-references" -- ${cur})) + fi + return 0 + fi + ;; + esac + ;; + "serve") + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-listen=" -- ${cur})) + return 0 + fi + ;; + "api") + case "$subcmd" in + "serve") + if [[ $numargs -eq 0 ]]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=($(compgen -W "-listen=" -- ${cur})) + fi + return 0 + fi + ;; + esac + ;; + esac +} && complete -F _aptly aptly diff --git a/debian/aptly.conf b/debian/aptly.conf new file mode 100644 index 00000000..56f79dea --- /dev/null +++ b/debian/aptly.conf @@ -0,0 +1,33 @@ +{ + "rootDir": "~/.aptly", + "downloadConcurrency": 4, + "downloadSpeedLimit": 0, + "downloadRetries": 0, + "downloader": "default", + "databaseOpenAttempts": -1, + "architectures": [], + "dependencyFollowSuggests": false, + "dependencyFollowRecommends": false, + "dependencyFollowAllVariants": false, + "dependencyFollowSource": false, + "dependencyVerboseResolve": false, + "gpgDisableSign": false, + "gpgDisableVerify": false, + "gpgProvider": "gpg", + "downloadSourcePackages": false, + "skipLegacyPool": true, + "ppaDistributorID": "ubuntu", + "ppaCodename": "", + "skipContentsPublishing": false, + "skipBz2Publishing": false, + "FileSystemPublishEndpoints": {}, + "S3PublishEndpoints": {}, + "SwiftPublishEndpoints": {}, + "AzurePublishEndpoints": {}, + "AsyncAPI": false, + "enableMetricsEndpoint": false, + "logLevel": "info", + "logFormat": "default", + "serveInAPIMode": false, + "enableSwaggerEndpoint": false +} diff --git a/debian/aptly.install b/debian/aptly.install new file mode 100644 index 00000000..c15bdc97 --- /dev/null +++ b/debian/aptly.install @@ -0,0 +1,6 @@ +build/aptly usr/bin/ +README.rst usr/share/aptly/ +LICENSE usr/share/aptly/ +AUTHORS usr/share/aptly/ +debian/aptly.conf etc/ +completion.d/_aptly usr/share/zsh/vendor-completions/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..4702c6a8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,92 @@ +aptly (1.6.0~beta1) stable; urgency=medium + + * upstream aptly debianization + + -- 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`. diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..b4de3947 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..cdfe9977 --- /dev/null +++ b/debian/control @@ -0,0 +1,69 @@ +Source: aptly +Section: devel +Priority: optional +Maintainer: Debian Go Packaging Team +Uploaders: TODO +Build-Depends: debhelper (>= 11), + dh-golang, + golang-go, + golang-github-aleksi-pointer-dev, + golang-github-awalterschulze-gographviz-dev, + golang-github-aws-aws-sdk-go-dev, + golang-github-disposaboy-jsonconfigreader-dev, + golang-github-gin-gonic-gin-dev, + golang-github-kjk-lzma-dev, + golang-github-mattn-go-shellwords-dev, + golang-github-mkrautz-goar-dev, + golang-github-mxk-go-flowrate-dev, + golang-github-ncw-swift-dev, + golang-github-pkg-errors-dev, + golang-github-smira-commander-dev, + golang-github-smira-flag-dev, + golang-github-smira-go-aws-auth-dev, + golang-github-smira-go-ftp-protocol-dev, + golang-github-smira-go-xz-dev (>> 0.0~git20150414.0c531f0-2.1), + golang-github-ugorji-go-codec-dev (>> 1.1.7-2), + golang-github-wsxiaoys-terminal-dev, + golang-golang-x-crypto-dev, + golang-golang-x-sys-dev, + golang-github-syndtr-goleveldb-dev, + golang-gopkg-check.v1-dev, + golang-gopkg-cheggaaa-pb.v1-dev, + golang-gopkg-h2non-filetype.v1-dev, + golang-uuid-dev, + golang-github-cavaliergopher-grab-dev, + golang-golang-x-time-dev, + golang-github-azure-azure-storage-blob-go-dev, + golang-github-klauspost-compress-dev, + golang-github-klauspost-pgzip-dev, +# golang-github-prometheus-client-golang-dev, + golang-github-rs-zerolog-dev (>= 1.28.0), + golang-github-mattn-go-colorable-dev, + golang-github-aws-aws-sdk-go-v2-dev, + golang-github-protonmail-go-crypto-dev, + golang-github-saracen-walker-dev, + 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 +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 +Description: Debian repository management tool + aptly is a Swiss army knife for Debian repository management. + +Package: aptly-dbg +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: Debian repository management tool (debug files) + Debug symbols for aptly + +Package: aptly-api +Architecture: all +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: Debian repository management tool (REST API server) + systemd service and configuration for aptly diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..53815267 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,54 @@ +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 +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 + aptly can properly depend on the corresponding Debian packages + (see https://bugs.debian.org/902128). + +Files: debian/* +Copyright: 2014 Sebastien Delafond +License: GPL-2+ + +License: GPL-2+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: Expat + 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 00000000..54949cbf --- /dev/null +++ b/debian/rules @@ -0,0 +1,42 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/pkg-info.mk + +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) + +%: + dh $@ --buildsystem=golang --with=golang + +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: + +override_dh_auto_install: + dh_auto_install -- --no-source + mkdir -p debian/aptly/usr/share/man/man1/ debian/aptly/usr/share/bash-completion/completions/ + cp man/aptly.1 debian/aptly/usr/share/man/man1 + cp completion.d/aptly debian/aptly/usr/share/bash-completion/completions/ + 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: + +# not needed with golang, fails with cross compiling +# override_dh_makeshlibs: diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..af745b31 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (git) diff --git a/upload-artifacts.sh b/upload-artifacts.sh index 1c7d1c0d..df6cf3ea 100755 --- a/upload-artifacts.sh +++ b/upload-artifacts.sh @@ -39,6 +39,7 @@ upload() done echo } + cleanup() { echo "\nCleanup..." curl -fsS -X DELETE -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder