FS#64938 - [devtools] makechrootpkg does not honor MAKEFLAGS= exported prior to calling it
Attached to Project:
Arch Linux
Opened by John (graysky) - Sunday, 22 December 2019, 21:49 GMT
Last edited by Kristian (klausenbusk) - Saturday, 03 June 2023, 18:06 GMT
Opened by John (graysky) - Sunday, 22 December 2019, 21:49 GMT
Last edited by Kristian (klausenbusk) - Saturday, 03 June 2023, 18:06 GMT
|
Details
From makechrootpkg -h:
"This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER from makepkg.conf(5), if those variables are not part of the environment." If I understand that correctly, I can use one of three makepkg.conf options for the script or I can define those variables in my environment. I tried exporting desired value for MAKEFLAGS prior to calling the script but it was not picked-up by the script. I had the first line of my PKGBUILD echo $MAKEFLAGS in the example below. Is this expected? export MAKEFLAGS=-j40 makechrootpkg -u -c -r /scratch/.chroot64 ... -j9 |
This task depends upon
Closed by Kristian (klausenbusk)
Saturday, 03 June 2023, 18:06 GMT
Reason for closing: Upstream
Additional comments about closing: Please report upstream if this is still relevant: https://gitlab.archlinux.org/archlinux/d evtools.
Saturday, 03 June 2023, 18:06 GMT
Reason for closing: Upstream
Additional comments about closing: Please report upstream if this is still relevant: https://gitlab.archlinux.org/archlinux/d evtools.
So I have no idea how this could be broken in your environment.
I also made a fresh user and got the same result (ignoring the exported variable). Can you try on your machine? The fast test is to just have the PKGBUILD echo $MAKEFLAGS and then exit:
$ export MAKEFLAGS=-j40
$ echo $MAKEFLAGS
-j40
$ makechrootpkg -u -c -r /scratch/.chroot64
==> Synchronizing chroot copy [/scratch/.chroot64/root] -> [facade]...done
...
==> Starting build()...
-j9
You could add debug prints to the /usr/bin/makechrootpkg script if you like, to figure out where it is being dropped.
https://gist.github.com/graysky2/a5ea7fb7266419524a15d5f584322d29
Line 391 reads /etc/makepkg.conf which seems to overwrite the value I exported?
1) MAKEFLAGS=-j40 makechrootpkg -u -c -r /scratch/.chroot64
or
2) export MAKEFLAGS=-j40 && makechrootpkg -u -c -r /scratch/.chroot64
The update from 20191016 --> 20191212 changed this behavior. With the older version, I could have the value in /etc/makepkg.conf defined AND was able to override via prefixing the call the makechrootpkg (case 1 above). Thanks for your help, eschwartz.
From makechrootpkg -h:
"This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER from makepkg.conf(5), if those variables are not part of the environment."
For example, if I define MAKEFLAGS=-j10 and PACKAGER="system <system@level.conf.com>" in /etc/makepkg.conf and then try to build a PKGBUILD that simply echos these values, I get the expected result:
% makechrootpkg -u -c -r /scratch/.chroot64
...
-j10
system <system@level.conf.com>
However, if I prefix the call the makechrootpkg (or if I export these variables) only the PACKAGER value is overridden, the value for MAKEFLAGS is still read in from /etc/makepkg.conf
% MAKEFLAGS=-j40 PACKAGER="override <over@ride.com>" makechrootpkg -u -c -r /scratch/.chroot64
...
-j10
override <over@ride.com>
Is this the expected behavior or a bug?
Guess whether this is an intended change in devtools...
The load_vars that check for a var being already declared or not was replaced by load_makepkg_config which comes from pacman.
I think its a good idea to behave similar here as makepkg itself behaves, so if we want to change this behavior we should change it in pacman's makepkg.
But I believe its not a bad idea to respect certain env vars over config settings, they should have precedence.