2020-04-21 17:39:15 +00:00
|
|
|
|
# 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
|
2018-04-20 17:05:38 +00:00
|
|
|
|
|
|
|
|
|
# A directory for appdata metainfo. This has changed between releases so a
|
|
|
|
|
# macro is useful.
|
|
|
|
|
%_metainfodir %{_datadir}/metainfo
|
2018-10-11 09:29:00 +00:00
|
|
|
|
|
|
|
|
|
# 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))
|
|
|
|
|
}
|
2020-04-21 17:39:15 +00:00
|
|
|
|
|
|
|
|
|
# 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 source_name = rpm.expand("%{?source_name}")
|
|
|
|
|
local pkg_name = rpm.expand("%{-n*}")
|
|
|
|
|
local name_suffix = rpm.expand("%{?1}")
|
|
|
|
|
local previous_name = rpm.expand("%{?name}")
|
|
|
|
|
local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
|
|
fedora.new_package(source_name, pkg_name, name_suffix, previous_name, verbose)
|
|
|
|
|
}
|