Skip to content
Permalink
Browse files

Build: spec: make %license work even w/ older RPM versions

...not supporting that per se nor if it's worked around by distro-wide
RPM macros.(like EPEL6 does).  This makes the RHEL6 build pass.

It was argued that Lua scripts support is not a guaranteed feature of RPM
and depends on how it is built.  However, there's something to consider:
- RPM coexists with Lua for 12+ years
- Lua scripts are part of RPM's standard macros file for 8+ years
- default is to compile RPM with Lua support
- newer RPM-backed distros started using Lua-based standard convenience
  macros like %autosetup, so there's effectively no way back from Lua
  unless enormous effort is to be spent on the affected packages
and, furthermore:
- upstream's specfile is a reference (that tries to "cater all" on best
  effort basis), not something to be followed rigourously by various
  downstreams
- sustainable clarity > over-conditionalization
- the solution is hacky, by keep in mind RPM applies a similar hack
  internally when supporting %license properly as the authors have
  fallen into their own trap with "License:" tag + pre-existing
  mechanism vs. %license
  • Loading branch information...
jnpkrn committed May 20, 2016
1 parent f58b30d commit a592019fbe88144bc42131b0e20deea96acd6d45
Showing with 11 additions and 2 deletions.
  1. +11 −2 pacemaker.spec.in
@@ -26,8 +26,17 @@
%global py_site %{?python_sitearch}%{!?python_sitearch:%(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%global cman_native 0%{?el6} || (0%{?fedora} > 0 && 0%{?fedora} < 17)

# https://fedoraproject.org/wiki/EPEL:Packaging?rd=Packaging:EPEL#The_.25license_tag
%{!?_licensedir:%global license %doc}
# It's desired to apply "license" macro uniformly in "files" sections below,
# but RPM versions not aware of this new classification normally (re)define it
# to the value of "License:", so following is to ensure the macro definition
# is per expectation only after that tag; solution courtesy of Jason Tibbitts:
# https://pkgs.fedoraproject.org/cgit/rpms/epel-rpm-macros.git/tree/macros.zzz-epel?h=el6&id=e1adcb77b0c05a6c29bc0eb0c4e82113180a0a99#n12
%if !%{defined _licensedir}
%define description %{lua:
rpm.define("license %doc")
print("%description")
}
%endif

# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"

0 comments on commit a592019

Please sign in to comment.
You can’t perform that action at this time.