[skip-ci] RPM: set buildOrigin in LDFLAG

For Copr builds, it will mention the Copr info from where the rpm is
installed.

For non-copr builds, it will mention the value of the packager macro
if set, and skip this field altogether if not.

On local rpm builds, this shows:
```
Build Origin:  Lokesh Mandvekar <lsm5@fedoraproject.org>
```

On koji rpm builds, this shows:
```
Build Origin: Fedora Project
```

On copr rpm builds (for eg. rhcontainerbot/playground), this shows:
```
Build Origin: Copr: rhcontainerbot/playground
```

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar
2025-02-10 16:36:42 +05:30
parent 7185d46ce1
commit b06c7d78d3

View File

@ -45,6 +45,12 @@
# podman-machine subpackage will be present only on these architectures
%global machine_arches x86_64 aarch64
%if %{defined copr_build}
%define build_origin Copr: %{?copr_username}/%{?copr_projectname}
%else
%define build_origin %{?packager}
%endif
Name: podman
%if %{defined copr_build}
Epoch: 102
@ -242,6 +248,7 @@ export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full"
export GOPROXY=direct
LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \
-X "%{ld_libpod}/define.buildOrigin=%{build_origin}" \
-X %{ld_libpod}/config._installPrefix=%{_prefix} \
-X %{ld_libpod}/config._etcDir=%{_sysconfdir} \
-X %{ld_project}/pkg/systemd/quadlet._binDir=%{_bindir}"