[PATCH 1/1] isar-apt: support further optional fields in Release

10 views
Skip to first unread message

Felix Moessbauer

unread,
Mar 19, 2025, 5:13:56 AM3/19/25
to isar-...@googlegroups.com, Felix Moessbauer
The isar-apt repository is a proper apt repository which can be
distributed as-is. A common use-case for that is to build packages which
are then used in a standard Debian by adding the repository to the apt
sources. In this case, it is desired to fill some of the optional fields
in Release to enable fine-grained pinnings.

We extend the repo_create function to allow appending arbitrary fields
to the Release file. To make that easy to use, we introduce the
ISAR_APT_OPT_FIELD bitbake var map. As the do_cache_config task now
depends on user-input, we also ensure it is rebuild when changed.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
RECIPE-API-CHANGELOG.md | 5 +++++
meta/classes/repository.bbclass | 10 ++++++++++
meta/recipes-devtools/isar-apt/isar-apt.bb | 6 +++++-
3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 64c0f34a..2801a177 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -714,3 +714,8 @@ For example, If `KERNEL_NAME` is configured as `foo` for arm64, now
`linux-libc-dev-foo` and `linux-libc-dev-arm64-cross-foo` package will be
generated. This will help to have multiple versions of linux-libc-dev packages
available for respective bsps in apt feeds.
+
+### ISAR APT Repository
+
+Optional fields of the isar-apt repo can be controlled by adding to the
+`ISAR_APT_OPT_FIELD` map. Example: `ISAR_APT_OPT_FIELD[Origin]="isar"`.
diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index bc5852a5..8fbceed6 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -4,12 +4,19 @@
#
# SPDX-License-Identifier: MIT

+def repo_expand_opt_fields(d, var):
+ f = d.getVarFlags(var)
+ if not f:
+ return ''
+ return '\n'.join('{}: {}'.format(k, v) for k, v in f.items())
+
repo_create() {
local dir="$1"
local dbdir="$2"
local codename="$3"
local distros_in="$4"
local keyfiles="$5"
+ local conf_append="$6"

if [ -n "${GNUPGHOME}" ]; then
export GNUPGHOME="${GNUPGHOME}"
@@ -27,6 +34,9 @@ repo_create() {
done
echo "SignWith: ${option}" >> "${dir}"/conf/distributions
fi
+ if [ -n "${conf_append}" ]; then
+ echo "${conf_append}" >> "${dir}"/conf/distributions
+ fi
fi
if [ ! -d "${dbdir}" ]; then
reprepro -b "${dir}" --dbdir "${dbdir}" export "${codename}"
diff --git a/meta/recipes-devtools/isar-apt/isar-apt.bb b/meta/recipes-devtools/isar-apt/isar-apt.bb
index 187784f9..cda7de89 100644
--- a/meta/recipes-devtools/isar-apt/isar-apt.bb
+++ b/meta/recipes-devtools/isar-apt/isar-apt.bb
@@ -9,6 +9,8 @@ inherit repository
SRC_URI = "file://distributions.in"

do_cache_config[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
+do_cache_config[vardeps] += "ISAR_APT_OPT_FIELD"
+do_cache_config[cleandirs] += "${REPO_ISAR_DIR}/${DISTRO}/conf"

# Generate reprepro config for current distro if it doesn't exist. Once it's
# generated, this task should do nothing.
@@ -16,7 +18,9 @@ do_cache_config() {
repo_create "${REPO_ISAR_DIR}"/"${DISTRO}" \
"${REPO_ISAR_DB_DIR}"/"${DISTRO}" \
"${DEBDISTRONAME}" \
- "${WORKDIR}/distributions.in"
+ "${WORKDIR}/distributions.in" \
+ "" \
+ "${@ repo_expand_opt_fields(d, 'ISAR_APT_OPT_FIELD')}"
}

addtask cache_config after do_unpack before do_build
--
2.49.0

Uladzimir Bely

unread,
Mar 25, 2025, 12:58:06 PM3/25/25
to Felix Moessbauer, isar-...@googlegroups.com
On Wed, 2025-03-19 at 10:13 +0100, 'Felix Moessbauer' via isar-users
wrote:
Applied to next, thanks.

--
Best regards,
Uladzimir.


Reply all
Reply to author
Forward
0 new messages