Skip to contentSkip to conversation

package_manager: ipk: add OPKG_MAKE_INDEX_EXTRA_PARAMS variable

PATCH New Martin Jansa 1 participant 2 messages Feb 2, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package_manager: ipk: add OPKG_MAKE_INDEX_EXTRA_PARAMS variable

* can be used to pass e.g. -f param to preserve user-defined fields in the index as added in:
https://git.yoctoproject.org/opkg-utils/commit/opkg-make-index?id=13f6281d24e17199e0fef6c2984419372ea0f86f

* otherwise it will show a lot of messages like:
"Lost field Author <value>"
for every package in the feed

---
v2: fix build when OPKG_MAKE_INDEX_EXTRA_PARAMS isn't set

 meta/lib/oe/package_manager/ipk/__init__.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/lib/oe/package_manager/ipk/__init__.py +3 -2
index 8fcbad56aa..8cc9953a02 100644
@@ -16,6 +16,7 @@ class OpkgIndexer(Indexer):
                      ]
 
         opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index")
+        opkg_index_cmd_extra_params = self.d.getVar('OPKG_MAKE_INDEX_EXTRA_PARAMS') or ""
         if self.d.getVar('PACKAGE_FEED_SIGN') == '1':
             signer = get_signer(self.d, self.d.getVar('PACKAGE_FEED_GPG_BACKEND'))
         else:
@@ -41,8 +42,8 @@ class OpkgIndexer(Indexer):
                 if not os.path.exists(pkgs_file):
                     open(pkgs_file, "w").close()
 
-                index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s' %
-                                  (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir))
+                index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s %s' %
+                                  (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir, opkg_index_cmd_extra_params))
 
                 index_sign_files.add(pkgs_file)
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 package_rpm: add RPMBUILD_EXTRA_PARAMS variable

* e.g. for DISTROs which define extra user-defined fields with PACKAGE_ADD_METADATA/PACKAGE_ADD_METADATA_RPM
as undefined fields in packagedata are fatal error for rpmbuild:
"error: line 9: Unknown tag: Author: Unspecified"
as shown in:
http://errors.yoctoproject.org/Errors/Details/751706/
with "Author" field added with:

  PACKAGE_CLASSES = "package_rpm"
  PACKAGE_ADD_AUTHOR_METADATA = "test-author"
  PACKAGE_ADD_METADATA = "Author: ${PACKAGE_ADD_AUTHOR_METADATA}"

to fix rpm build you can use:
RPMBUILD_EXTRA_PARAMS = " --define '_Author Author'" keep in mind that this doesn't cause this Author field to be added in .rpm, it just avoids the BUILDSPEC failure.

and for ipk build:
OPKG_MAKE_INDEX_EXTRA_PARAMS = "-f"

alternatively you can avoid additional packagedata fields ending in the package manager (if you use them only with buildhistory or packagedata) with:
PACKAGE_ADD_METADATA_RPM = "" PACKAGE_ADD_METADATA_IPK = "" PACKAGE_ADD_METADATA_DEP = ""

---
v2: fix build when RPMBUILD_EXTRA_PARAMS isn't set

 meta/classes-global/package_rpm.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes-global/package_rpm.bbclass +2 -0
index 819ee50278..5c346447e8 100644
@@ -683,6 +683,7 @@ python do_package_rpm () {
     # Setup the rpmbuild arguments...
     rpmbuild = d.getVar('RPMBUILD')
     rpmbuild_compmode = d.getVar('RPMBUILD_COMPMODE')
+    rpmbuild_extra_params = d.getVar('RPMBUILD_EXTRA_PARAMS') or ""
 
     # Too many places in dnf stack assume that arch-independent packages are "noarch".
     # Let's not fight against this.
@@ -724,6 +725,7 @@ python do_package_rpm () {
     cmd = cmd + " --define '_use_weak_usergroup_deps 1'"
     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') + "'"
Signature · 1 line
2.43.0