Skip to contentSkip to conversation

package_manager: ipk: add OPKG_MAKE_INDEX_EXTRA_PARAMS variable

PATCH Superseded Martin Jansa 3 participants 6 messages Feb 2, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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

---
 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..c35c90ce42 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')
         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 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 = ""

---
 meta/classes-global/package_rpm.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes-global/package_rpm.bbclass +2 -0
index 819ee50278..f932d2c928 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')
 
     # 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
#2 lore raw

Re: [OE-core] [PATCH 2/2] package_rpm: add RPMBUILD_EXTRA_PARAMS variable

Quoted 45 lines · Martin Jansa

* 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 = ""

---
 meta/classes-global/package_rpm.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes-global/package_rpm.bbclass +1 -0
index 819ee50278..f932d2c928 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')
 
     # Too many places in dnf stack assume that arch-independent packages are "noarch".
     # Let's not fight against this.

meta/classes-global/package_rpm.bbclass python do_package_rpm () { · line 728

Quoted 4 lines
meta/classes-global/package_rpm.bbclass +1 -0
@@ -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

File: 'exec_func_python() autogenerated', lineno: 2, function: <module>

     0001:
 *** 0002:do_package_rpm(d)
     0003:
File: '/home/pokybuild/yocto-worker/meta-aws/build/meta/classes-global/package_rpm.bbclass', lineno: 728, function: do_package_rpm
     0724:    cmd = cmd + " --define '_tmppath " + workdir + "'"
     0725:    cmd = cmd + " --define '_use_weak_usergroup_deps 1'"
     0726:    cmd = cmd + " --define '_passwd_path " + "/completely/bogus/path" + "'"
     0727:    cmd = cmd + " --define '_group_path " + "/completely/bogus/path" + "'"
 *** 0728:    cmd = cmd + rpmbuild_extra_params
     0729:    if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
     0730:        cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
     0731:        cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_RPMOUTDIR') + "'"
     0732:        cmdsrpm = cmdsrpm + " -bs " + outspecfile

Exception: TypeError: can only concatenate str (not "NoneType") to str

Quoted 16 lines
meta/classes-global/package_rpm.bbclass +0 -0
     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 · 11 lines
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194796): https://lists.openembedded.org/g/openembedded-core/message/194796
Mute This Topic: https://lists.openembedded.org/mt/104118974/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw
In reply to Martin Jansa

ACK from me.

It's a little strange that we wouldn't just have a PACKAGE_FEED_PRESERVE_USER_FIELDS variable. But I understand that wouldn't work as well for how the RPM version of this parameter is defined.

Quoted 45 lines · Martin Jansa via lists.openembedded.org

* 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

---
  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 -3
index 8fcbad56aa..c35c90ce42 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')
          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)
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#194795): https://lists.openembedded.org/g/openembedded-core/message/194795
Mute This Topic: https://lists.openembedded.org/mt/104118971/3616788
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 5 lines
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

[email protected]
#4 lore raw

Alex: thanks for review

I'll send v2 shortly, because now while testing without this variable set at all it fails with:
opkg-make-index: error: unrecognized arguments: None
so will add weak assignment to empty before the use.

Quoted 72 lines · Alex Stewart

ACK from me.

It's a little strange that we wouldn't just have a PACKAGE_FEED_PRESERVE_USER_FIELDS variable. But I understand that wouldn't work as well for how the RPM version of this parameter is defined.

Quoted 3 lines · Martin Jansa via lists.openembedded.org

* 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

Review

Quoted 11 lines

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

---
  meta/lib/oe/package_manager/ipk/__init__.py | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/meta/lib/oe/package_manager/ipk/__init__.py

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 18

Quoted 7 lines

index 8fcbad56aa..c35c90ce42 100644

meta/lib/oe/package_manager/ipk/__init__.py +0 -0
@@ -16,6 +16,7 @@ class OpkgIndexer(Indexer):
                       ]
 
          opkg_index_cmd = bb.utils.which(os.getenv('PATH'),

"opkg-make-index")

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 19

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +1 -0
+        opkg_index_cmd_extra_params =

