forked from pool/golang-github-prometheus-promu
Accepting request 1173190 from server:monitoring
OBS-URL: https://build.opensuse.org/request/show/1173190 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/golang-github-prometheus-promu?expand=0&rev=19
This commit is contained in:
commit
ef4a545607
@ -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.
|
4
_service
4
_service
@ -4,7 +4,7 @@
|
||||
<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.17.0</param>
|
||||
<param name="versionrewrite-pattern">v(.*)</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
@ -17,6 +17,6 @@
|
||||
<param name="basename">promu</param>
|
||||
</service>
|
||||
<service name="go_modules" mode="manual">
|
||||
<param name="archive">promu-0.15.0.obscpio</param>
|
||||
<param name="archive">promu-0.17.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">3912dec4ab83971903015cc7b2a8d8ff93b73910</param></service></servicedata>
|
@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Apr 20 11:43:43 UTC 2024 - opensuse_buildservice@ojkastl.de
|
||||
|
||||
- Update to version 0.17.0:
|
||||
* [FEATURE] Add codesign utility function #284
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Apr 20 11:41:19 UTC 2024 - opensuse_buildservice@ojkastl.de
|
||||
|
||||
- drop patch
|
||||
0001-do_not_discover_user_host_for_reproducible_builds.patch that
|
||||
was merged upstream
|
||||
(https://github.com/prometheus/promu/pull/267)
|
||||
- BuildRequire go1.21 as upstream does
|
||||
- Update to version 0.16.0:
|
||||
* [FEATURE] Do not discover user/host for reproducible builds
|
||||
#267
|
||||
* [BUGFIX] Fix example/prometheus build error #274
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Feb 10 04:51:27 UTC 2024 - Jeff Kowalczyk <jkowalczyk@suse.com>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
%define shortname promu
|
||||
|
||||
Name: golang-github-prometheus-promu
|
||||
Version: 0.15.0
|
||||
Version: 0.17.0
|
||||
Release: 0
|
||||
Summary: Prometheus Utility Tool
|
||||
License: Apache-2.0
|
||||
@ -27,18 +27,15 @@ 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
|
||||
BuildRequires: golang >= 1.21
|
||||
%else
|
||||
BuildRequires: golang(API) >= 1.19
|
||||
BuildRequires: golang(API) >= 1.21
|
||||
%endif
|
||||
|
||||
%description
|
||||
|
BIN
promu-0.15.0.obscpio
(Stored with Git LFS)
BIN
promu-0.15.0.obscpio
(Stored with Git LFS)
Binary file not shown.
3
promu-0.17.0.obscpio
Normal file
3
promu-0.17.0.obscpio
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:35738387735146d914e4a8f64a81162af8d011cc02201cac0cc52b3c45469b96
|
||||
size 125963
|
@ -1,4 +1,4 @@
|
||||
name: promu
|
||||
version: 0.15.0
|
||||
mtime: 1688456354
|
||||
commit: e1bab893555f728998f2bd404c4b7e66931bc760
|
||||
version: 0.17.0
|
||||
mtime: 1713609107
|
||||
commit: 3912dec4ab83971903015cc7b2a8d8ff93b73910
|
||||
|
BIN
vendor.tar.gz
(Stored with Git LFS)
BIN
vendor.tar.gz
(Stored with Git LFS)
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user