summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-11-24 10:32:54 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-11-24 12:51:28 +0200
commitd25e9f440b15882af1a45057ff65616162de8201 (patch)
tree04d362d057f8ae4e94e0dc5f8ca740d0d2a6ab1b
parent0083a2265960f8228112c36e0d10eb974ff9d1f1 (diff)
downloadguix-d25e9f440b15882af1a45057ff65616162de8201.tar.gz
gnu: go-gopkg-in-yaml-v3: Fix build on 32-bit systems.
* gnu/packages/golang.scm (go-gopkg-in-yaml-v3)[source]: Add patch.
* gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: Ia8a96b15d37a3d2f133da9374cac1e58e38f2d2c
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/golang.scm3
-rw-r--r--gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch50
3 files changed, 53 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index db9d6b93a4..023cd4b17f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1342,6 +1342,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gobject-introspection-cc-1.72.patch	\
   %D%/packages/patches/gobject-introspection-girepository.patch	\
   %D%/packages/patches/go-fix-script-tests.patch			\
+  %D%/packages/patches/go-gopkg-in-yaml-v3-32bit.patch		\
   %D%/packages/patches/go-github-com-golang-snappy-32bit-test.patch \
   %D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \
   %D%/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch \
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 9c707e5414..2c9aff4a28 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -5577,7 +5577,8 @@ values.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "01b0wjb7yzv8wzzz2iim8mjpkwjnykcanrwiq06pkl89lr6gv8hn"))))
+        (base32 "01b0wjb7yzv8wzzz2iim8mjpkwjnykcanrwiq06pkl89lr6gv8hn"))
+       (patches (search-patches "go-gopkg-in-yaml-v3-32bit.patch"))))
     (build-system go-build-system)
     (arguments
      '(#:import-path "gopkg.in/yaml.v3"))
diff --git a/gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch b/gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch
new file mode 100644
index 0000000000..7a243f5d80
--- /dev/null
+++ b/gnu/packages/patches/go-gopkg-in-yaml-v3-32bit.patch
@@ -0,0 +1,50 @@
+https://sources.debian.org/src/golang-gopkg-yaml.v3/3.0.1-3/debian/patches/0001-Fix-0b-on-32-bit-systems.patch/
+
+From: Shengjing Zhu <zhsj@debian.org>
+Date: Fri, 16 Apr 2021 00:40:09 +0800
+Subject: Fix -0b on 32-bit systems
+
+Origin: backport, https://github.com/go-yaml/yaml/pull/442
+---
+ decode_test.go | 7 ++++---
+ resolve.go     | 2 +-
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/decode_test.go b/decode_test.go
+index 51f5070..9cac74c 100644
+--- a/decode_test.go
++++ b/decode_test.go
+@@ -175,9 +175,6 @@ var unmarshalTests = []struct {
+ 	}, {
+ 		"bin: -0b101010",
+ 		map[string]interface{}{"bin": -42},
+-	}, {
+-		"bin: -0b1000000000000000000000000000000000000000000000000000000000000000",
+-		map[string]interface{}{"bin": -9223372036854775808},
+ 	}, {
+ 		"decimal: +685_230",
+ 		map[string]int{"decimal": 685230},
+@@ -357,6 +354,10 @@ var unmarshalTests = []struct {
+ 		"int64_min: -9223372036854775808",
+ 		map[string]int64{"int64_min": math.MinInt64},
+ 	},
++	{
++		"int64_min_base2: -0b1000000000000000000000000000000000000000000000000000000000000000",
++		map[string]int64{"int64_min_base2": math.MinInt64},
++	},
+ 	{
+ 		"int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111",
+ 		map[string]int64{"int64_neg_base2": -math.MaxInt64},
+diff --git a/resolve.go b/resolve.go
+index 64ae888..1b7d8c3 100644
+--- a/resolve.go
++++ b/resolve.go
+@@ -223,7 +223,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) {
+ 			} else if strings.HasPrefix(plain, "-0b") {
+ 				intv, err := strconv.ParseInt("-"+plain[3:], 2, 64)
+ 				if err == nil {
+-					if true || intv == int64(int(intv)) {
++					if intv == int64(int(intv)) {
+ 						return intTag, int(intv)
+ 					} else {
+ 						return intTag, intv