Use %{expand} and %global

Our packaging guidelines say that %global is preferred, and
with %{expand} the line continuations can be removed.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-02-22 19:27:20 +01:00
parent a0bdca4f3f
commit 4f7d89c5d3

View File

@ -1,5 +1,5 @@
%define glibcsrcdir glibc-2.35.9000-44-g3d9f171bfb
%define glibcversion 2.35.9000
%global glibcsrcdir glibc-2.35.9000-44-g3d9f171bfb
%global glibcversion 2.35.9000
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -84,25 +84,25 @@
##############################################################################
# Any architecture/kernel combination that supports running 32-bit and 64-bit
# code in userspace is considered a biarch arch.
%define biarcharches %{ix86} x86_64 s390 s390x
%global biarcharches %{ix86} x86_64 s390 s390x
# Avoid generating a glibc-headers package on architectures which are
# not biarch.
%ifarch %{biarcharches}
%define need_headers_package 1
%global need_headers_package 1
%if 0%{?rhel} > 0
%define headers_package_name glibc-headers
%global headers_package_name glibc-headers
%else
%ifarch %{ix86} x86_64
%define headers_package_name glibc-headers-x86
%global headers_package_name glibc-headers-x86
%endif
%ifarch s390 s390x
%define headers_package_name glibc-headers-s390
%global headers_package_name glibc-headers-s390
%endif
%dnl !rhel
%endif
%else
%define need_headers_package 0
%global need_headers_package 0
%dnl !biarcharches
%endif
@ -110,41 +110,40 @@
# Utility functions for pre/post scripts. Stick them at the beginning of
# any lua %pre, %post, %postun, etc. sections to have them expand into
# those scripts. It only works in lua sections and not anywhere else.
%define glibc_post_funcs() \
-- We use lua posix.exec because there may be no shell that we can \
-- run during glibc upgrade. We used to implement much of %%post as a \
-- C program, but from an overall maintenance perspective the lua in \
-- the spec file was simpler and safer given the operations required. \
-- All lua code will be ignored by rpm-ostree; see: \
-- https://github.com/projectatomic/rpm-ostree/pull/1869 \
-- If we add new lua actions to the %%post code we should coordinate \
-- with rpm-ostree and ensure that their glibc install is functional. \
function post_exec (program, ...) \
local pid = posix.fork () \
if pid == 0 then \
posix.exec (program, ...) \
assert (nil) \
elseif pid > 0 then \
posix.wait (pid) \
end \
end \
\
function update_gconv_modules_cache () \
local iconv_dir = "%{_libdir}/gconv" \
local iconv_cache = iconv_dir .. "/gconv-modules.cache" \
local iconv_modules = iconv_dir .. "/gconv-modules" \
if (posix.utime (iconv_modules) == 0) then \
if (posix.utime (iconv_cache) == 0) then \
post_exec ("%{_prefix}/sbin/iconvconfig", \
"-o", iconv_cache, \
"--nostdlib", \
iconv_dir) \
else \
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n") \
end \
end \
end \
%{nil}
%global glibc_post_funcs %{expand:
-- We use lua posix.exec because there may be no shell that we can run
-- during glibc upgrade. We used to implement much of %%post as a C
-- program, but from an overall maintenance perspective the lua in the
-- spec file was simpler and safer given the operations required.
-- All lua code will be ignored by rpm-ostree; see:
-- https://github.com/projectatomic/rpm-ostree/pull/1869
-- If we add new lua actions to the %%post code we should coordinate
-- with rpm-ostree and ensure that their glibc install is functional.
function post_exec (program, ...)
local pid = posix.fork ()
if pid == 0 then
posix.exec (program, ...)
assert (nil)
elseif pid > 0 then
posix.wait (pid)
end
end
function update_gconv_modules_cache ()
local iconv_dir = "%{_libdir}/gconv"
local iconv_cache = iconv_dir .. "/gconv-modules.cache"
local iconv_modules = iconv_dir .. "/gconv-modules"
if (posix.utime (iconv_modules) == 0) then
if (posix.utime (iconv_cache) == 0) then
post_exec ("%{_prefix}/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib",
iconv_dir)
else
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
end
end
end}
##############################################################################
# %%package glibc - The GNU C Library (glibc) core package.
@ -208,7 +207,7 @@ rpm.define("__debug_install_post bash " .. wrapper
# The wrapper script relies on the fact that debugedit does not change
# build IDs.
%define _no_recompute_build_ids 1
%global _no_recompute_build_ids 1
%undefine _unique_build_ids
##############################################################################
@ -293,14 +292,14 @@ BuildRequires: python3 python3-devel
# This GCC version is needed for -fstack-clash-protection support.
BuildRequires: gcc >= 7.2.1-6
%define enablekernel 3.2
%global enablekernel 3.2
Conflicts: kernel < %{enablekernel}
%define target %{_target_cpu}-redhat-linux
%global target %{_target_cpu}-redhat-linux
%ifarch %{arm}
%define target %{_target_cpu}-redhat-linuxeabi
%global target %{_target_cpu}-redhat-linuxeabi
%endif
%ifarch ppc64le
%define target ppc64le-redhat-linux
%global target ppc64le-redhat-linux
%endif
# GNU make 4.0 introduced the -O option.
@ -1123,8 +1122,8 @@ BuildFlagsNonshared="-fplugin=annobin -fplugin-arg-annobin-disable -Wa,--generat
# Special flag to enable annobin annotations for statically linked
# assembler code. Needs to be passed to make; not preserved by
# configure.
%define glibc_make_flags_as ASFLAGS="-g -Wa,--generate-missing-build-notes=yes"
%define glibc_make_flags %{glibc_make_flags_as}
%global glibc_make_flags_as ASFLAGS="-g -Wa,--generate-missing-build-notes=yes"
%global glibc_make_flags %{glibc_make_flags_as}
##############################################################################
# %%build - Generic options.
@ -1195,7 +1194,7 @@ build
# For a system glibc that subdirectory is "/" (the root of the filesystem).
# This is called a sysroot (system root) and can be changed if we have a
# distribution that supports multiple installed glibc versions.
%define glibc_sysroot $RPM_BUILD_ROOT
%global glibc_sysroot $RPM_BUILD_ROOT
# Remove existing file lists.
find . -type f -name '*.filelist' -exec rm -rf {} \;