Sync from SUSE:SLFO:Main golang-github-prometheus-promu revision 57d6259a937f2f18077f9500629d5000

This commit is contained in:
Adrian Schröter 2024-05-03 13:09:43 +02:00
commit 78e5b6427f
9 changed files with 335 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,74 @@
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.

22
_service Normal file
View File

@ -0,0 +1,22 @@
<services>
<service name="obs_scm" mode="disabled">
<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="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">
<param name="basename">promu</param>
</service>
<service name="go_modules" mode="disabled">
<param name="archive">promu-0.15.0.obscpio</param>
</service>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/prometheus/promu.git</param>
<param name="changesrevision">e1bab893555f728998f2bd404c4b7e66931bc760</param></service></servicedata>

View File

@ -0,0 +1,136 @@
-------------------------------------------------------------------
Tue Aug 8 11:53:00 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)
- Add 0001-do_not_discover_user_host_for_reproducible_builds.patch
- 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:
* Add the ability to override tags per GOOS
* Remove ioutil
* Update common Prometheus files (#232) (#224)
* Validate environment variable value
* Set build date from SOURCE_DATE_EPOCH
- drop patch 0001-Set-build-date-from-SOURCE_DATE_EPOCH.patch that is
included upstream now
-------------------------------------------------------------------
Mon Oct 31 14:17:46 UTC 2022 - Witek Bedyk <witold.bedyk@suse.com>
- Do not include source code
- Update to Go 1.18
-------------------------------------------------------------------
Tue Sep 27 12:37:42 UTC 2022 - Dirk Müller <dmueller@suse.com>
- switch to go1.17 as upstream does (see https://github.com/prometheus/promu/blob/v0.13.0/.promu.yml)
- remove go_nostrip as it isn't necessary with 1.17 anymore
-------------------------------------------------------------------
Tue May 10 15:22:43 UTC 2022 - Jordi Massaguer <jmassaguerpla@suse.com>
- Exclude s390 architecture.
-------------------------------------------------------------------
Tue Apr 26 17:13:58 UTC 2022 - Witek Bedyk <witold.bedyk@suse.com>
- Set build date from last changelog modification (boo#1047218)
- Add 0001-Set-build-date-from-SOURCE_DATE_EPOCH.patch
-------------------------------------------------------------------
Fri Apr 1 13:56:36 UTC 2022 - Stefan Bluhm <stefan.bluhm@clacee.eu>
- Adapted for Enterprise Linux build.
-------------------------------------------------------------------
Thu Mar 03 21:07:04 UTC 2022 - ecsos@opensuse.org
- Update to version 0.13.0:
* Release 0.13.0 (jsc#SLE-24138, jsc#SLE-24139)
* Add deprecation note to pkg directory
* Add windows/arm64
* Update common Prometheus files
* Fix typo
* Release 0.12.0
* Simplify CGO crossbuilds
* Update common Prometheus files
* Release 0.11.1
* Fix build with "linux" platform
-------------------------------------------------------------------
Mon Mar 8 11:03:45 UTC 2021 - Witek Bedyk <witold.bedyk@suse.com>
- Build requires Go 1.15
-------------------------------------------------------------------
Fri Feb 7 17:13:26 UTC 2020 - Witek Bedyk <witold.bedyk@suse.com>
- Update to 0.5.0
+ Features:
* Add support for aix/ppc64. #151
* Fallback to git describe output if no VERSION. #130
* Make extldflags extensible by configuration. #125
+ Enhancements:
* cmd/release: add --timeout option. #142
* cmd/release: create release in GitHub if none exists. #148
* Avoid bind-mounting to allow building with a remote docker engine #95
+ Bug Fixes:
* cmd/tarball: restore --prefix flag. #133
* cmd/release: don't leak credentials in case of error. #136
- Use obs-service-go_modules
-------------------------------------------------------------------
Fri Feb 8 11:05:48 UTC 2019 - Jan Fajerski <jan.fajerski@suse.com>
- Update to 0.2.0
+ Features:
* Adding changes to support s390x
* Add option to disable static linking
* Add support for 32bit MIPS.
* Added check_licenses Command to Promu
+ Enhancements:
* Allow to customize nested options via env variables
* Bump Go version to 1.11
* Add warning if promu info is unable to determine repo info
+ Bug Fixes:
* Fix build on SmartOS by not setting gcc's -static flag
* Fix git repository url parsing
-------------------------------------------------------------------
Thu Jan 25 10:13:29 UTC 2018 - kkaempf@suse.com
- Update to 0.1.0
-------------------------------------------------------------------
Wed Mar 29 09:16:48 UTC 2017 - moio@suse.com
- Initial version

View File

@ -0,0 +1,66 @@
#
# spec file for package golang-github-prometheus-promu
#
# Copyright (c) 2023 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/
#
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: promu-%{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
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
%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 promu-%{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 ;
%install
install -D -m 0755 promu "%{buildroot}/%{_bindir}/promu"
%files
%doc README.md
%license LICENSE
%{_bindir}/promu
%changelog

BIN
promu-0.15.0.obscpio (Stored with Git LFS) Normal file

Binary file not shown.

4
promu.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: promu
version: 0.15.0
mtime: 1688456354
commit: e1bab893555f728998f2bd404c4b7e66931bc760

BIN
vendor.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.