#1045 WIP: Add discussion of macro names beginning with underscores.
Opened 9 months ago by tibbs. Modified 9 months ago
tibbs/packaging-committee underscores  into  master

@@ -1069,7 +1069,20 @@ 

  * The package must be consistent. For any given path, within the same spec, use either a hard-coded path or a macro, not a combination of the two.

  * %\{_libdir} must always be used for binary libraries due to multi-lib, you may not substitute a hard-coded path.

  

- Macro forms of system executables SHOULD NOT be used except when there is a need to allow the location of those executables to be configurable. For example, `+rm+` should be used in preference to `+%{__rm}+`, but `+%{__python3}+` is acceptable.

+ Macros with names beginning with underscores

This imples two or more underscores, right?
Maybe "2+" should be explicit. One underscore is fine (c.f. _bindir, _libdir, etc.), right?

+ are generally considered to be implementation details internal to RPM

+ and its associated macro packages

+ and SHOULD NOT be referenced in specfiles

+ except to set their values in order to influence RPM behavior.

+ This implies that macro forms of system executables SHOULD NOT be used.

+ For example, `+rm+` should be used in preference to `+%{__rm}+`.

+ However, in some cases needed data are simply not provided

+ under names which are not prefixed with underscores.

+ If that is the case, the macro named with leading underscores MAY be used.

+ Authors of macro packages are encouraged

+ to avoid using leading underscores

+ when naming macros which are intended to be used in specfiles

+ (as opposed to being set).

  

  Having macros in a Source: or Patch: line is a matter of style. Some people enjoy the ready readability of a source line without macros. Others prefer the ease of updating for new versions when macros are used. In all cases, remember to be consistent in your spec file and verify that the URLs you list are valid. spectool (from the rpmdevtools package) can aid you in checking that whether the URL contains macros or not.

  

This extends the existing mention of macro forms of system executables.

I wanted to capture the rule that you shouldn't be using underscored macro names unless it is to set them to influence RPM behavior, so I tried to extend the existing rule about not using things like %__rm. I'm having trouble with the phrasing so any suggestions are appreciated.

Metadata Update from @tibbs:
- Pull-request tagged with: meeting

9 months ago

What about

However, in some cases it might not be possible to avoid using a macro prefixed with underscores.
If that is the case, the macro named with leading underscores MAY be used.

Or even:

The packaging committee would like to be notified of such cases.

This imples two or more underscores, right?
Maybe "2+" should be explicit. One underscore is fine (c.f. _bindir, _libdir, etc.), right?

Yes, that was one of the questions I needed to ask in the meeting. The consensus was to limit to 2+ underscores but I have not yet reworked the PR.