Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package golang-github-prometheus-promu for 
openSUSE:Factory checked in at 2022-05-14 22:52:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-github-prometheus-promu (Old)
 and      /work/SRC/openSUSE:Factory/.golang-github-prometheus-promu.new.1538 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "golang-github-prometheus-promu"

Sat May 14 22:52:03 2022 rev:8 rq:976465 version:0.13.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/golang-github-prometheus-promu/golang-github-prometheus-promu.changes
    2022-04-14 17:24:13.815176765 +0200
+++ 
/work/SRC/openSUSE:Factory/.golang-github-prometheus-promu.new.1538/golang-github-prometheus-promu.changes
  2022-05-14 22:52:06.594986980 +0200
@@ -1,0 +2,6 @@
+Tue Apr 26 17:13:58 UTC 2022 - Witek Bedyk <witold.be...@suse.com>
+
+- Set build date from last changelog modification (boo#1047218)
+- Add 0001-Set-build-date-from-SOURCE_DATE_EPOCH.patch
+
+-------------------------------------------------------------------

New:
----
  0001-Set-build-date-from-SOURCE_DATE_EPOCH.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ golang-github-prometheus-promu.spec ++++++
--- /var/tmp/diff_new_pack.CPi41g/_old  2022-05-14 22:52:07.090987600 +0200
+++ /var/tmp/diff_new_pack.CPi41g/_new  2022-05-14 22:52:07.094987605 +0200
@@ -15,6 +15,7 @@
 # Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
+
 %if 0%{?rhel}
 # Fix ERROR: No build ID note found in
 %undefine _missing_build_ids_terminate_build
@@ -31,6 +32,7 @@
 URL:            https://github.com/prometheus/promu
 Source:         promu-%{version}.tar.gz
 Source1:        vendor.tar.gz
+Patch1:         0001-Set-build-date-from-SOURCE_DATE_EPOCH.patch
 BuildRequires:  golang-packaging
 %if 0%{?rhel}
 BuildRequires:  golang >= 1.15
@@ -44,8 +46,7 @@
 The Prometheus Utility Tool is used by the Prometheus project to build other 
components.
 
 %prep
-%setup -q -n promu-%{version}
-%setup -q -T -D -a 1 -n promu-%{version}
+%autosetup -a1 -p1 -n promu-%{version}
 
 %build
 %goprep github.com/prometheus/promu

++++++ 0001-Set-build-date-from-SOURCE_DATE_EPOCH.patch ++++++
>From 2098a5128565a72fc1886e996a444cc111e43c36 Mon Sep 17 00:00:00 2001
From: Witek Bedyk <witold.be...@suse.com>
Date: Tue, 26 Apr 2022 17:21:46 +0200
Subject: [PATCH] Set build date from SOURCE_DATE_EPOCH

Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This PR was done while working on [reproducible builds for
openSUSE](https://en.opensuse.org/openSUSE:Reproducible_Builds).

Signed-off-by: Witek Bedyk <witold.be...@suse.com>
---
 cmd/build.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmd/build.go b/cmd/build.go
index 18f1c5e..694b964 100644
--- a/cmd/build.go
+++ b/cmd/build.go
@@ -20,6 +20,7 @@ import (
        "log"
        "os"
        "path"
+       "strconv"
        "strings"
        "text/template"
        "time"
@@ -146,10 +147,17 @@ func getLdflags(info repository.Info) string {
        var ldflags []string
 
        if len(strings.TrimSpace(config.Build.LDFlags)) > 0 {
+               var buildDate time.Time
+               unixBuildDate, err := 
strconv.ParseInt(os.Getenv("SOURCE_DATE_EPOCH"), 10, 64)
+               if err == nil {
+                       buildDate = time.Unix(unixBuildDate, 0)
+               } else {
+                       buildDate = time.Now()
+               }
                var (
                        tmplOutput = new(bytes.Buffer)
                        fnMap      = template.FuncMap{
-                               "date":     time.Now().UTC().Format,
+                               "date":     buildDate.UTC().Format,
                                "host":     os.Hostname,
                                "repoPath": RepoPathFunc,
                                "user":     UserFunc,
-- 
2.34.1

Reply via email to