redhat-rpm-config/macros.fedora-misc-srpm
Nicolas Mailhot a52af8dced new_package: create basic SRPM header as fallback
Make SRPM handover between macros even more graceful and reliable by auto-creating
a basic SRPM header before attempting declaration of a different sub-package.

With this change things will just work as long as the default %{source_name}
%{source_summary} and %{source_description} are set by something to sensible values.
2020-05-29 08:33:19 +02:00

58 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Some miscellaneous Fedora-related macros, intended to be used at rpmbuild -bs
# stage
# 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
# 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)
}