* [PATCH 1/1] isar-apt: support further optional fields in Release
@ 2025-03-19 9:13 'Felix Moessbauer' via isar-users
2025-03-25 16:58 ` Uladzimir Bely
0 siblings, 1 reply; 2+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2025-03-19 9:13 UTC (permalink / raw)
To: isar-users; +Cc: 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.moessbauer@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
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250319091347.9181-1-felix.moessbauer%40siemens.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] isar-apt: support further optional fields in Release
2025-03-19 9:13 [PATCH 1/1] isar-apt: support further optional fields in Release 'Felix Moessbauer' via isar-users
@ 2025-03-25 16:58 ` Uladzimir Bely
0 siblings, 0 replies; 2+ messages in thread
From: Uladzimir Bely @ 2025-03-25 16:58 UTC (permalink / raw)
To: Felix Moessbauer, isar-users
On Wed, 2025-03-19 at 10:13 +0100, 'Felix Moessbauer' via isar-users
wrote:
> 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.moessbauer@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
Applied to next, thanks.
--
Best regards,
Uladzimir.
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/fc30da30ce43b1d226b89f23d06fd9261426ae97.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-25 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-19 9:13 [PATCH 1/1] isar-apt: support further optional fields in Release 'Felix Moessbauer' via isar-users
2025-03-25 16:58 ` Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox