> This is mixing two separate issues. The one originally discussed here is
> about RPM respecting the config/macro files in the target root when
> called with --root. Populating the root with the desired configuration
> is a then a separate matter and one that would need to be discussed on
> fedora-devel or similar channels.

You are right.  I just wanted to clearly describe the intentions I have.

> I wonder if the --macros option (or its API equivalent in
> include/rpm/rpmmacro.h) could be used then?

Now when (I think) I understand how things work, I believe yes.  Even
though it is not convenient for use.

> What I meant was macro configuration, i.e. --macros. That takes a
> colon-separated list of paths and defaults to this (line breaks are
> mine):

Is this "macro path" hard-coded into the RPM binary, or does it depend on
some configuration file, too?  No matter which, the path seems to be
a distribution-specific list.

> That's why I said you'd need to supply all the desired files yourself
> when using this CLI option as there's no way to just prepend/append
> paths to it.

This makes sense.

No matter if Mock or DNF or even RPM would be responsible for overriding
--macros when using --root, we need to be able detect the appropriate path
for the target chroot.  Being distro-specific, we can't tell it in
advance.  IOW we override *host's RPM macro path* with *chroot's RPM macro
path*.

Is there a way to tell the chroot's *macro path*?  Could RPM bake it
somewhere as a data file ideally?

>> $ rootdir=$(mktemp -d)
>> dnf5 --installroot "$rootdir" install rpm-config --use-host-config
>> dnf5 --installroot "$rootdir" install @buildsys-build
>
> Out of curiosity, though, does the second dnf5 command already work the
> way you want, or was that just your proposal for how it could work?

The later. The second command still uses host's configuration.

> If DNF already works this way, that means it does perform some kind of
> RPM isolation by itself (by calling RPM in a chroot/namespace) and thus
> adding an option like --use-installroot-config to DNF should be fairly
> easy.

Unfortunately this is not the case.  I'm afraid someone needs to design
config-override mechanism (and this ticket doesn't seem to be worst place
to do it :-)).

> Just to illustrate better how one could use this (in order to achieve your 
> original objective):

Thank you, I think the outer RPM wrapper could set `--macros`.  The problem is
to minimize the guesswork, i.e. we shouldn't set `--macros` blindly.  Ideas?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2623#issuecomment-1778650411
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/2623/1778650...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to