[arch-projects] [devtools] uses MAKEFLAGS (+others) from /etc/makepkg.conf not /usr/share/devtools/

Eli Schwartz eschwartz at archlinux.org
Thu Feb 7 17:15:35 UTC 2019


On 2/7/19 6:14 AM, james harvey via arch-projects wrote:
> I got extremely confused when I accidentally found out that the
> MAKEFLAGS that is needed to be set for parallel building using
> devtools is the one in "/etc/makepkg.conf", instead of one like
> "/usr/share/devtools/makepkg-x86_64.conf".
> 
> Turns out this is because "makechrootpkg"::20180531-4::638 is:
> 
>    load_vars /etc/makepkg.conf
> 
> load_vars() only reads "{SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER",
> so without me having set any of the others, it turns out the only
> variable it uses from /etc is MAKEFLAGS.
> 
> For me, I think this is the only makepkg/pacman variable in an entire
> devtools run that isn't out of /usr/share/devtools, since "archbuild"
> gives those to "mkarchroot" and "arch-nspawn... pacman -Syu", and they
> are copied into "/var/lib/archbuild/extra-x86_64/root/etc/" for
> anything ran in the chroot.
> 
> Should this be fixed? 

No, the purpose of makechrootpkg is to isolate builds. The explicit
intent is that makechrootpkg *MUST NOT* respect makepkg.conf from the
host in order to change the output of a package. CFLAGS change the
output of a package -- imagine how completely horrible it would be if
one used CFLAGS="-march=native" on the host machine, and that leaked
into the clean chroot build and got published to a public repository.

makechrootpkg uses makepkg.conf just like makepkg does. The content of
the copydir is meant to be completely opaque -- you're not supposed to
think about it or acknowledge it exists, unless you're attempting to
develop on the script itself.
The difference between makepkg and makechrootpkg is that the latter only
respects:
- the *DEST options, which simply control what is bind-mounted into the
  chroot,
- MAKEFLAGS, which does not change the output of a package, and
- PACKAGER which is part of the pacman -Qi metadata and by definition
  needs to be set per packager.

Please note the help output for makechrootpkg:

```
$ 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.
[...]
```

> I originally thought of a new "makechrootpkg
> -M" option, but I think it could instead run:
> 
>    load_vars ${copydir}/etc/makepkg.conf
> 
> If not, should "/usr/share/devtools/makepkg-x86_64.conf" be updated
> with a comment where those variables are, to say they're actually used
> out of "/etc/makepkg.conf"?

Now this confuses me -- what do you need to load vars from the copydir
for? makepkg reads this on its own, makechrootpkg is just meant to copy
select variables *into* the ${copydir}/etc/makepkg.conf

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/arch-projects/attachments/20190207/943b3c69/attachment-0001.asc>


More information about the arch-projects mailing list