Sync from SUSE:ALP:Source:Standard:1.0 golang-github-prometheus-promu revision 29ce3cba700f88d42ae9d103fc507a4d
This commit is contained in:
parent
730ed50afa
commit
af0d6667c5
@ -1,74 +0,0 @@
|
||||
Index: promu-0.15.0/cmd/build.go
|
||||
===================================================================
|
||||
--- promu-0.15.0.orig/cmd/build.go
|
||||
+++ promu-0.15.0/cmd/build.go
|
||||
@@ -32,6 +32,10 @@ import (
|
||||
"github.com/prometheus/promu/util/sh"
|
||||
)
|
||||
|
||||
+const (
|
||||
+ sourceDateEpoch = "SOURCE_DATE_EPOCH"
|
||||
+)
|
||||
+
|
||||
var (
|
||||
buildcmd = app.Command("build", "Build a Go project")
|
||||
buildCgoFlagSet bool
|
||||
@@ -155,7 +159,7 @@ func getLdflags(info repository.Info) st
|
||||
tmplOutput = new(bytes.Buffer)
|
||||
fnMap = template.FuncMap{
|
||||
"date": buildDate.UTC().Format,
|
||||
- "host": os.Hostname,
|
||||
+ "host": HostFunc,
|
||||
"repoPath": RepoPathFunc,
|
||||
"user": UserFunc,
|
||||
}
|
||||
@@ -191,13 +195,13 @@ func getLdflags(info repository.Info) st
|
||||
func getBuildDate() time.Time {
|
||||
var buildDate time.Time
|
||||
|
||||
- sourceDate := os.Getenv("SOURCE_DATE_EPOCH")
|
||||
+ sourceDate := os.Getenv(sourceDateEpoch)
|
||||
if sourceDate == "" {
|
||||
buildDate = time.Now()
|
||||
} else {
|
||||
unixBuildDate, err := strconv.ParseInt(sourceDate, 10, 64)
|
||||
if err != nil {
|
||||
- fatal(errors.Wrap(err, "Failed to parse SOURCE_DATE_EPOCH"))
|
||||
+ fatal(errors.Wrap(err, "Failed to parse "+sourceDateEpoch))
|
||||
} else {
|
||||
buildDate = time.Unix(unixBuildDate, 0)
|
||||
}
|
||||
@@ -205,10 +209,31 @@ func getBuildDate() time.Time {
|
||||
return buildDate
|
||||
}
|
||||
|
||||
+func HostFunc() string {
|
||||
+ if isReproducibleBuild() {
|
||||
+ return "reproducible"
|
||||
+ } else {
|
||||
+ hostname, err := os.Hostname()
|
||||
+ if err != nil {
|
||||
+ return "unknown-host"
|
||||
+ } else {
|
||||
+ return hostname
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// UserFunc returns the current username.
|
||||
func UserFunc() (interface{}, error) {
|
||||
- // os/user.Current() doesn't always work without CGO
|
||||
- return shellOutput("whoami"), nil
|
||||
+ if isReproducibleBuild() {
|
||||
+ return "reproducible", nil
|
||||
+ } else {
|
||||
+ // os/user.Current() doesn't always work without CGO
|
||||
+ return shellOutput("whoami"), nil
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+func isReproducibleBuild() bool {
|
||||
+ return os.Getenv(sourceDateEpoch) != ""
|
||||
}
|
||||
|
||||
// RepoPathFunc returns the repository path.
|
11
_service
11
_service
@ -1,22 +1,21 @@
|
||||
<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>
|
||||
<param name="versionformat">@PARENT_TAG@</param>
|
||||
<param name="revision">v0.15.0</param>
|
||||
<param name="revision">v0.16.0</param>
|
||||
<param name="versionrewrite-pattern">v(.*)</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
<service name="tar" mode="buildtime"/>
|
||||
<service name="recompress" mode="buildtime">
|
||||
<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">
|
||||
<param name="archive">promu-0.15.0.obscpio</param>
|
||||
<service name="go_modules" mode="manual">
|
||||
<param name="archive">promu-0.16.0.obscpio</param>
|
||||
</service>
|
||||
</services>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">https://github.com/prometheus/promu.git</param>
|
||||
<param name="changesrevision">e1bab893555f728998f2bd404c4b7e66931bc760</param></service></servicedata>
|
||||
<param name="changesrevision">36b1874b73015223f942a3d71d534aa2ab8b6430</param></service></servicedata>
|
13
extldflags-no-static.patch
Normal file
13
extldflags-no-static.patch
Normal file
@ -0,0 +1,13 @@
|
||||
Index: promu-0.15.0/cmd/promu.go
|
||||
===================================================================
|
||||
--- promu-0.15.0.orig/cmd/promu.go
|
||||
+++ promu-0.15.0/cmd/promu.go
|
||||
@@ -73,7 +73,7 @@ func NewConfig() *Config {
|
||||
config := &Config{}
|
||||
config.Build.Binaries = []Binary{{Name: projInfo.Name, Path: "."}}
|
||||
config.Build.Prefix = "."
|
||||
- config.Build.Static = true
|
||||
+ config.Build.Static = false
|
||||
config.Crossbuild.Platforms = defaultPlatforms
|
||||
config.Tarball.Prefix = "."
|
||||
config.Go.Version = "1.12"
|
@ -1,5 +1,51 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 8 11:53:00 UTC 2023 - Witek Bedyk <witold.bedyk@suse.com>
|
||||
Mon Sep 23 09:20:55 UTC 2024 - Witek Bedyk <witold.bedyk@suse.com>
|
||||
|
||||
- Drop 0001-do_not_discover_user_host_for_reproducible_builds.patch
|
||||
- Require Go 1.21 for building
|
||||
- Packaging improvements:
|
||||
* Use obscpio, run tar and recompresss services at buildtime.
|
||||
* _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.
|
||||
* Disable automatic chagelog file generation.
|
||||
* 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 (bsc#1230623).
|
||||
* 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
|
||||
- Update to version 0.16.0:
|
||||
* Do not discover user/host for reproducible builds
|
||||
* Fix example/prometheus build error
|
||||
- Update to version 0.15.0:
|
||||
* Add linux/riscv64 to default platforms
|
||||
* Use yaml.Unmarshalstrict to validate configuration files
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 14 11:51:49 UTC 2023 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
- extldflags-no-static.patch: Don't pass -extldflags -static by
|
||||
default
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 21 14:56:34 UTC 2023 - Witek Bedyk <witold.bedyk@suse.com>
|
||||
|
||||
- Always set user and host build metadata to constant string to
|
||||
achieve reproducible builds (compare reproducible-builds.org)
|
||||
@ -7,33 +53,10 @@ Tue Aug 8 11:53:00 UTC 2023 - Witek Bedyk <witold.bedyk@suse.com>
|
||||
- Require Go >= 1.19 for building
|
||||
- Require Go >= 1.18 for building Red Hat packages
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 04 10:41:07 UTC 2023 - kastl@b1-systems.de
|
||||
|
||||
- Update to version 0.15.0:
|
||||
* Release v0.15.0
|
||||
* Bump golang.org/x/oauth2 from 0.8.0 to 0.9.0
|
||||
* Update common Prometheus files
|
||||
* Bump go.uber.org/atomic from 1.10.0 to 1.11.0
|
||||
* Update build
|
||||
* Add linux/riscv64 to default platforms
|
||||
* Bump github.com/prometheus/common from 0.39.0 to 0.42.0
|
||||
* Bump golang.org/x/oauth2 from 0.5.0 to 0.6.0
|
||||
* Bump github.com/prometheus/common from 0.37.0 to 0.39.0
|
||||
* Bump golang.org/x/oauth2 from 0.2.0 to 0.5.0
|
||||
* Bump golang.org/x/net from 0.2.0 to 0.7.0
|
||||
* Use unmarshalstrict
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 22 10:28:44 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>
|
||||
|
||||
- rework spec file to use obscpio
|
||||
- run tar and recompresss services at buildtime
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 10 16:18:52 UTC 2023 - kastl@b1-systems.de
|
||||
|
||||
- Update to version 0.14.0:
|
||||
- Update to version 0.14.0 (jsc#PED-3576):
|
||||
* Add the ability to override tags per GOOS
|
||||
* Remove ioutil
|
||||
* Update common Prometheus files (#232) (#224)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package golang-github-prometheus-promu
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# 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
|
||||
@ -16,51 +16,50 @@
|
||||
#
|
||||
|
||||
|
||||
%define shortname promu
|
||||
|
||||
Name: golang-github-prometheus-promu
|
||||
Version: 0.15.0
|
||||
Version: 0.16.0
|
||||
Release: 0
|
||||
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
|
||||
BuildRequires: golang-packaging
|
||||
# PATCH-FIX-OPENSUSE Do not pass -static to external linker by default
|
||||
Patch2: extldflags-no-static.patch
|
||||
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.21
|
||||
%else
|
||||
BuildRequires: golang(API) >= 1.19
|
||||
BuildRequires: golang(API) = 1.21
|
||||
%endif
|
||||
|
||||
%description
|
||||
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
|
||||
|
BIN
promu-0.15.0.obscpio
(Stored with Git LFS)
BIN
promu-0.15.0.obscpio
(Stored with Git LFS)
Binary file not shown.
BIN
promu-0.16.0.obscpio
(Stored with Git LFS)
Normal file
BIN
promu-0.16.0.obscpio
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
name: promu
|
||||
version: 0.15.0
|
||||
mtime: 1688456354
|
||||
commit: e1bab893555f728998f2bd404c4b7e66931bc760
|
||||
version: 0.16.0
|
||||
mtime: 1712139406
|
||||
commit: d4dc1c56d581ecfabe17bc508978672ef44b536b
|
||||
|
BIN
vendor.tar.gz
(Stored with Git LFS)
BIN
vendor.tar.gz
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue
Block a user