forked from pool/golang-github-prometheus-promu
- 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 OBS-URL: https://build.opensuse.org/request/show/1145684 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/golang-github-prometheus-promu?expand=0&rev=38
69 lines
2.0 KiB
RPMSpec
69 lines
2.0 KiB
RPMSpec
#
|
|
# spec file for package golang-github-prometheus-promu
|
|
#
|
|
# Copyright (c) 2024 SUSE LLC
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%define shortname promu
|
|
|
|
Name: golang-github-prometheus-promu
|
|
Version: 0.15.0
|
|
Release: 0
|
|
Summary: Prometheus Utility Tool
|
|
License: Apache-2.0
|
|
Group: System/Management
|
|
URL: https://github.com/prometheus/promu
|
|
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
|
|
ExcludeArch: s390
|
|
%if 0%{?rhel}
|
|
# Fix ERROR: No build ID note found in
|
|
%undefine _missing_build_ids_terminate_build
|
|
BuildRequires: golang >= 1.19
|
|
%else
|
|
BuildRequires: golang(API) >= 1.19
|
|
%endif
|
|
|
|
%description
|
|
The Prometheus Utility Tool is used by the Prometheus project to build other components.
|
|
|
|
%prep
|
|
%autosetup -a1 -p1 -n %{shortname}-%{version}
|
|
|
|
%build
|
|
%ifnarch ppc64
|
|
export GOFLAGS="-buildmode=pie"
|
|
%endif
|
|
go build
|
|
|
|
%check
|
|
# execute the binary as a basic check
|
|
./%{shortname} --help
|
|
|
|
%install
|
|
install -D -m 0755 %{shortname} "%{buildroot}/%{_bindir}/%{shortname}"
|
|
|
|
%files
|
|
%doc README.md
|
|
%license LICENSE
|
|
%{_bindir}/%{shortname}
|
|
|
|
%changelog
|