self.d.getVar('OPKG_MAKE_INDEX_EXTRA_PARAMS')

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 21

Quoted 2 lines
meta/lib/oe/package_manager/ipk/__init__.py +0 -0
          if self.d.getVar('PACKAGE_FEED_SIGN') == '1':
              signer = get_signer(self.d,

self.d.getVar('PACKAGE_FEED_GPG_BACKEND'))

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 44

Quoted 6 lines
meta/lib/oe/package_manager/ipk/__init__.py +0 -1
          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' %

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 45

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +0 -1
-                                  (opkg_index_cmd, pkgs_file,

pkgs_file, pkgs_dir))

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 45

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +1 -0
+                index_cmds.add('%s --checksum md5 --checksum sha256 -r

%s -p %s -m %s %s' %

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 46

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +1 -0
+                                  (opkg_index_cmd, pkgs_file,

pkgs_file, pkgs_dir, opkg_index_cmd_extra_params))

Quoted 7 lines
meta/lib/oe/package_manager/ipk/__init__.py +0 -1
                  index_sign_files.add(pkgs_file)
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#194795):

https://lists.openembedded.org/g/openembedded-core/message/194795

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/104118971/3616788
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

[email protected]

#5 lore raw
Quoted 6 lines · Martin Jansa

Alex: thanks for review

I'll send v2 shortly, because now while testing without this variable set at all it fails with:
opkg-make-index: error: unrecognized arguments: None
so will add weak assignment to empty before the use.

Yes, I just hit that one too..

Quoted 77 lines · Alex Stewart
Quoted 57 lines

ACK from me.

It's a little strange that we wouldn't just have a PACKAGE_FEED_PRESERVE_USER_FIELDS variable. But I understand that wouldn't work as well for how the RPM version of this parameter is defined.

Quoted 3 lines · Martin Jansa via lists.openembedded.org

* 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

Review

Quoted 11 lines

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

---
  meta/lib/oe/package_manager/ipk/__init__.py | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/meta/lib/oe/package_manager/ipk/__init__.py

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 18

Quoted 7 lines

index 8fcbad56aa..c35c90ce42 100644

meta/lib/oe/package_manager/ipk/__init__.py +0 -0
@@ -16,6 +16,7 @@ class OpkgIndexer(Indexer):
                       ]
 
          opkg_index_cmd = bb.utils.which(os.getenv('PATH'),

"opkg-make-index")

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 19

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +1 -0
+        opkg_index_cmd_extra_params =

self.d.getVar('OPKG_MAKE_INDEX_EXTRA_PARAMS')

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 21

Quoted 2 lines
meta/lib/oe/package_manager/ipk/__init__.py +0 -0
          if self.d.getVar('PACKAGE_FEED_SIGN') == '1':
              signer = get_signer(self.d,

self.d.getVar('PACKAGE_FEED_GPG_BACKEND'))

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 44

Quoted 6 lines
meta/lib/oe/package_manager/ipk/__init__.py +0 -1
          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' %

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 45

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +0 -1
-                                  (opkg_index_cmd, pkgs_file,

pkgs_file, pkgs_dir))

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 45

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +1 -0
+                index_cmds.add('%s --checksum md5 --checksum sha256 -r

%s -p %s -m %s %s' %

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer): · line 46

Quoted 1 line
meta/lib/oe/package_manager/ipk/__init__.py +1 -0
+                                  (opkg_index_cmd, pkgs_file,

pkgs_file, pkgs_dir, opkg_index_cmd_extra_params))

meta/lib/oe/package_manager/ipk/__init__.py class OpkgIndexer(Indexer):

Quoted 6 lines
meta/lib/oe/package_manager/ipk/__init__.py +0 -0
                  index_sign_files.add(pkgs_file)
 
 
Quoted 8 lines

--
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

[email protected]

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194806): https://lists.openembedded.org/g/openembedded-core/message/194806
Mute This Topic: https://lists.openembedded.org/mt/104118971/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com