Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2021-01-22 Thread Panu Matilainen
We can't possibly allow diverting the low-level `%()` primitive to some 
alternative shell as that is documented to be `/bin/sh` and that's what all the 
other macros are expecting. If one macro starts expecting something else... 
it's not going to end well.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2021-01-22 Thread Panu Matilainen
Closed #1334.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Panu Matilainen
For complicated macros beyond "grab the output of foo -l" scale, Lua is 
recommended. It's by far the fastest scripting language available in rpm 
context, no forks involved to invoke the interpreter or shell etc.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Brian J. Murrell
> if you write compatibly and avoid using any possible extensions there are

You end up having to invoke forty-eleven other tools (awk, sed, grep, tr, etc.) 
to do what bash can do.  :-(

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Panu Matilainen
Well, /bin/sh is by definition *the POSIX shell* - if you avoid using any 
possible extensions there are... (but yes of course accumulating eg bashism is 
creepishm easy :) 

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Brian J. Murrell
Fair enough on being able to invoke various interpreters.  I don't have enough 
interest to lobby for that.

But being able to define the posix shell that `%()` uses would be useful and 
make for more portable specfiles.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Michal Domonkos
@Conan-Kudo, thanks for the pointers, I had the feeling this had been discussed 
in the past.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Panu Matilainen
We don't want embedded Python now any more than we did back then.

A generic way of grabbing output from a command without invoking the shell in 
between I might consider, but nothing that adds language specifics into rpm, 
when we're in the process of getting rid of them alltogether. And I'm dubious 
about the cost of shell invocation being prohibitive when talking in the 
context of Python, Perl and the like - the biggest cost is invoking the 
language itself.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread ニール・ゴンパ
@dmnks There were multiple pull requests to attempt to add `%{python:}` several 
years ago, unfortunately they didn't go anywhere. If we want to add this 
functionality, we should probably start from #190 (which was the last attempt 
to do 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/1334#issuecomment-676196608___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-19 Thread Panu Matilainen
Note that having a *compile-time* way of hardwiring the shell of rpm macro 
engine would be an entirely different thing. But that would mean abandoning 
popen() and doing all the lifting by ourselves, popen() is hardwired to 
/bin/sh. Doesn't seem worth it to me.



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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Panu Matilainen
Making everything configurable is not such a hot idea, really. Making the shell 
macro configurable means you open up the possibility of anybody screwing up the 
core macro primitive. %() equals popen() which means system shell, whatever 
that is, and I believe that should be left alone.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
Yeah, I deleted that comment after realizing I misunderstood @voxik's question, 
but thinking again, it really is not a bad idea at all! It would be easier than 
having to redefine `%_macroshell` (or whatever we'd call it) and also cleaner, 
as you say. It would also get  rid of the problem with "how do we pass the 
script body into a non-shell-like interpreter" that I mentioned above.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
I'm yet to understand if there are any security implications by allowing to 
redefine the shell in a macro, though. But we already allow that for building 
anyway, and building a spec file is no different from running a regular shell 
script after all (you should audit the spec file before doing so).

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
Oh, I think I misunderstood. As @brianjmurrell said above, any interpreter 
would work, yes :)

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
> This is not unlike [setting SHELL in 
> Makefiles](https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html).

+1

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
@voxik That's an interesting idea. You could then do something like `%(ruby: 
...)` or `%(python: ...)` or what have you. Sounds cool. Not sure about the 
impact of this in a broader sense, but I don't see any reason it couldn't be 
done.

That said, doing something just because "we can" doesn't always translate well 
into the maintenance side of things :) But if there are real-life use cases 
that would be improved with this, I think we'd open for that.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Brian J. Murrell
@voxik I can't see why Ruby (or python, or awk, or any other interpreter) would 
not work.  As for _supported_, that's not my call.

But as you point out, this does allow the spec writer more flexibility in what 
interpreter their spec evaluates macros, but does require them to define the 
shell in their spec to get something other than the default `/bin/sh`.

This is not unlike [setting SHELL in 
Makefiles](https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html).

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Vít Ondruch
So will Ruby by supported as well? Not that I really care, but what starts 
simple might provoke questions like these.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
Sure you can. It's worth noting that this RFE is mostly cosmetic; being able to 
redefine a macro shell would allow you to replace all the `%(/usr/bin/bash -c 
"...")` calls with `%(...)`, as well as avoid spawning a shell just to spawn 
another shell.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Vít Ondruch
Can't you run `%(/usr/bin/bash)`?


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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
So something like a `%_macroshell` would be a better idea, perhaps. But I'm not 
sure. I'll need to run a more comprehensive search in the code base first, to 
be able to make an educated guess :)

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Michal Domonkos
@pmatilai good point. That being said, @Conan-Kudo has pointed out that we do 
in fact respect `%_buildshell` in other, non-build related areas as well. Doing 
a quick grep reveals for example:

`macros.in:%__spec_prep_shell%{___build_shell}`

Still, that doesn't mean we should follow that trend, especially given that 
macro processing really is a separate step in the whole spec building process. 
Also, making `%()` suddenly use `%_buildshell` could cause unexpected things to 
happen in spec file which already redefine it. For consistency's sake, on the 
other hand, it would make sense to reuse 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/1334#issuecomment-675472264___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread Panu Matilainen
%_buildshell is for building, %() is macro engine builtin which has no place 
following rpmbuild -level macro definitions.

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


Re: [Rpm-maint] [rpm-software-management/rpm] Define shell to use with %() (#1334)

2020-08-18 Thread ニール・ゴンパ
My understanding is that this should be tied to the `%_buildshell` macro 
already.

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


[Rpm-maint] [rpm-software-management/rpm] Define shell to use with $() (#1334)

2020-08-18 Thread Brian J. Murrell
It would be nice to be able to define which shell should be used with `%()` 
given that `/bin/sh` is not the same shell on all distros.  Additionally having 
to write `$()` macros to the lowest common denominator is just ugly.  It's much 
nicer to just make _bash_ a `BuildRequires:` and be able to write bashisms 
in`%$()`.  Particularly given that most(?) distros do use bash for `/bin/sh` 
and only a few outliers don't.

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