Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-06 Thread Jeff Johnson
RPM uses macros instead of envvars to increase reproducibility of builds.

How rpm is configured, and how rpmbuild is invoked, are matters that you need 
to take up with build systems. That would also be true if envvar's were used 
instead of macros.

Note that there is (or at least was) a 3rd way to change macros to load while 
building, using a macro files directive in rpmrc configuration. I dunno whether 
that mechanism is still supported or recommended.

In summary, you now have 3 mechanisms, 2 of which permit patterns, to customize 
rpmbuild to taste.

You need to address further questions with build system maintainers, not rpm.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370917574___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-06 Thread Jeff Johnson
Alternatively, choose known file names, and use a %load for each file in a spec 
file.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370833625___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-06 Thread Jeff Johnson
Then invoke rpmbuild with --macros, appending your patterns at the end of the 
colon separated list.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370831841___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-06 Thread Vít Ondruch
I am looking for a way to tell RPM that there might be some paths which might 
contain arbitrary macro files. If such files are located, they should be loaded 
by RPM.

IOW given there is metapackage like this \[[1]\] and I have installed 
rh-ruby22-runtime package and I call ```scl enable rh-ruby22 bash```, in this 
environment, I'd like RPM to be able to pickup macro files which might be 
located in ```/opt/rh/rh-ruby22/root/urs/lib/rpm/macros.d/``` directory.

[1]: 
https://copr-be.cloud.fedoraproject.org/results/rhscl/rh-ruby22-el7/epel-7-x86_64/rh-ruby22-2.0-6.el7/

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370796366___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-06 Thread Jeff Johnson
What exactly are you looking for?

You have yet to post any example here that does not include a pattern when the 
documentation for %load explicitly says "file".

Have you tried strace to verify that rpm is trying to load a file?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370786636___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-06 Thread Vít Ondruch
I am not surprised at all that the wildcard is not supported. I am just 
surprised I am suggested to use ```%load``` where it is not usable in its 
current form.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370702007___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Jeff Johnson
Try removing the leading '?', and note that the added documentation explicitly 
says "file" not pattern.

You can verify the load (or attempt) by using "strace -e open"

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370540267___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Vít Ondruch
Of course, that was just test. So I did different one:

~~~
$ git diff
diff --git a/ruby.spec b/ruby.spec
index c9ff8dc..ecc5e93 100644
--- a/ruby.spec
+++ b/ruby.spec
@@ -102,8 +102,7 @@ Source14: test_systemtap.rb
 
 # The load directive is supported since RPM 4.12, i.e. F21+. The build process
 # fails on older Fedoras.
-%{?load:%{SOURCE4}}
-%{?load:%{SOURCE5}}
+%{?load:%{dirname:%{SOURCE4}}/macros.*}
 
 # Fix ruby_version abuse.
 # https://bugs.ruby-lang.org/issues/11002
@@ -520,6 +519,8 @@ HTTP.
 
 
 %prep
+echo "%{dirname:%{SOURCE4}}/macros.*"
+
 %setup -q -n %{ruby_archive}
 
 # Remove bundled libraries to be sure they are not used.
~~~

This does not load anything.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370469400___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread ニール・ゴンパ
```
+%{?load:%{_rpmmacrodir}/macros.*}
```
This is redundant... RPM already does this...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370468428___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Vít Ondruch
This passes:

~~~
$ git diff
diff --git a/ruby.spec b/ruby.spec
index c9ff8dc..3748781 100644
--- a/ruby.spec
+++ b/ruby.spec
@@ -104,6 +104,7 @@ Source14: test_systemtap.rb
 # fails on older Fedoras.
 %{?load:%{SOURCE4}}
 %{?load:%{SOURCE5}}
+%{?load:%{_rpmmacrodir}/macros.*}
 
 # Fix ruby_version abuse.
 # https://bugs.ruby-lang.org/issues/11002
~~~

But I am not really sure what is the result, if the macros got loaded :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370465021___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Vít Ondruch
Just quick test:

