diff mbox series

[RFC,2/2] classes/archiver: remove SRPM mode

Message ID 20260619141222.4097163-2-ross.burton@arm.com
State New
Headers show
Series [RFC,1/2] classes/archive: change numbered list to bullets | expand

Commit Message

Ross Burton June 19, 2026, 2:12 p.m. UTC
The archiver supports saving the source code in either a tarball or a
Source RPM (SRPM).  Tarballs are a logical choice as they're a standard
format for source code, but SRPMs are primarily a way to distribute
source plus packaging scripts for RPM-based distributions, and the SRPMs
generated by the archiver do not include any packaging scripts.

This can result in confusion when people may think that you can take the
SRPM generated by the archiver and rebuild it with rpmbuild, whereas this
will not work.

I think we should remove the SRPM mode from the archiver on the grounds
that tarballs are idiomatic for sharing software, and SRPMs are actively
confusing.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-global/package_rpm.bbclass       | 43 -------------------
 meta/classes/archiver.bbclass                 | 28 ------------
 .../default/local.conf.sample.extended        |  7 +--
 meta/lib/oeqa/selftest/cases/archiver.py      | 12 ------
 meta/lib/oeqa/selftest/cases/buildoptions.py  |  4 +-
 5 files changed, 3 insertions(+), 91 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index f383ed140e6..9eacd91cbc3 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -101,34 +101,6 @@  python write_specfile () {
     import oe.packagedata
     import os,pwd,grp,stat
 
-    # append information for logs and patches to %prep
-    def add_prep(d, spec_files_bottom):
-        if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
-            spec_files_bottom.append('%%prep')
-            spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"")
-            spec_files_bottom.append('')
-
-    # append the name of tarball to key word 'SOURCE' in xxx.spec.
-    def tail_source(d):
-        if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
-            ar_outdir = d.getVar('ARCHIVER_OUTDIR')
-            if not os.path.exists(ar_outdir):
-                return
-            source_list = os.listdir(ar_outdir)
-            source_number = 0
-            for source in source_list:
-                # do_deploy_archives may have already run (from sstate) meaning a .src.rpm may already
-                # exist in ARCHIVER_OUTDIR so skip if present.
-                if source.endswith(".src.rpm"):
-                    continue
-                # The rpmbuild doesn't need the root permission, but it needs
-                # to know the file's user and group name, the only user and
-                # group in fakeroot is "root" when working in fakeroot.
-                f = os.path.join(ar_outdir, source)
-                os.chown(f, 0, 0)
-                spec_preamble_top.append('Source%s: %s' % (source_number, source))
-                source_number += 1
-
     # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
     # This format is similar to OE, however there are restrictions on the
     # characters that can be in a field.  In the Version field, "-"
