public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Zhihang Wei <wzh@ilbers.de>
To: srinuvasan.a@siemens.com, isar-users@googlegroups.com
Cc: amikan@ilbers.de, Cedric Hombourger <cedric.hombourger@siemens.com>
Subject: Re: [PATCH v3] repository: default Priority to optional when field is absent
Date: Fri, 22 May 2026 16:29:15 +0200	[thread overview]
Message-ID: <2d686c47-a66e-4dbf-9741-d1d7303951e2@ilbers.de> (raw)
In-Reply-To: <20260515101246.671704-1-srinuvasan.a@siemens.com>

Applied to next, thanks.

Zhihang

On 5/15/26 12:12, srinuvasan.a via isar-users wrote:
> From: Srinuvasan A <srinuvasan.a@siemens.com>
>
> Some upstream packages omit the Priority field from their binary .deb
> metadata. reprepro rejects such packages with "No priority given",
> aborting repository construction.
>
> This was observed with a base-apt build that include upstream packages
> such as gir1.2-javascriptcoregtk-4.1. Both base-apt and isar-apt use
> the repository class. Fix repo_add_packages() to detect a missing
> Priority field and fall back to "optional", matching the Debian policy
> default.
>
> Add a test recipe (test-nopriority) that explicitly strips the
> Priority field before build, and a citest.py test case that exercises
> the isar-apt repository path with this recipe, covering the same
> failure mode as the base-apt case.
>
> Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> ---
>   .../test-nopriority/test-nopriority.bb          | 15 +++++++++++++++
>   meta/classes-recipe/repository.bbclass          | 15 ++++++++++++---
>   testsuite/citest.py                             | 17 +++++++++++++++++
>   3 files changed, 44 insertions(+), 3 deletions(-)
>   create mode 100644 meta-test/recipes-app/test-nopriority/test-nopriority.bb
>   mode change 100755 => 100644 testsuite/citest.py
>
> diff --git a/meta-test/recipes-app/test-nopriority/test-nopriority.bb b/meta-test/recipes-app/test-nopriority/test-nopriority.bb
> new file mode 100644
> index 00000000..dfccffd1
> --- /dev/null
> +++ b/meta-test/recipes-app/test-nopriority/test-nopriority.bb
> @@ -0,0 +1,15 @@
> +# This software is a part of Isar.
> +# Copyright (C) 2026 Siemens AG
> +#
> +# SPDX-License-Identifier: MIT
> +
> +# Test that a .deb without a Priority field can be added to the repository.
> +# The debianize class sets Priority in the Source stanza of debian/control;
> +# we strip it here so the resulting .deb has no Priority metadata, exercising
> +# the prio_opt fallback in repository.bbclass.
> +
> +inherit dpkg-raw
> +
> +do_prepare_build:append() {
> +    sed -i '/^Priority:/d' ${S}/debian/control
> +}
> diff --git a/meta/classes-recipe/repository.bbclass b/meta/classes-recipe/repository.bbclass
> index a5dd8bbc..ba2803ad 100644
> --- a/meta/classes-recipe/repository.bbclass
> +++ b/meta/classes-recipe/repository.bbclass
> @@ -61,14 +61,23 @@ repo_add_packages() {
>       local dir="$1"
>       local dbdir="$2"
>       local codename="$3"
> +    local package
> +    local priority
> +    local prio_opt
>       shift; shift; shift
>   
>       if [ -n "${GNUPGHOME}" ]; then
>           export GNUPGHOME="${GNUPGHOME}"
>       fi
> -    reprepro -b "${dir}" --dbdir "${dbdir}" -C main \
> -        includedeb "${codename}" \
> -        "$@"
> +    for package in "$@"; do
> +        prio_opt=""
> +        priority=$(dpkg-deb -f "${package}" Priority 2>/dev/null || true)
> +        if [ -z "${priority}" ]; then
> +            prio_opt="-P optional"
> +        fi
> +        reprepro -b "${dir}" --dbdir "${dbdir}" -C main ${prio_opt} \
> +            includedeb "${codename}" "${package}"
> +    done
>   }
>   
>   repo_del_srcpackage() {
> diff --git a/testsuite/citest.py b/testsuite/citest.py
> old mode 100755
> new mode 100644
> index b3866675..a051ce54
> --- a/testsuite/citest.py
> +++ b/testsuite/citest.py
> @@ -131,6 +131,23 @@ class CompatTest(CIBaseTest):
>           self.perform_build_test(targets, compat_arch=True)
>   
>   
> +class RepositoryTest(CIBaseTest):
> +    """
> +    Test repository functionality.
> +    :avocado: tags=repository,fast
> +    """
> +
> +    def test_repository_nopriority(self):
> +        """Test that packages without a Priority field can be added to the repo."""
> +        targets = [
> +            'mc:qemuamd64-bookworm:isar-image-ci',
> +        ]
> +
> +        self.init()
> +        self.perform_build_test(targets,
> +                                image_install='test-nopriority')
> +
> +
>   class SbuildFlavor(CIBaseTest):
>       """
>       Test package build with a custom sbuild chroot.

-- 
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/2d686c47-a66e-4dbf-9741-d1d7303951e2%40ilbers.de.

      reply	other threads:[~2026-05-22 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 10:04 [PATCH] " srinuvasan.a via isar-users
2026-05-12 13:51 ` Anton Mikanovich
2026-05-15 10:02   ` [PATCH v2] " srinuvasan.a via isar-users
2026-05-15 10:12     ` [PATCH v3] " srinuvasan.a via isar-users
2026-05-22 14:29       ` Zhihang Wei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d686c47-a66e-4dbf-9741-d1d7303951e2@ilbers.de \
    --to=wzh@ilbers.de \
    --cc=amikan@ilbers.de \
    --cc=cedric.hombourger@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=srinuvasan.a@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox