diff --git a/_service b/_service index 04c00a2..3ed47d0 100644 --- a/_service +++ b/_service @@ -1,5 +1,5 @@ - + https://github.com/prometheus/promu.git git .git @@ -13,10 +13,10 @@ *.tar gz - + promu - + promu-0.15.0.obscpio diff --git a/golang-github-prometheus-promu.changes b/golang-github-prometheus-promu.changes index 84b6196..e64d786 100644 --- a/golang-github-prometheus-promu.changes +++ b/golang-github-prometheus-promu.changes @@ -1,3 +1,33 @@ +------------------------------------------------------------------- +Sat Feb 10 04:51:27 UTC 2024 - Jeff Kowalczyk + +- Packaging improvements: + * _service change disabled to manual per osc deprecation warning: + WARNING: Command 'disabledrun/dr' is obsolete, please convert + your _service to use 'manual' and then 'manualrun/mr' instead. + * Define shortname corresponding to binary name when different + from package name. Use shortname where applicable to normalize + common lines across Go app packages, similar to name macro. + * Drop BuildRequires: golang-packaging. The original macros for + file movements into GOPATH are obsolete with Go modules. Macro + go_nostrip is no longer needed with current binutils and Go. + * Drop export CGO_ENABLED="0". Use the default unless there is a + defined requirement or benefit. + * Build PIE with pattern that may become recommended procedure: + %%ifnarch ppc64 GOFLAGS="-buildmode=pie" %%endif go build + A go toolchain buildmode default config would be preferable + but none exist at this time. + * Drop mod=vendor, go1.14+ will detect vendor dir and auto-enable + * Remove ldflags -X entries for upstream import path and version. + This information is embedded in binaries with go1.18+ and + available via go version -m or runtime/debug.ReadBuildInfo(). + * Remove ldflags -s (Omit symbol table and debug info) and -w + (Omit DWARF symbol table). This information is used to produce + separate debuginfo packages and binaries are stripped for + reduced size by GNU strip during RPM build. + * Drop go build -o arg, default binary name is pkg of main() + * Add basic %check to execute binary --help + ------------------------------------------------------------------- Thu Dec 14 11:51:49 UTC 2023 - Andreas Schwab diff --git a/golang-github-prometheus-promu.spec b/golang-github-prometheus-promu.spec index 157637c..ee951af 100644 --- a/golang-github-prometheus-promu.spec +++ b/golang-github-prometheus-promu.spec @@ -16,6 +16,8 @@ # +%define shortname promu + Name: golang-github-prometheus-promu Version: 0.15.0 Release: 0 @@ -23,20 +25,18 @@ Summary: Prometheus Utility Tool License: Apache-2.0 Group: System/Management URL: https://github.com/prometheus/promu -Source: promu-%{version}.tar.gz +Source: %{shortname}-%{version}.tar.gz Source1: vendor.tar.gz # PATCH-FIX-UPSTREAM Fix setting reproducible user and host during the build # https://github.com/prometheus/promu/pull/267 Patch1: 0001-do_not_discover_user_host_for_reproducible_builds.patch # PATCH-FIX-OPENSUSE Do not pass -static to external linker by default Patch2: extldflags-no-static.patch -BuildRequires: golang-packaging ExcludeArch: s390 -%{go_provides} %if 0%{?rhel} # Fix ERROR: No build ID note found in %undefine _missing_build_ids_terminate_build -BuildRequires: golang >= 1.18 +BuildRequires: golang >= 1.19 %else BuildRequires: golang(API) >= 1.19 %endif @@ -45,24 +45,24 @@ BuildRequires: golang(API) >= 1.19 The Prometheus Utility Tool is used by the Prometheus project to build other components. %prep -%autosetup -a1 -p1 -n promu-%{version} +%autosetup -a1 -p1 -n %{shortname}-%{version} %build -%{goprep} github.com/prometheus/promu -export VERSION=%{version} -export CGO_ENABLED=0 -go build \ - -mod=vendor \ - -buildmode=pie \ - -ldflags "-s -w -X main.version=$VERSION" \ - -o promu ; +%ifnarch ppc64 +export GOFLAGS="-buildmode=pie" +%endif +go build + +%check +# execute the binary as a basic check +./%{shortname} --help %install -install -D -m 0755 promu "%{buildroot}/%{_bindir}/promu" +install -D -m 0755 %{shortname} "%{buildroot}/%{_bindir}/%{shortname}" %files %doc README.md %license LICENSE -%{_bindir}/promu +%{_bindir}/%{shortname} %changelog