diff mbox series

[2/2] package_rpm: add RPMBUILD_EXTRA_PARAMS variable

Message ID 20240202132434.1787053-2-martin.jansa@gmail.com
State Accepted, archived
Commit 31030e7a19a27ad424b997fad36ee4f633ce0d63
Headers show
Series [1/2] package_manager: ipk: add OPKG_MAKE_INDEX_EXTRA_PARAMS variable | expand

Commit Message

Martin Jansa Feb. 2, 2024, 1:24 p.m. UTC
* 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 = ""

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
 meta/classes-global/package_rpm.bbclass | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alexandre Belloni Feb. 2, 2024, 4:44 p.m. UTC | #1
On 02/02/2024 14:24:34+0100, Martin Jansa wrote:
> * 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 = ""
> 
> Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
> ---
>  meta/classes-global/package_rpm.bbclass | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
> index 819ee50278..f932d2c928 100644
> --- a/meta/classes-global/package_rpm.bbclass
> +++ b/meta/classes-global/package_rpm.bbclass
> @@ -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


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

>      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') + "'"
> -- 
> 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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index 819ee50278..f932d2c928 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -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') + "'"