It's possible in Lua of course, the above was to point out a way to do it
*without*, because not everybody is content with Lua.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1155#issuecomment-1369490067
You are receiving this because
What about rewriting the macro in Lua and stashing the result in a Lua global
variable?
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1155#issuecomment-1369167626
You are receiving this because you are subscribed to this thread.
FWIW, a simple and generic way to implement this on macro level is to redefine
the macro as a global on first evaluation, eg:
> %python3_sitearch %{global python3_sitearch %(RPM_BUILD_ROOT= %{__python3}
> -Esc "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase':
>
Yeah, %define with options is what I'd really like (I think I even mentioned
somewhere surrounding the pending %literal).
In macro files the name limitation could be abused for similar effect by adding
special characters in the front of the name. AIUI rpm5 used "." to denote a
read-only
Well, we don't need to allow %global.
Anyway, let's move a step back and talk about this issue. This is about one
shot macros. Implementation wise this is not hard, it's more a question of
syntax.
It would be nice to have the following options:
- literal: do not expand the macro when using it
There are other downsides too, such as arbitrary side-effects and code
execution on load (as opposed to time of use).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
Crazy thought: we could allow to use %define/%global in the macro file, as
those are illegal macro names. I.e. we could allow this:
```
%foo hello
%define bar world
```
(rpm internally somewhat rewrites the %foo to %define foo anyway)
Then we could also allow
```
%undefine foo
```
which is
Well yes, people occasionally get confused about that. The difference is a big
one though, its like comparing a shell script with an ini file. Both have their
places.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
First seeing spec file and then trying to move some macros into macros file, it
was very confusing, I can tell you. From packager POV, the macro file is the
same as spec file, but you don't write `%global` everywhere for some unknown
reason. Also the difference between `%import` and `%load`
Um. And use what instead? The spec file format? Whose parser is the one of the
most compilicated and loathed piece of code in rpm and would be difficult to
lift out of librpmbuild to put it mildly, and slow every rpm startup in the
process?
In contrast, the macro file format is a nice,
Is there any benefit in having macro files? Wouldn't be better to deprecate
them instead?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
Some macros are really expensive to expand, notorious examples include
python/perl/etc related macros that invoke the interpreter to fish out a
configuration path or such. When these are expanded repeatedly, it really adds
up.
In a spec one can use %global to achieve this, but that's not
12 matches
Mail list logo