@@ -402,11 +374,6 @@  python write_specfile () {
 
         # Gather special src/first package data
         if srcname == splitname:
-            archiving = d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and \
-                        bb.data.inherits_class('archiver', d)
-            if archiving and srclicense != splitlicense:
-                bb.warn("The SRPM produced may not have the correct overall source license in the License tag. This is due to the LICENSE for the primary package and SRPM conflicting.")
-
             srclicense     = splitlicense
             srcrdepends    = splitrdepends
             srcrrecommends = splitrrecommends
@@ -530,7 +497,6 @@  python write_specfile () {
 
         del localdata
 
-    add_prep(d, spec_files_bottom)
     spec_preamble_top.append('Summary: %s' % srcsummary)
     spec_preamble_top.append('Name: %s' % srcname)
     spec_preamble_top.append('Version: %s' % srcversion)
@@ -544,7 +510,6 @@  python write_specfile () {
         spec_preamble_top.append('URL: %s' % srchomepage)
     if srccustomtagschunk:
         spec_preamble_top.append(srccustomtagschunk)
-    tail_source(d)
 
     # Replaces == Obsoletes && Provides
     robsoletes = bb.utils.explode_dep_versions2(srcrobsoletes)
@@ -716,14 +681,6 @@  python do_package_rpm () {
     cmd = cmd + " --define '_passwd_path " + "/completely/bogus/path" + "'"
     cmd = cmd + " --define '_group_path " + "/completely/bogus/path" + "'"
     cmd = cmd + rpmbuild_extra_params
-    if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
-        cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
-        cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_RPMOUTDIR') + "'"
-        cmdsrpm = cmdsrpm + " -bs " + outspecfile
-        # Build the .src.rpm
-        d.setVar('SBUILDSPEC', cmdsrpm + "\n")
-        d.setVarFlag('SBUILDSPEC', 'func', '1')
-        bb.build.exec_func('SBUILDSPEC', d)
     cmd = cmd + " -bb " + outspecfile
 
     # rpm 4 creates various empty directories in _topdir, let's clean them up
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index e27aee4e90a..3124b7040d4 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -17,8 +17,6 @@ 
 #  - The environment data, similar to 'bitbake -e recipe':
 #     ARCHIVER_MODE[dumpdata] = "1"
 #  - The recipe (.bb and .inc): ARCHIVER_MODE[recipe] = "1"
-#  - Whether output the .src.rpm package:
-#     ARCHIVER_MODE[srpm] = "1"
 #  - Filter the license, the recipe whose license in
 #    COPYLEFT_LICENSE_INCLUDE will be included, and in
 #    COPYLEFT_LICENSE_EXCLUDE will be excluded.
@@ -48,7 +46,6 @@ 
 COPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian'
 inherit copyleft_filter
 
-ARCHIVER_MODE[srpm] ?= "0"
 ARCHIVER_MODE[src] ?= "patched"
 ARCHIVER_MODE[diff] ?= "0"
 ARCHIVER_MODE[diff-exclude] ?= ".pc autom4te.cache patches"
@@ -61,8 +58,6 @@  DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
 ARCHIVER_TOPDIR ?= "${WORKDIR}/archiver-sources"
 ARCHIVER_ARCH = "${TARGET_SYS}"
 ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${ARCHIVER_ARCH}/${PF}/"
-ARCHIVER_RPMTOPDIR ?= "${WORKDIR}/deploy-sources-rpm"
-ARCHIVER_RPMOUTDIR = "${ARCHIVER_RPMTOPDIR}/${ARCHIVER_ARCH}/${PF}/"
 ARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/"
 
 # When producing a combined mirror directory, allow duplicates for the case
@@ -154,29 +149,6 @@  python () {
 
     if ar_recipe == "1":
         d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_recipe' % pn)
-
-    # Output the SRPM package
-    if d.getVarFlag('ARCHIVER_MODE', 'srpm') == "1" and d.getVar('PACKAGES'):
-        if "package_rpm" not in d.getVar('PACKAGE_CLASSES'):
-            bb.fatal("ARCHIVER_MODE[srpm] needs package_rpm in PACKAGE_CLASSES")
-
-        # Some recipes do not have any packaging tasks
-        if hasTask("do_package_write_rpm"):
-            d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn)
-            d.appendVarFlag('do_package_write_rpm', 'dirs', ' ${ARCHIVER_RPMTOPDIR}')
-            d.appendVarFlag('do_package_write_rpm', 'sstate-inputdirs', ' ${ARCHIVER_RPMTOPDIR}')
-            d.appendVarFlag('do_package_write_rpm', 'sstate-outputdirs', ' ${DEPLOY_DIR_SRC}')
-            d.appendVar('PSEUDO_INCLUDE_PATHS', ',${ARCHIVER_TOPDIR}')
-            if ar_dumpdata == "1":
-                d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn)
-            if ar_recipe == "1":
-                d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_recipe' % pn)
-            if ar_src == "original":
-                d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_original' % pn)
-            elif ar_src == "patched":
-                d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_patched' % pn)
-            elif ar_src == "configured":
-                d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_configured' % pn)
 }
 
 do_ar_prepare[vardeps] += " \
diff --git a/meta/conf/templates/default/local.conf.sample.extended b/meta/conf/templates/default/local.conf.sample.extended
index 999a09dac1c..bb9807637c8 100644
--- a/meta/conf/templates/default/local.conf.sample.extended
+++ b/meta/conf/templates/default/local.conf.sample.extended
@@ -238,16 +238,13 @@ 
 # 6) the recipe (.bb and .inc):
 #ARCHIVER_MODE[recipe] = "1"
 #
-# 7) Whether output the .src.rpm package:
-#ARCHIVER_MODE[srpm] = "1"
-#
-# 8) Filter the license, the recipe whose license in
+# 7) Filter the license, the recipe whose license in
 #    COPYLEFT_LICENSE_INCLUDE will be included, and in
 #    COPYLEFT_LICENSE_EXCLUDE will be excluded.
 #COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*'
 #COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary'
 #
-# 9) Config the recipe type that will be archived, the type can be
+# 8) Config the recipe type that will be archived, the type can be
 #    target, native, nativesdk, cross, crosssdk and cross-canadian,
 #    you can set one or more types. Archive all types by default.
 #COPYLEFT_RECIPE_TYPES = 'target'
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py
index 122d16b6557..8c5aa75e9b3 100644
--- a/meta/lib/oeqa/selftest/cases/archiver.py
+++ b/meta/lib/oeqa/selftest/cases/archiver.py
@@ -150,18 +150,6 @@  class Archiver(OESelftestTestCase):
             'The task "%s" of the recipe "%s" has different signatures in "%s" for each machine in multiconfig' \
             % (task, pn, locked_sigs_inc))
 
-    def test_archiver_srpm_mode(self):
-        """
-        Test that in srpm mode, the added recipe dependencies at least exist/work [YOCTO #11121]
-        """
-
-        features = 'INHERIT += "archiver"\n'
-        features += 'ARCHIVER_MODE[srpm] = "1"\n'
-        features += 'PACKAGE_CLASSES = "package_rpm"\n'
-        self.write_config(features)
-
-        bitbake('-n selftest-nopackages selftest-ed')
-
     def _test_archiver_mode(self, mode, target_file_name, extra_config=None):
         target = 'selftest-ed-native'
 
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py
index d9d37ebc7fb..59145df0fd6 100644
--- a/meta/lib/oeqa/selftest/cases/buildoptions.py
+++ b/meta/lib/oeqa/selftest/cases/buildoptions.py
@@ -147,15 +147,13 @@  class ArchiverTest(OESelftestTestCase):
 INHERIT += "archiver"
 PACKAGE_CLASSES = "package_rpm"
 ARCHIVER_MODE[src] = "original"
-ARCHIVER_MODE[srpm] = "1"
 """)
         res = bitbake("xcursor-transparent-theme", ignore_status=True)
         self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output)
         deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC')
         pkgs_path = g.glob(str(deploy_dir_src) + "/allarch*/xcurs*")
-        src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm"
         tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.xz"
-        self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.xz files under %s/allarch*/xcursor*" % deploy_dir_src)
+        self.assertTrue(g.glob(tar_file_glob), "Couldn't find .tar.xz files under %s/allarch*/xcursor*" % deploy_dir_src)
 
 class ToolchainOptions(OESelftestTestCase):
     def test_toolchain_fortran(self):