Ana Guerrero 2024-02-16 20:41:28 +00:00 committed by Git OBS Bridge
commit 4debce3db7
3 changed files with 48 additions and 18 deletions

View File

@ -1,5 +1,5 @@
<services>
<service name="obs_scm" mode="disabled">
<service name="obs_scm" mode="manual">
<param name="url">https://github.com/prometheus/promu.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
@ -13,10 +13,10 @@
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled">
<service name="set_version" mode="manual">
<param name="basename">promu</param>
</service>
<service name="go_modules" mode="disabled">
<service name="go_modules" mode="manual">
<param name="archive">promu-0.15.0.obscpio</param>
</service>
</services>

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Sat Feb 10 04:51:27 UTC 2024 - Jeff Kowalczyk <jkowalczyk@suse.com>
- 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 <schwab@suse.de>

View File

@ -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