RFE: %{_system_bindir} and such macro #2766
Replies: 22 comments
-
this would also help with cases where people define their own macro, for example |
Beta Was this translation helpful? Give feedback.
-
This just reveals how redefining of %_bindir (or I guess more correctly they're redefining %_prefix) is not an ideal solution to the problem they're facing. I honestly have no problem with specifying a full path in a build dependency in the case that you can't for some reason specify a package dependency, but the problem does go beyond that. Unfortunately I don't see any general solution besides what's being proposed here: different prefixes and path macros defined from them for different contexts. Adding a "_system" seems as logical as any other. I just hope that this kind of thing wouldn't get mass-pushed into packages and instead used only where it's actually necessary. |
Beta Was this translation helpful? Give feedback.
-
I'm not opposed to this proposal, but it does seem perhaps like overcomplicating things. Do we have examples where the %_system* macros would differ from the expected FHS values and it would matter? %_libdir is probably the most variable thing across different systems, but BuildRequires: %_libdir is not common. The actual %meson change @ignatenkobrain landed substitutes Meson's bindir into the macro file (https://src.fedoraproject.org/rpms/meson/c/795680bbd10068673580261e134e2f4fbac4072d?branch=master) - which IMO is better tham %_system_bindir. |
Beta Was this translation helpful? Give feedback.
-
Yes, and I'm not happy about this because every distribution would have to carry such sed line. |
Beta Was this translation helpful? Give feedback.
-
Just FTR, there is already precedent in software collections, where |
Beta Was this translation helpful? Give feedback.
-
agree, |
Beta Was this translation helpful? Give feedback.
-
I do prefer "root" over "system" as it's both more precise and generic. |
Beta Was this translation helpful? Give feedback.
-
An alternative approach: let's accept the fact that %_bindir=/usr/bin is here to stay. Using a macro for "system binaries directory" is a legacy of old times and we can just as well use the fixed path of "/usr/bin" for that everywhere. (Using a macro for "where should I install my binaries", which can be /usr/bin or something else in case of flatpaks, is a different story and is OK.)
I disagree. It's legible and perfectly fine. The system is not going to be installed in a different location. |
Beta Was this translation helpful? Give feedback.
-
I'm leaning more towards what @keszybz suggests above, which is that we need to clarify the semantics of these path-based macros in the first place. Fedora in particular prefaces the relevant section with the following sentence (emphasis mine):
From a packager's point of view, there are two kinds of paths:
It really is more of a philosophical question. Adding a collection of |
Beta Was this translation helpful? Give feedback.
-
I don't care that much what the prefix is, but this kind of macros was essential for SCLs, which allowed to have one source package, but the build configuration changed the destination. In this scenario, there really needs to be distinction between files from system or from some alternative destination. And I believe the same applies to Flatpak. But if you want to have philosophical discussion, then don't forget that rpmbuild on itself is using this concept, where it is necessary to distinguish between content from system and from |
Beta Was this translation helpful? Give feedback.
-
Which is what I'm saying. The distinction already exists, you either use the macro (e.g. in The
See above. |
Beta Was this translation helpful? Give feedback.
-
In yet another words, AIUI, the two reasons we have the path macros are:
The only advantage of having such |
Beta Was this translation helpful? Give feedback.
-
If this happens, then yes, the (hypothetical) distribution may also want to provide such a set of Overriding the default |
Beta Was this translation helpful? Give feedback.
-
Yet another way to put it: RPM providing a set of The reality is, the reason why this is needed is technology-specific, i.e. Flatpak or SCL in this case. Therefore, I think those stacks should also provide the alternative macros (which is what SCL already does). |
Beta Was this translation helpful? Give feedback.
-
The thing is that I'll be fine if RPM does not provide any BTW I also agree that having available "pre-override" variants of macros might be nice from time to time 😉 |
Beta Was this translation helpful? Give feedback.
-
Agreed on that one. I'm not opposed to the idea of making the packaging job easier and more convenient, of course. In fact that's actually one of our goals on the roadmap (under the rather grand and ambiguous "hands-free packaging" umbrella). In this case, the discussion is more about the "where do we do this" than it is about "if". RPM needs to stay distro-agnostic but maybe there's some underlying pattern here.
Yup, seems like we've (partially) identified that pattern 😄 |
Beta Was this translation helpful? Give feedback.
-
I generally agree with the rest of the discussion, but I want to reply to this point in particular: As far as I'm concerned, such macros to "save typing" are not worth using and should not be recommended at all. |
Beta Was this translation helpful? Give feedback.
-
Actually, now that I really think about it, I must agree with that, too 😄 It might have been one of the motivations originally (I have no facts to back up that claim, though) but indeed, whenever I'm making dummy packages, I just type out the paths by hand, precisely because of you what you said: It's easier to touch-type without reaching for those special chars, and it's easier to not have to consult the table (because I typically forget the macro names too). |
Beta Was this translation helpful? Give feedback.
-
That said, I don't think they're completely arbitrary, the names have (most likely) been copied from this GNU standard: |
Beta Was this translation helpful? Give feedback.
-
It actually cites the source: Line 960 in 6714ec7 |
Beta Was this translation helpful? Give feedback.
-
And yeah, the point of those macros is NOT to make it easier to type. They're there for flexibility. But, that "few simple defines" doesn't hold in practise because these macros are ambiguous: do they refer to the system or the package being built? Traditionally these are the same thing, but it falls apart with Flatpak, SCL and so on, and changing the prefix can and probably does break all manner of other helpers which just slavishly use the macros as alleged system level paths. And hence we have this ticket. As with any ambiguity, the fix must start forcing the ambiguity out, and making people choose what they intend. As painful as that sometimes is (looking at you, Python 3) |
Beta Was this translation helpful? Give feedback.
-
The distinction of refer-to-system and refer-to-being-built is simple when describing a single package. But when we build a package which delivers a directory and then another package which installs into that directory, a path which was refer-to-being-built in the former package cannot be refer-to-system in the latter package. The refer-to-being-built property spreads transitively against a dependency tree. Where does the spread ends? Where the packaged stacks want. That's the problem: it's specific to a stack. And that makes me feel that no single macro can satisfy them all. |
Beta Was this translation helpful? Give feedback.
-
When people build with RPMs as part of flatpaks, they are changing %_bindir to /app/whatsoever which is entirely valid case. But that means, you can't rely on
BuildRequires: %{_bindir}/foo
. Specifying /usr/bin/foo in BRs is ugly as well (because what if base system is actually installed in different location).I think we need to add some number of
%_system_…
macro which will be set during build of RPM and won't change when you change %_bindir` for example.xref: https://pagure.io/packaging-committee/pull-request/847
Beta Was this translation helpful? Give feedback.
All reactions