Re: [Rpm-maint] [rpm-software-management/rpm] Reset global macro state after each spec query/parse (#1067)

2020-02-11 Thread Igor Gnatenko
@pmatilai funny thing is that somebody recently (yesterday) mentioned this bug 
in the Russian Fedora telegram group and today you come up with the fix :)

Can we also backport this to 4.14?

-- 
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/pull/1067#issuecomment-585072855___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Reset global macro state after each spec query/parse (#1067)

2020-02-11 Thread Panu Matilainen
Parsing a spec, even unsuccessfully, will affect the global macro
state in any number of ways that may affect the following operations
in unpredictable ways. Lacking any saner way to do this, reset the
entire global macro state after each spec parse in rpmspec and spec
query code (rpmbuild already does this) while maintaining possible
cli-specified target and rcfile.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1067

-- Commit Summary --

  * Reset global macro state after each spec query/parse

-- File Changes --

M lib/query.c (7)
M rpmspec.c (12)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1067.patch
https://github.com/rpm-software-management/rpm/pull/1067.diff

-- 
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/pull/1067
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Make parametric macro arguments available as native Lua table (#1063)

2020-02-11 Thread Jason Tibbitts
Oh, this would be so great.

-- 
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/pull/1063#issuecomment-585008636___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Handle Python extras trough reverse requirements encoded in provides (#1061)

2020-02-11 Thread Miro Hrončok
Oh. There would be no way to buildrequire an extra. Is that what you mean? 
That's a problem. 

-- 
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/1061#issuecomment-584926788___
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: Syntax sugar for bconds with inherited defaults (#941)

2020-02-11 Thread Petr Viktorin
My old suggestion was `%bcond  `, with numeric "default" (zero 
for false).
Aside from "inheritance", it might be used instead of 
`%bcond_with`/`%bcond_without`. (Whenever I try to choose one, I have to stop 
and think which one will give me the right default. I don't think I'm alone in 
that.)
```
%bcond some_thing 0
%bcond some_inherited_thing %{with some_thing}
%bcond some_antiinherited_thing %{without some_thing}
```

-- 
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/941#issuecomment-584697721___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Use autodetect for _minimize_writes and _flush_io (#1066)

2020-02-11 Thread Florian Festi
This is a take on #949 as described in 
https://github.com/rpm-software-management/rpm/pull/949#issuecomment-580354653
Original Patch is rebased to have access to the new rpmMacroIsDefined() 
function.
Patches should probably be squashed before merging. Keeped them separate to 
make review easier.
Resolves: #949
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1066

-- Commit Summary --

  * Auto-enable optimizations for non-rotational disks on Linux
  * Use autodetect for _minimize_writes and _flush_io

-- File Changes --

M lib/transaction.c (95)
M macros.in (10)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1066.patch
https://github.com/rpm-software-management/rpm/pull/1066.diff

-- 
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/pull/1066
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add a --salvagedb option to the rpmdb tool (#1042)

2020-02-11 Thread Panu Matilainen
I'm not all that familiar with ndb internals: how is this different to the 
regular --rebuilddb just skipping any headers it finds invalid? Or to turn the 
question around: is there a reason why this could/should not be used on all 
--rebuilddb operations (on ndb)?


-- 
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/pull/1042#issuecomment-584634417___
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: please add a way to get the unexpanded content of a rpm variable (#582)

2020-02-11 Thread Panu Matilainen
...and perhaps there should be that primitive to entirely suppress macro 
expansion (as per the %{literal:...} suggestion in #1049, which simply expands 
to its literal, unexpanded argument. But as literal is a macro type now, maybe 
that should be called %{verbatim:...} instead. Dunno.

-- 
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/582#issuecomment-584596785___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement %{body:...} built-in for retrieving the literal macro body (#1064)

2020-02-11 Thread Panu Matilainen
pmatilai commented on this pull request.



> @@ -72,6 +72,7 @@ to perform useful operations. The current list is
%define ... define a macro
%undefine ...   undefine a macro
%global ... define a macro whose body is available in global context
+   %{body:...} literal body of a macro

See the discussion in #582, the problem with %{verbatim:..} and other similar 
variants is that the argument is ambiguous, whereas the term "body" is 
unambiguous within rpm terminology, including the document in question. The 
description could be better, no disagreement there.

-- 
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/pull/1064#discussion_r377580861___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] CI on rawhide disabled temporarily (#1065)

2020-02-11 Thread Panu Matilainen
Some infrastructure issue is causing CI builds on rawhide failing 
intermittently with "service temporary unavailable" -type errors which go away 
by persistently resubmitting the builds, but this is not productive use of 
anybody's time. So as of now, rawhide CI is disabled until further notice.

-- 
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/1065___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement %{body:...} built-in for retrieving the literal macro body (#1064)

2020-02-11 Thread Vít Ondruch
voxik commented on this pull request.



> @@ -72,6 +72,7 @@ to perform useful operations. The current list is
%define ... define a macro
%undefine ...   undefine a macro
%global ... define a macro whose body is available in global context
+   %{body:...} literal body of a macro

I am sorry, but from the macro name neither from its description I can tell 
what it does. Isn't 'verbatim' more fitting name here?

-- 
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/pull/1064#pullrequestreview-356582402___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement %{body:...} built-in for retrieving the literal macro body (#1064)

2020-02-11 Thread Panu Matilainen
Some open questions:
- Should the argument be expanded first, like doFoo() does? Using the literal 
value has its pros but I guess its cons too.
- Is raising an error on undefined macro a reasonable thing to do? If not, what 
should it do on undefined macros?

I was also tempted to add %{opts:...} which would return the option declaration 
string (if any), but there's no direct way to distinguish between no value (ie 
non-parametric macro) and empty string (parametric macro which doesn't take any 
options) in the return value, so it'd need some other approach.

-- 
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/pull/1064#issuecomment-584583853___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Implement %{body:...} built-in for retrieving the literal macro body (#1064)

2020-02-11 Thread Panu Matilainen
Fixes: #582
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1064

-- Commit Summary --

  * Implement %{body:...} built-in for retrieving the literal macro body

-- File Changes --

M doc/manual/macros (1)
M rpmio/macro.c (14)
M tests/rpmmacro.at (12)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1064.patch
https://github.com/rpm-software-management/rpm/pull/1064.diff

-- 
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/pull/1064
___
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: please add a way to get the unexpanded content of a rpm variable (#582)

2020-02-11 Thread Panu Matilainen
Good question, which I think settles the name as well: the argument is a macro 
name, so it's not the opposite of %{expand:...} at all but a specific thing 
that in rpm terminology is known as the macro body, so why make this any more 
complicated... lets just call it %{body:...} and be done with it.

-- 
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/582#issuecomment-584568890___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Make parametric macro arguments available as native Lua table (#1063)

2020-02-11 Thread Panu Matilainen
RFC only for now: if we do this then we'd really want to export options 
natively to Lua too, and probably some other stuff too.

-- 
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/pull/1063#issuecomment-584564977___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Florian Festi
Merged #1053 into master.

-- 
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/pull/1053#event-3025934733___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Make parametric macro arguments available as native Lua table (#1063)

2020-02-11 Thread Panu Matilainen
Accessing macro arguments via rpm.expand(%1) etc is tedious,
non-intuitive and subject to all sorts of expansion issues. Make
the argument macros available as a native Lua table (named arg
for consistency with -p lua scriptlet arguments) with their
literal values - the arguments are already macro-expanded, so if
further expansion is desired that is entirely up to the caller.

rpmluav indexes unfortunately start at 1, so this leaves out the
%0 macro from the arguments for sanity with the rest of the values.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1063

-- Commit Summary --

  * Make parametric macro arguments available as native Lua table

-- File Changes --

M rpmio/macro.c (32)
M tests/rpmmacro.at (20)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1063.patch
https://github.com/rpm-software-management/rpm/pull/1063.diff

-- 
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/pull/1063
___
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: please add a way to get the unexpanded content of a rpm variable (#582)

2020-02-11 Thread Michael Schroeder
Is the argument a macro name or some generic string? I.e. is it 
`%{body:_builddir}` which should then return ` %{_topdir}/BUILD`? Or is it 
`%{noexpand:%_builddir}` which then should only do one level of expansion? I 
find the latter a bit weird.

-- 
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/582#issuecomment-584551949___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Panu Matilainen
pmatilai commented on this pull request.



> @@ -514,6 +514,22 @@ static ARGV_t runCmd(const char *cmd,
 return output;
 }
 
+static ARGV_t runCall(const char *cmd,
+const char *buildRoot, const char *fn)
+{
+
+ARGV_t output = NULL;
+char *fullcmd = rstrscat(NULL, "%{", cmd, " ", "%{?buildroot:buildroot/}", 
fn, "}", NULL);

The latest version using literal resolves even the % case.

-- 
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/pull/1053#discussion_r377526881___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Panu Matilainen
Updated to use rpmMacroIsParametric() as the API name, tweaks to commit 
message(s).

-- 
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/pull/1053#issuecomment-584549360___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Panu Matilainen
@pmatilai pushed 2 commits.

c2177646458ef20c6d3cfeeddc0fa7ca34c0d50b  Add APIs for testing whether a macro 
is defined and whether its parametric
fc98504d59603014edffa53439b96c793ac11f29  Add support for macro-only dependency 
generators


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1053/files/d301eb41d0ac6cada357f281ff465f2f0b25b63a..fc98504d59603014edffa53439b96c793ac11f29
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Panu Matilainen
pmatilai commented on this pull request.



> @@ -1784,6 +1784,29 @@ rpmDefineMacro(rpmMacroContext mc, const char * macro, 
> int level)
 return rc;
 }
 
+int rpmMacroIsDefined(rpmMacroContext mc, const char *n)
+{
+int defined = 0;
+if ((mc = rpmmctxAcquire(mc)) != NULL) {
+   if (findEntry(mc, n, 0, NULL))
+   defined = 1;
+   rpmmctxRelease(mc);
+}
+return defined;
+}
+
+int rpmMacroIsCallable(rpmMacroContext mc, const char *n)
+{

But okay, I'll update it to use rpmMacroIsParametric(), it's at least more in 
line with our internal terminology than "callable".

-- 
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/pull/1053#discussion_r377518331___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Michael Schroeder
mlschroe approved this pull request.





-- 
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/pull/1053#pullrequestreview-356505622___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Panu Matilainen
pmatilai commented on this pull request.



> @@ -1784,6 +1784,29 @@ rpmDefineMacro(rpmMacroContext mc, const char * macro, 
> int level)
 return rc;
 }
 
+int rpmMacroIsDefined(rpmMacroContext mc, const char *n)
+{
+int defined = 0;
+if ((mc = rpmmctxAcquire(mc)) != NULL) {
+   if (findEntry(mc, n, 0, NULL))
+   defined = 1;
+   rpmmctxRelease(mc);
+}
+return defined;
+}
+
+int rpmMacroIsCallable(rpmMacroContext mc, const char *n)
+{

That seems to answer a different question (ie whether the macro was called with 
parameters or not). 

-- 
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/pull/1053#discussion_r377516660___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Add support for macro-only dependency generators (#1053)

2020-02-11 Thread Michael Schroeder
mlschroe commented on this pull request.



> @@ -1784,6 +1784,29 @@ rpmDefineMacro(rpmMacroContext mc, const char * macro, 
> int level)
 return rc;
 }
 
+int rpmMacroIsDefined(rpmMacroContext mc, const char *n)
+{
+int defined = 0;
+if ((mc = rpmmctxAcquire(mc)) != NULL) {
+   if (findEntry(mc, n, 0, NULL))
+   defined = 1;
+   rpmmctxRelease(mc);
+}
+return defined;
+}
+
+int rpmMacroIsCallable(rpmMacroContext mc, const char *n)
+{

Maybe `rpmMacroHasParameters()`?

-- 
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/pull/1053#discussion_r377514959___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint