-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFE: add variable named scoping to rpm #1150
Comments
We had this up to rpm 4.14 (all macros being local to the surrounding %{} scope), and the only thing it did was create endless confusion. Okay, buggy implementation didn't help, but there's no way we're going back to that mess. Remember the "%define is evil, everybody must use %global" touting in Fedora? That's where it comes from: I have been entertaining a voluntary local scope for macros though, quite simply |
Also, note that even in >= 4.14, macros (not variables) do have a scope: inside parametric macros, all %defines are local. |
Thanks for the feedback! It makes me realise, that I forgot to emphasise things that were obvious to me (as a packager). A scope needs an explicit name/anchor to be useful packaging side. It’s not a local vs global thing, it’s a “I do build things for context X now” and an later “I do checks for the same context X”, etc. Because a spec is not structured by subpackages, it is structured by phases, so at each phase you need to load and work with the same variables. Without an anchor to load the correct set of variables, you will make mistakes and things will fail (badly). With a named scope thing you could do things like
And each autosetup call only sees the set of variables corresponding to its own scope, and things just work without needing to find unique variable names and trying to pass them to %autosetup without mistakes. It could also enable things like
So, a very basic need, that is kludged today via -n flags, special Tags, an repeated argument passing at all steps of the spec. Of course that makes the whole |
Oh. I'm afraid this falls into the ponies department, at least in the realm of the existing spec machinery. |
Well, if it existed I would not request it :) It is part of adapting rpm to today’s software projects, that require more subpackaging and more subpackaging context than traditional |
The point is, this resembles #573 more than just a little, and is in the ponies department for the same reason: it's not possible to retrofit sanity and order into the existing spec tangle. |
Even you you do not touch the existing spec tangle, we need to produce new spec tangles all the time, so what can rpm do to make the new spec tangles more sane? State of upstream projects is not frozen, tooling needs to grow like the projects it processes. |
Coming across this again - nope. Understanding what happens where and when across the boundary between macros and build scriptlets is hard enough as it is, adding namespaces and scopes would only make it so much worse. Judging by the examples given, the idea is to better support multiple different projects from a single spec. |
Right now a lot of things need special tags in rpm just because they have a specific (usual subpackage) scope, and can be declared in multiple scopes
Please add a generic construct to specify the scope of a set of variable, so those special Tag constructs can be ultimately replaced by easy to manipulate bog standard rpm variables
IE something like
scopes should nest: setting a variable sets it for the inner scope, reading a variable cascades from the inner to the outer scope, till it finds a value for the variable name
The text was updated successfully, but these errors were encountered: