From: Peter Kjellerstedt <pkj@axis.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 3/3] archiver.bbclass: Add ARCHIVER_MIRROR_INCLUDE
Date: Mon, 8 Jun 2026 19:52:59 +0200 [thread overview]
Message-ID: <20260608175259.3238900-3-pkj@axis.com> (raw)
In-Reply-To: <20260608175259.3238900-1-pkj@axis.com>
When using the archiver's mirror mode, ARCHIVER_MIRROR_INCLUDE contains
a list of URI prefixes to always include in the mirror. This may be
useful if recipes that are included in the mirror (due to their
licenses) depend on some recipe that otherwise would not be included in
the mirror, and that recipe uses files that are normally only available
on a private server.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/classes/archiver.bbclass | 37 ++++++++++++++++++++++--
meta/lib/oeqa/selftest/cases/archiver.py | 24 +++++++++++++++
2 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index a3f8689b19..035d0dce0f 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -35,7 +35,13 @@
# ARCHIVER_MODE[mirror] = "combined": All sources are placed into a single
# directory suitable for direct use as a mirror. Duplicate sources are
# ignored.
-# 12) Source mirror exclusions:
+# 12) Source mirror inclusions:
+# ARCHIVER_MIRROR_INCLUDE is a list of URI prefixes to always include in
+# the mirror. This may be useful if recipes that are included in the mirror
+# (due to their licenses) depend on some recipe that otherwise would not be
+# included in the mirror, and that recipe uses files that are normally only
+# available on a private server.
+# 13) Source mirror exclusions:
# ARCHIVER_MIRROR_EXCLUDE is a list of prefixes to exclude from the mirror.
# This may be used for sources which you are already publishing yourself
# (e.g. if the URI starts with 'https://mysite.com/' and your mirror is
@@ -77,8 +83,9 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
# This is a convenience for the shell script to use it
def include_package(d, pn):
-
- included, reason = copyleft_should_include(d)
+ included, reason = archiver_should_include(d)
+ if not included:
+ included, reason = copyleft_should_include(d)
if not included:
bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason))
return False
@@ -99,6 +106,29 @@ def include_package(d, pn):
return True
+def archiver_should_include(d):
+ ar_src = d.getVarFlag('ARCHIVER_MODE', 'src')
+ if ar_src == "mirror":
+ src_uri = (d.getVar('SRC_URI') or '').split()
+ if len(src_uri) == 0:
+ return False, None
+
+ mirror_inclusions = (d.getVar('ARCHIVER_MIRROR_INCLUDE') or '').split()
+
+ def is_included(url):
+ for prefix in mirror_inclusions:
+ if url.startswith(prefix):
+ return True
+ return False
+
+ fetcher = bb.fetch2.Fetch(src_uri, d)
+
+ for ud in fetcher.expanded_urldata():
+ if is_included(ud.url):
+ return True, "URL matches ARCHIVER_MIRROR_INCLUDE"
+
+ return False, None
+
python () {
pn = d.getVar('PN')
assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
@@ -182,6 +212,7 @@ python () {
do_ar_prepare[vardeps] += " \
ARCHIVER_MODE \
ARCHIVER_MIRROR_EXCLUDE \
+ ARCHIVER_MIRROR_INCLUDE \
COPYLEFT_LICENSE_EXCLUDE \
COPYLEFT_LICENSE_INCLUDE \
COPYLEFT_PN_EXCLUDE \
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py
index 122d16b655..e9f178d5c9 100644
--- a/meta/lib/oeqa/selftest/cases/archiver.py
+++ b/meta/lib/oeqa/selftest/cases/archiver.py
@@ -261,6 +261,30 @@ class Archiver(OESelftestTestCase):
archive_path = os.path.join(glob_result[0], target_file_name)
self.assertFalse(os.path.exists(archive_path), 'Failed to exclude archive file %s' % (target_file_name))
+ def test_archiver_mode_mirror_include(self):
+ """
+ Test that `ARCHIVER_MIRROR_INCLUDE` causes a source URL to be included
+ in the mirror even when the recipe would otherwise be excluded by the
+ copyleft license filter.
+ """
+
+ target = 'selftest-ed'
+ target_file_name = 'ed-1.21.1.tar.lz'
+
+ features = 'INHERIT += "archiver"\n'
+ features += 'ARCHIVER_MODE[src] = "mirror"\n'
+ features += 'ARCHIVER_MODE[mirror] = "combined"\n'
+ features += 'BB_GENERATE_MIRROR_TARBALLS = "1"\n'
+ features += 'COPYLEFT_LICENSE_INCLUDE = "CLOSED"\n'
+ features += 'ARCHIVER_MIRROR_INCLUDE = "${GNU_MIRROR}"\n'
+ self.write_config(features)
+
+ bitbake('-c deploy_archives %s' % (target))
+
+ bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
+ target_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
+ self.assertTrue(os.path.exists(target_path), 'Missing archive file %s' % (target_file_name))
+
def test_archiver_mode_mirror_combined(self):
"""
Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`
prev parent reply other threads:[~2026-06-08 17:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 17:52 [PATCH 1/3] archiver.bbclass: Properly remove artifacts when configuration changes Peter Kjellerstedt
2026-06-08 17:52 ` [PATCH 2/3] oeqa/selftest/archiver: Do not run bitbake -c clean unnecessarily Peter Kjellerstedt
2026-06-08 17:52 ` Peter Kjellerstedt [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=20260608175259.3238900-3-pkj@axis.com \
--to=pkj@axis.com \
--cc=openembedded-core@lists.openembedded.org \
/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