From 7e914793d843653a3b5cb83e2be145ce9cd0e4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ru=C5=BEi=C4=8Dka?= <jakub.ruzicka@nic.cz> Date: Wed, 21 Apr 2021 17:49:11 +0200 Subject: [PATCH] distro: add apkg support Change packaging templates distro/pkg/* to use {{ version }}. Add scripts/make_dev_archive.sh to create dev archives. Add apkg config: distro/config/apkg.toml With these changes, apkg can be used to package Knot DNS. --- .gitignore | 3 +++ distro/config/apkg.toml | 12 ++++++++++++ distro/pkg/arch/PKGBUILD | 4 ++-- distro/pkg/deb/changelog | 2 +- distro/pkg/rpm/knot.spec | 7 +++---- scripts/make-dev-archive.sh | 14 ++++++++++++++ 6 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 distro/config/apkg.toml create mode 100755 scripts/make-dev-archive.sh diff --git a/.gitignore b/.gitignore index 66acf991a7..1a4374edc1 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,9 @@ src/libknot/libknot.h # Generated tarballs /knot-*.tar.xz +# Packaging output +/pkg + # Code coverage *.gcda *.gcno diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml new file mode 100644 index 0000000000..abb8cbcd37 --- /dev/null +++ b/distro/config/apkg.toml @@ -0,0 +1,12 @@ +[project] +name = "knot-dns" +# needed for make-archive +make_archive_script = "scripts/make-dev-archive.sh" + +[upstream] +# needed for get-archive +archive_url = "https://secure.nic.cz/files/knot-dns/knot-{{ version }}.tar.xz" +signature_url = "https://secure.nic.cz/files/knot-dns/knot-{{ version }}.tar.xz.asc" + +[apkg] +compat = 1 diff --git a/distro/pkg/arch/PKGBUILD b/distro/pkg/arch/PKGBUILD index eccde30ae7..f8d68eaefe 100644 --- a/distro/pkg/arch/PKGBUILD +++ b/distro/pkg/arch/PKGBUILD @@ -6,7 +6,7 @@ # Contributor: Otto Sabart <seberm[at]gmail[dot]com> pkgname=knot -pkgver=__VERSION__ +pkgver={{ version }} pkgrel=1 pkgdesc="High-performance authoritative-only DNS server" arch=('x86_64') @@ -23,7 +23,7 @@ depends=('fstrm' 'protobuf-c' 'systemd') backup=('etc/knot/knot.conf') -source=("${pkgname}_${pkgver}.orig.tar.xz") +source=("${pkgname}-${pkgver}.tar.xz") sha256sums=('SKIP') validpgpkeys=('742FA4E95829B6C5EAC6B85710BB7AF6FEBBD6AB') # Daniel Salzman <daniel.salzman@nic.cz> diff --git a/distro/pkg/deb/changelog b/distro/pkg/deb/changelog index 285b69e2c4..5538ae1e3b 100644 --- a/distro/pkg/deb/changelog +++ b/distro/pkg/deb/changelog @@ -1,4 +1,4 @@ -knot (__VERSION__-cznic.1) unstable; urgency=medium +knot ({{ version }}-cznic.{{ release }}) unstable; urgency=medium * move changelog to OBS * see NEWS or https://knot-dns.cz diff --git a/distro/pkg/rpm/knot.spec b/distro/pkg/rpm/knot.spec index 8ee8ff8a82..254d6805d3 100644 --- a/distro/pkg/rpm/knot.spec +++ b/distro/pkg/rpm/knot.spec @@ -2,17 +2,16 @@ %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}} %define GPG_CHECK 0 -%define VERSION __VERSION__ %define BASE_VERSION %(echo "%{version}" | sed 's/^\\([^.]\\+\\.[^.]\\+\\).*/\\1/') %define repodir %{_builddir}/%{name}-%{version} Summary: High-performance authoritative DNS server Name: knot -Version: %{VERSION} -Release: cznic.1%{?dist} +Version: {{ version }} +Release: cznic.{{ release }}%{?dist} License: GPL-3.0-or-later URL: https://www.knot-dns.cz -Source0: %{name}_%{version}.orig.tar.xz +Source0: %{name}-%{version}.tar.xz %if 0%{?GPG_CHECK} Source1: https://secure.nic.cz/files/knot-dns/%{name}-%{version}.tar.xz.asc diff --git a/scripts/make-dev-archive.sh b/scripts/make-dev-archive.sh new file mode 100755 index 0000000000..693ca506ef --- /dev/null +++ b/scripts/make-dev-archive.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0-or-later +# Create a develpoment tarball +set -o errexit -o nounset -o xtrace + +cd "$(dirname ${0})/.." + +# configure Knot DNS in order to create archive +autoreconf -if +./configure +# create archive and parse output for archive name +TARDIR=$(make dist 2>&1 | sed -n 's/tardir=\([^ ]\+\).*/\1/p') +# print created archive name +ls -1 $TARDIR.tar.* -- GitLab