redhat-rpm-config/macros.fedora-misc-srpm

58 lines
2.3 KiB
Plaintext
Raw Normal View History

# Some miscellaneous Fedora-related macros, intended to be used at rpmbuild -bs
# stage
2016-04-12 02:41:45 +00:00
# A directory for rpm macros
%rpmmacrodir /usr/lib/rpm/macros.d
# A directory for appdata metainfo. This has changed between releases so a
# macro is useful.
%_metainfodir %{_datadir}/metainfo
# A directory for SWID tag files describing the installation
%_swidtagdir %{_prefix}/lib/swidtag/fedoraproject.org
2018-11-08 18:21:06 +00:00
# A helper to apply the fedora.wordwrap filter to the content of an rpm
# variable, and print the result. Optional parameter:
# -v <variable_name> (default value: _description)
# Putting multiple lines of UTF-8 text inside a variable is usually
# accomplished with a %%{expand: some_text}.
%wordwrap(v:) %{lua:
local fedora = require "fedora.common"
local variable = "%{" .. rpm.expand("%{-v*}%{!-v:_description}") .. "}"
print(fedora.wordwrap(variable))
}
# A wrapper around Name: and %package that abstracts their quirks from
# packagers and macros. Its behavior is controled by the %{source_name}
# global variable:
#  when %{source_name} is not set, the first call to %new_package will
# create a Name: block and set %{source_name} to the %{name} of this
# block.
#  when %{source_name} is set:
#  a call to %new_package with no arguments creates:
# Name: %{source_name}
# otherwise, a call to %new_package creates the corresponding:
# %package…
# line, unless the resulting %{name} matches %{source_name}. In that
# case it creates
# Name: %{source_name}
# as before.
# Arguments:
# -n and %1 like %package
# -v to print the variables %new_package sets directly.
# The intended use-case it to simplify coordination between macros that
# create subpackages, make it easy for packagers to declare which of the
# macro-created packages owns the SRPM, and make %{source_name} available
# within spec files and not just as a dnf synthetic variable.
# Unlike %{name} %{source_name} matches the SRPM name regardless of its
# location within the spec file.
%new_package(n:v) %{lua:
local fedora = require "fedora.common"
local pkg_name = fedora.readflag("n")
local verbose = fedora.hasflag("v")
local name_suffix = fedora.read("1")
local source_name = fedora.read("source_name")
local first = not ( fedora.read("name") or fedora.read("currentname") )
fedora.new_package(source_name, pkg_name, name_suffix, first, verbose)
}