Skip to contentSkip to conversation

package_rpm: pass XZ_THREADS to rpm

PATCH In review Ross Burton 5 participants 8 messages May 26, 2021 – May 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package_rpm: pass XZ_THREADS to rpm

By default RPM uses the number of cores as the number of threads to use, which can result in quite antisocial memory usage.

As we control the macros for compression anyway, we can pass XZ_THREADS to limit the number of threads if needed.

---
 meta/classes/package_rpm.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/package_rpm.bbclass +2 -2
index 84a9a6dd12..86706da842 100644
@@ -684,8 +684,8 @@ python do_package_rpm () {
     cmd = cmd + " --define '_use_internal_dependency_generator 0'"
     cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'"
     cmd = cmd + " --define '_build_id_links none'"
-    cmd = cmd + " --define '_binary_payload w6T.xzdio'"
-    cmd = cmd + " --define '_source_payload w6T.xzdio'"
+    cmd = cmd + " --define '_binary_payload w6T%d.xzdio'" % int(d.getVar("XZ_THREADS"))
+    cmd = cmd + " --define '_source_payload w6T%d.xzdio'" % int(d.getVar("XZ_THREADS"))
     cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'"
     cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'"
     cmd = cmd + " --define '_buildhost reproducible'"
Signature · 1 line
2.25.1
#1 lore raw

What happens if XZ_THREADS isn't set?

Alex

Quoted 37 lines · Ross Burton

By default RPM uses the number of cores as the number of threads to use, which can result in quite antisocial memory usage.

As we control the macros for compression anyway, we can pass XZ_THREADS to limit the number of threads if needed.

---
 meta/classes/package_rpm.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/package_rpm.bbclass +0 -0
index 84a9a6dd12..86706da842 100644
@@ -684,8 +684,8 @@ python do_package_rpm () {
     cmd = cmd + " --define '_use_internal_dependency_generator 0'"
     cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build

0'"

     cmd = cmd + " --define '_build_id_links none'"
meta/classes/package_rpm.bbclass +1 -2
-    cmd = cmd + " --define '_binary_payload w6T.xzdio'"
-    cmd = cmd + " --define '_source_payload w6T.xzdio'"
+    cmd = cmd + " --define '_binary_payload w6T%d.xzdio'" %

int(d.getVar("XZ_THREADS"))
+ cmd = cmd + " --define '_source_payload w6T%d.xzdio'" %
int(d.getVar("XZ_THREADS"))

     cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'"
     cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'"
     cmd = cmd + " --define '_buildhost reproducible'"

--
2.25.1

#2 lore raw
Quoted 1 line · Alexander Kanavin

What  happens if XZ_THREADS isn't set?

It is given a default in bitbake.conf so you'd have to go out of your way to do it...

Cheers,

Richard

#3 lore raw

Hello,

Adding this docs@ mailing list too, because I have a documentation related question...

Quoted 4 lines · Richard Purdie
Quoted 1 line · Alexander Kanavin

What  happens if XZ_THREADS isn't set?

It is given a default in bitbake.conf so you'd have to go out of your way to do it...

This makes me realize that the XZ_ variables defined in bitbake.conf don't appear anywhere in the documentation.

Would it make sense to add them to the documentation too, or would it be overwhelming to document all possible variables, which default values should just work fine?

Cheers,

Michael

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
Quoted 6 lines · Michael Opdenacker

This makes me realize that the XZ_ variables defined in bitbake.conf don't appear anywhere in the documentation.

Would it make sense to add them to the documentation too, or would it be overwhelming to document all possible variables, which default values should just work fine?

This should most likely be documented, albeit maybe only in the reference as it's not really a common tweak.

Ross

#5 lore raw

Hi Ross,

Quoted 10 lines · Ross Burton
Quoted 6 lines · Michael Opdenacker

This makes me realize that the XZ_ variables defined in bitbake.conf don't appear anywhere in the documentation.

Would it make sense to add them to the documentation too, or would it be overwhelming to document all possible variables, which default values should just work fine?

This should most likely be documented, albeit maybe only in the reference as it's not really a common tweak.

Thanks for your guidance. Will do :)

Cheers,

Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw
In reply to Michael Opdenacker
Quoted 11 lines · Michael Opdenacker

Hello,

Adding this docs@ mailing list too, because I have a documentation related question...

Quoted 4 lines · Richard Purdie
Quoted 1 line · Alexander Kanavin

What  happens if XZ_THREADS isn't set?

It is given a default in bitbake.conf so you'd have to go out of your way to do it...

Quoted 6 lines

This makes me realize that the XZ_ variables defined in bitbake.conf don't appear anywhere in the documentation.

Would it make sense to add them to the documentation too, or would it be overwhelming to document all possible variables, which default values should just work fine?

i've actually been pondering this for a while -- the best way to
keep the variables glossary up to date, and here's a thought.

if one notices a single variable missing, and one has time and the
know-how to add that entry to the variables glossary, then submit a patch (as i've done recently, all of which i apparently have to improve. :-)

on the other hand, if one finds a number of closely-related
variables that are all missing -- for which it would make little sense to add just one or two without adding all the rest -- and one is lacking either the time or the expertise to submit an all-encompassing patch to add them all, then submit a bugzilla entry for it:

https://bugzilla.yoctoproject.org/describecomponents.cgi?product=Reference

and perhaps the person or people with the know-how can handle it. at the very least, we'd have a list of what's missing.

i might even add a new product category entry just for this:
"variables glossary". anyway, i think this would be useful just to keep track of what's not there, and allow people to cherry-pick what they'd like to work on.

rday

#7 lore raw

Hi Robert,

Quoted 7 lines · Robert P. J. Day

i've actually been pondering this for a while -- the best way to
keep the variables glossary up to date, and here's a thought.

if one notices a single variable missing, and one has time and the
know-how to add that entry to the variables glossary, then submit a patch (as i've done recently, all of which i apparently have to improve. :-)

Your efforts are much appreciated, and I'm sharing the blame for being a big slow at processing them.

Quoted 9 lines

on the other hand, if one finds a number of closely-related
variables that are all missing -- for which it would make little sense to add just one or two without adding all the rest -- and one is lacking either the time or the expertise to submit an all-encompassing patch to add them all, then submit a bugzilla entry for it:

https://bugzilla.yoctoproject.org/describecomponents.cgi?product=Reference

Quoted 7 lines

and perhaps the person or people with the know-how can handle it. at the very least, we'd have a list of what's missing.

i might even add a new product category entry just for this:
"variables glossary". anyway, i think this would be useful just to keep track of what's not there, and allow people to cherry-pick what they'd like to work on.

This sounds like a good idea.

I asked Michael H. to add one for us, and I'm going to use it very soon!

Thanks again for all your contributions!

Cheers,

Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com