~~~
$ git diff
diff --git a/ruby.spec b/ruby.spec
index c9ff8dc..fc2e68b 100644
--- a/ruby.spec
+++ b/ruby.spec
@@ -104,6 +104,7 @@ Source14: test_systemtap.rb
 # fails on older Fedoras.
 %{?load:%{SOURCE4}}
 %{?load:%{SOURCE5}}
+%{load:%{_rpmmacrodir}/*}
 
 # Fix ruby_version abuse.
 # https://bugs.ruby-lang.org/issues/11002

$ LANG=C.UTF-8 fedpkg srpm 
error: failed to load macro file /usr/lib/rpm/macros.d/*error: line 107: 
%{load:%{_rpmmacrodir}/*}

error: query of specfile /home/vondruch/fedora-scm/own/ruby/ruby.spec failed, 
can't parse

Could not execute srpm: Could not get n-v-r-e from '\n\n'
~~~

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370463587___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Vít Ondruch
Ok, so I can imagine I put this into every SCL meta package, but then I have a 
few questions.

* Does the load macro support the wild cards?
* What happens if there is no such macro file? Does it fail or just continue?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370462695___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread ニール・ゴンパ
@voxik No, no no. You can put the macros wherever, just have a `%{load:..}` 
directive that points to it.

If I remember correctly, you can also do something like 
`%{load:/opt///rpm/macros.d/macros.*}` to load it.

However, you have to be careful, since if the macros don't exist, the spec will 
just break. So what you can do is control it with an `%is_scl` macro that turns 
it on.

Something like this:

```
%{?is_scl:%{load:/opt/fedora/ruby99/rpm/macros.d/macros.*}}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370460367___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Vít Ondruch
I am disappointed. Many people calls SCL being big hack, but you won't make it 
any easier :(

So if I read it correctly, the suggestion is that scl-utils should put 
something into ```%{_rpmmacrodir}``` (please note that the collection itself 
are generally not allowed to put anything outside their root directory), which 
will be able to iterate through SCL ```/opt//``` 
directories and load the macros from there. May be I just don't have enough 
imagination to see better solution.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370456519___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Panu Matilainen
I guess this was always more a matter of missing documentation than missing 
feature.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-370447877___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2018-03-05 Thread Panu Matilainen
Closed #363.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#event-1504309831___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2017-11-28 Thread Panu Matilainen
Doh... Well it's there now: 
https://github.com/rpm-software-management/rpm-web/commit/87e2b6ffa451593a4077570f26182c2bb3dbe440

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-347515892___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2017-11-28 Thread ニール・ゴンパ
@khardix It's not in the website, but it's in the documentation generated by 
rpm itself: 
https://github.com/rpm-software-management/rpm/blob/master/doc/manual/macros#L91

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-347514076___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2017-11-28 Thread Jan Staněk
@n3npq @Conan-Kudo Thanks a lot for pointing that out – I kind-of feel like I 
should RTFM more .

> Have you thought about using the %{load: in the spec to load extra macros?

@Conan-Kudo: This might again be just search issue, but could you point me to 
the documentation of the `%{load:...}` directive? I cannot seem to find it on 
the rpm.org page…

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-347482688___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2017-11-27 Thread Vít Ondruch
@n3npq Good to see that extending RPM to support env variable shouldn't be 
hard, since RPM has the --macros CLI option alrady.

@Conan-Kudo It might be risky, but we are doing it anyway. This is request to 
do it a bit better way then we are doing it now. It would even improve the 
situation, since currently the macros are placed in ```/etc/rpm``` and are 
always loaded. If there was support for env variable, they could be loaded just 
when the SCL is enabled.

But actually, if scl-utils installed something which could do the ```%{load 
...``` as you propose across all the SCL directories, that could do the job as 
well. Nevertheless, that would probably require some LUA and I am not sure the 
result would be better.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-347124153___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Configurable macro file search path(s) (#363)

2017-11-24 Thread Jeff Johnson
Um, this simply isn't true.

RPM has always searched multiple directories for macro definition files.

See also the --macros CLI option (which takes a colon separated set of paths to 
load) to override the default value for macro search paths.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/363#issuecomment-346912506___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint