[PATCH] repository: default Priority to optional when field is absent

15 views
Skip to first unread message

srinuv...@siemens.com

unread,
Apr 27, 2026, 6:03:59 AMApr 27
to isar-...@googlegroups.com, Srinuvasan A, Cedric Hombourger
From: Srinuvasan A <srinuv...@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 <srinuv...@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.h...@siemens.com>
---
.../test-nopriority/test-nopriority.bb | 10 ++++++++++
meta/classes-recipe/repository.bbclass | 15 ++++++++++++---
testsuite/citest.py | 10 ++++++++++
3 files changed, 32 insertions(+), 3 deletions(-)
create mode 100644 meta-test/recipes-app/test-nopriority/test-nopriority.bb

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..dc06c112
--- /dev/null
+++ b/meta-test/recipes-app/test-nopriority/test-nopriority.bb
@@ -0,0 +1,10 @@
+# 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
index fc6ec24c..9fdb9fd7 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -84,6 +84,16 @@ class DevTest(CIBaseTest):
self.init()
self.perform_build_test(targets)

+ def test_dev_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')
+
def test_dev_rebuild(self):
self.init()
layerdir_core = CIUtils.getVars('LAYERDIR_core')
--
2.34.1

Anton Mikanovich

unread,
May 12, 2026, 9:51:42 AM (8 days ago) May 12
to isar-...@googlegroups.com, srinu
Hello Srinuvasan,
Can you also add copyright header with SPDX in new file?
Do we really need this test case in "dev"?
It supposed to be as minimal as possible, without adding any specific
checks.
So maybe this test case should be moved in "fast".

srinuv...@siemens.com

unread,
May 15, 2026, 6:01:48 AM (5 days ago) May 15
to isar-...@googlegroups.com, ami...@ilbers.de, Srinuvasan A, Cedric Hombourger
From: Srinuvasan A <srinuv...@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 <srinuv...@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.h...@siemens.com>
---
.../test-nopriority/test-nopriority.bb | 10 ++++++++++
meta/classes-recipe/repository.bbclass | 15 ++++++++++++---
testsuite/citest.py | 17 +++++++++++++++++
3 files changed, 39 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..dc06c112
--- /dev/null
+++ b/meta-test/recipes-app/test-nopriority/test-nopriority.bb
old mode 100755
new mode 100644
index fc6ec24c..7b734be5
--- 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.
--
2.34.1

srinuv...@siemens.com

unread,
May 15, 2026, 6:11:58 AM (5 days ago) May 15
to isar-...@googlegroups.com, ami...@ilbers.de, Srinuvasan A, Cedric Hombourger
From: Srinuvasan A <srinuv...@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 <srinuv...@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.h...@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
+
index b3866675..a051ce54
Reply all
Reply to author
Forward
0 new messages