Accepting request 1246042 from devel:languages:go
Add reproducible.patch to override build date (boo#1047218) (forwarded request 1246041 from bmwiedemann) OBS-URL: https://build.opensuse.org/request/show/1246042 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mage?expand=0&rev=3
This commit is contained in:
commit
24325f4a14
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Feb 15 04:06:34 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.com>
|
||||
|
||||
- Add reproducible.patch to override build date (boo#1047218)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jan 6 16:23:45 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -23,6 +23,7 @@ Summary: A make-like build tool using Go
|
||||
License: Apache-2.0
|
||||
URL: https://github.com/magefile/mage
|
||||
Source: https://github.com/magefile/mage/archive/refs/tags/v%{version}.tar.gz
|
||||
Patch0: https://github.com/magefile/mage/pull/474.patch#/reproducible.patch
|
||||
BuildRequires: go
|
||||
BuildRequires: golang-packaging
|
||||
BuildRequires: golang(API) >= 1.12
|
||||
@ -32,7 +33,7 @@ BuildRequires: golang(API) >= 1.12
|
||||
Mage is a make-like build tool using Go. You write plain-old go functions, and Mage automatically uses them as Makefile-like runnable targets.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
if test -z "$GOPATH"; then
|
||||
|
42
reproducible.patch
Normal file
42
reproducible.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From fbeaad11b0452a336cc23545aee709e811fdb9cc Mon Sep 17 00:00:00 2001
|
||||
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
|
||||
Date: Sun, 25 Jun 2023 09:33:48 +0200
|
||||
Subject: [PATCH] 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 patch was done while working on reproducible builds for openSUSE.
|
||||
---
|
||||
magefile.go | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/magefile.go b/magefile.go
|
||||
index c08ffa37..ab91e4fe 100644
|
||||
--- a/magefile.go
|
||||
+++ b/magefile.go
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
+ "strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -100,6 +101,14 @@ func Clean() error {
|
||||
|
||||
func flags() string {
|
||||
timestamp := time.Now().Format(time.RFC3339)
|
||||
+ source_date_epoch := os.Getenv("SOURCE_DATE_EPOCH")
|
||||
+ if source_date_epoch != "" {
|
||||
+ sde, err := strconv.ParseInt(source_date_epoch, 10, 64)
|
||||
+ if err != nil {
|
||||
+ panic(fmt.Sprintf("Invalid SOURCE_DATE_EPOCH: %s", err))
|
||||
+ }
|
||||
+ timestamp = time.Unix(sde, 0).UTC().Format(time.RFC3339)
|
||||
+ }
|
||||
hash := hash()
|
||||
tag := tag()
|
||||
if tag == "" {
|
Loading…
x
Reference in New Issue
Block a user