[skip-ci] RPM: cleanup macro defs

The default `gobuild` macro on CentOS Stream 9 now includes support for
`BUILDTAGS`.

CentOS Stream envs now also define `_user_tmpfilesdir` macro by default.
Both these definitions are no longer needed here.

`libtrust_openssl` buildtag is also set in spec wherever relevant.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar 2025-02-05 20:12:12 +05:30
parent 2d42b13d55
commit 1d220b99da
No known key found for this signature in database
GPG Key ID: 1C1EDD7CC7C3A0DD
1 changed files with 13 additions and 13 deletions

View File

@ -7,21 +7,8 @@
%global debug_package %{nil} %global debug_package %{nil}
%endif %endif
# RHEL's default %%gobuild macro doesn't account for the BUILDTAGS variable, so we
# set it separately here and do not depend on RHEL's go-[s]rpm-macros package
# until that's fixed.
# c9s bz: https://bugzilla.redhat.com/show_bug.cgi?id=2227328
%if %{defined rhel} && 0%{?rhel} < 10
%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};
%endif
%global gomodulesmode GO111MODULE=on %global gomodulesmode GO111MODULE=on
%if %{defined rhel}
# _user_tmpfiles.d currently undefined on rhel
%global _user_tmpfilesdir %{_datadir}/user-tmpfiles.d
%endif
%if %{defined fedora} %if %{defined fedora}
%define build_with_btrfs 1 %define build_with_btrfs 1
# qemu-system* isn't packageed for CentOS Stream / RHEL # qemu-system* isn't packageed for CentOS Stream / RHEL
@ -32,6 +19,11 @@
%define copr_build 1 %define copr_build 1
%endif %endif
# Only RHEL and CentOS Stream rpms are built with fips-enabled go compiler
%if %{defined rhel}
%define fips_enabled 1
%endif
%global container_base_path github.com/containers %global container_base_path github.com/containers
%global container_base_url https://%{container_base_path} %global container_base_url https://%{container_base_path}
@ -251,6 +243,14 @@ LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \
export BASEBUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)" export BASEBUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)"
# libtrust_openssl buildtag switches to using the FIPS-compatible func
# `ecdsa.HashSign`.
# Ref 1: https://github.com/golang-fips/go/blob/main/patches/015-add-hash-sign-verify.patch#L22
# Ref 2: https://github.com/containers/libtrust/blob/main/ec_key_openssl.go#L23
%if %{defined fips_enabled}
export BASEBUILDTAGS="$BASEBUILDTAGS libtrust_openssl"
%endif
# build %%{name} # build %%{name}
export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh)" export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh)"
%gobuild -o bin/%{name} ./cmd/%{name} %gobuild -o bin/%{name} ./cmd/%{name}