Update to latest version.

This commit is contained in:
Elliott Sales de Andrade 2019-11-01 01:11:00 -04:00
parent 32b3139450
commit 1df337fa28
7 changed files with 7 additions and 296 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@
/hugo-0.55.5.tar.gz
/hugo-0.55.6.tar.gz
/hugo-0.58.3.tar.gz
/hugo-0.59.0.tar.gz
/hugo-0.59.1.tar.gz

View File

@ -1,54 +0,0 @@
From 08194c053448050910e3875065e7aa29c760e971 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 1 Mar 2019 18:47:19 -0500
Subject: [PATCH] Fix tests against latest emoji package.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
docs/data/docs.json | 2 +-
tpl/transform/init.go | 2 +-
tpl/transform/transform_test.go | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/data/docs.json b/docs/data/docs.json
index 03bb0357..1f21646f 100644
--- a/docs/data/docs.json
+++ b/docs/data/docs.json
@@ -4109,7 +4109,7 @@
"Examples": [
[
"{{ \"I :heart: Hugo\" | emojify }}",
- "I ❤️ Hugo"
+ "I ❤ Hugo"
]
]
},
diff --git a/tpl/transform/init.go b/tpl/transform/init.go
index 62cb0a9c..2783a513 100644
--- a/tpl/transform/init.go
+++ b/tpl/transform/init.go
@@ -32,7 +32,7 @@ func init() {
ns.AddMethodMapping(ctx.Emojify,
[]string{"emojify"},
[][2]string{
- {`{{ "I :heart: Hugo" | emojify }}`, `I ❤️ Hugo`},
+ {`{{ "I :heart: Hugo" | emojify }}`, `I ❤ Hugo`},
},
)
diff --git a/tpl/transform/transform_test.go b/tpl/transform/transform_test.go
index 13c4bbc2..10b020a0 100644
--- a/tpl/transform/transform_test.go
+++ b/tpl/transform/transform_test.go
@@ -40,7 +40,7 @@ func TestEmojify(t *testing.T) {
expect interface{}
}{
{":notamoji:", template.HTML(":notamoji:")},
- {"I :heart: Hugo", template.HTML("I ❤️ Hugo")},
+ {"I :heart: Hugo", template.HTML("I ❤ Hugo")},
// errors
{tstNoStringer{}, false},
} {
--
2.21.0

View File

@ -1,42 +0,0 @@
From d64e9611109b2eb6de42a47d497cba313252a838 Mon Sep 17 00:00:00 2001
From: Anthony Fok <foka@debian.org>
Date: Wed, 2 Oct 2019 23:40:22 -0600
Subject: [PATCH] resources: Ensure same dirinfos sort order in
TestImageOperationsGolden
Fix filename mismatch errors on Debian auto-building machines
possibly due to different directory order on ext4 vs tmpfs file systems.
---
resources/image_test.go | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/resources/image_test.go b/resources/image_test.go
index 5fa5021c95..169f19522e 100644
--- a/resources/image_test.go
+++ b/resources/image_test.go
@@ -15,6 +15,7 @@ package resources
import (
"fmt"
+ "io/ioutil"
"math/big"
"math/rand"
"os"
@@ -567,15 +568,9 @@ func TestImageOperationsGolden(t *testing.T) {
dir2 := filepath.FromSlash("testdata/golden")
// The two dirs above should now be the same.
- d1, err := os.Open(dir1)
+ dirinfos1, err := ioutil.ReadDir(dir1)
c.Assert(err, qt.IsNil)
- d2, err := os.Open(dir2)
- c.Assert(err, qt.IsNil)
-
- dirinfos1, err := d1.Readdir(-1)
- c.Assert(err, qt.IsNil)
- dirinfos2, err := d2.Readdir(-1)
-
+ dirinfos2, err := ioutil.ReadDir(dir2)
c.Assert(err, qt.IsNil)
c.Assert(len(dirinfos1), qt.Equals, len(dirinfos2))

View File

@ -1,142 +0,0 @@
From 7b2d87787cb57019e818581693cadd0cdc289999 Mon Sep 17 00:00:00 2001
From: Anthony Fok <foka@debian.org>
Date: Mon, 7 Oct 2019 12:35:00 -0600
Subject: [PATCH] resources: Fix image test error on s390x, ppc64* and arm64
In TestImageOperationsGolden, tolerate slight floating-point rounding
differences due to the use or non-use of "fused multiply and add" (FMA)
instruction on different architectures.
Special thanks to @disintegration for the solution in goldenEqual();
see https://github.com/disintegration/gift/issues/20
Fixes #6387
---
resources/image_test.go | 83 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 78 insertions(+), 5 deletions(-)
diff --git a/resources/image_test.go b/resources/image_test.go
index 169f19522e..4b88b7aa12 100644
--- a/resources/image_test.go
+++ b/resources/image_test.go
@@ -15,6 +15,7 @@ package resources
import (
"fmt"
+ "image"
"io/ioutil"
"math/big"
"math/rand"
@@ -22,6 +23,7 @@ import (
"path"
"path/filepath"
"regexp"
+ "runtime"
"strconv"
"sync"
"testing"
@@ -478,6 +480,47 @@ func BenchmarkImageExif(b *testing.B) {
}
+// usesFMA indicates whether "fused multiply and add" (FMA) instruction is
+// used. The command "grep FMADD go/test/codegen/floats.go" can help keep
+// the FMA-using architecture list updated.
+var usesFMA = runtime.GOARCH == "s390x" ||
+ runtime.GOARCH == "ppc64" ||
+ runtime.GOARCH == "ppc64le" ||
+ runtime.GOARCH == "arm64"
+
+// goldenEqual compares two NRGBA images. It is used in golden tests only.
+// A small tolerance is allowed on architectures using "fused multiply and add"
+// (FMA) instruction to accommodate for floating-point rounding differences
+// with control golden images that were generated on amd64 architecture.
+// See https://golang.org/ref/spec#Floating_point_operators
+// and https://github.com/gohugoio/hugo/issues/6387 for more information.
+//
+// Borrowed from https://github.com/disintegration/gift/blob/a999ff8d5226e5ab14b64a94fca07c4ac3f357cf/gift_test.go#L598-L625
+// Copyright (c) 2014-2019 Grigory Dryapak
+// Licensed under the MIT License.
+func goldenEqual(img1, img2 *image.NRGBA) bool {
+ maxDiff := 0
+ if usesFMA {
+ maxDiff = 1
+ }
+ if !img1.Rect.Eq(img2.Rect) {
+ return false
+ }
+ if len(img1.Pix) != len(img2.Pix) {
+ return false
+ }
+ for i := 0; i < len(img1.Pix); i++ {
+ diff := int(img1.Pix[i]) - int(img2.Pix[i])
+ if diff < 0 {
+ diff = -diff
+ }
+ if diff > maxDiff {
+ return false
+ }
+ }
+ return true
+}
+
func TestImageOperationsGolden(t *testing.T) {
c := qt.New(t)
c.Parallel()
@@ -580,21 +623,51 @@ func TestImageOperationsGolden(t *testing.T) {
}
fi2 := dirinfos2[i]
c.Assert(fi1.Name(), qt.Equals, fi2.Name())
- c.Assert(fi1, eq, fi2)
+
f1, err := os.Open(filepath.Join(dir1, fi1.Name()))
c.Assert(err, qt.IsNil)
f2, err := os.Open(filepath.Join(dir2, fi2.Name()))
c.Assert(err, qt.IsNil)
- hash1, err := helpers.MD5FromReader(f1)
+ img1, _, err := image.Decode(f1)
c.Assert(err, qt.IsNil)
- hash2, err := helpers.MD5FromReader(f2)
+ img2, _, err := image.Decode(f2)
c.Assert(err, qt.IsNil)
+ nrgba1 := image.NewNRGBA(img1.Bounds())
+ gift.New().Draw(nrgba1, img1)
+ nrgba2 := image.NewNRGBA(img2.Bounds())
+ gift.New().Draw(nrgba2, img2)
+
+ if !goldenEqual(nrgba1, nrgba2) {
+ switch fi1.Name() {
+ case "gohugoio8_hu7f72c00afdf7634587afaa5eff2a25b2_73538_4c320010919da2d8b63ed24818b4d8e1.png",
+ "gohugoio8_hu7f72c00afdf7634587afaa5eff2a25b2_73538_9d4c2220235b3c2d9fa6506be571560f.png",
+ "gohugoio8_hu7f72c00afdf7634587afaa5eff2a25b2_73538_c74bb417b961e09cf1aac2130b7b9b85.png":
+ c.Log("expectedly differs from golden due to dithering:", fi1.Name())
+ default:
+ t.Errorf("resulting image differs from golden: %s", fi1.Name())
+ }
+ }
+
+ if !usesFMA {
+ c.Assert(fi1, eq, fi2)
+
+ _, err = f1.Seek(0, 0)
+ c.Assert(err, qt.IsNil)
+ _, err = f2.Seek(0, 0)
+ c.Assert(err, qt.IsNil)
+
+ hash1, err := helpers.MD5FromReader(f1)
+ c.Assert(err, qt.IsNil)
+ hash2, err := helpers.MD5FromReader(f2)
+ c.Assert(err, qt.IsNil)
+
+ c.Assert(hash1, qt.Equals, hash2)
+ }
+
f1.Close()
f2.Close()
-
- c.Assert(hash1, qt.Equals, hash2)
}
}

View File

@ -1,44 +0,0 @@
From e825481e553e5a2d60ccbd9930da9060d12cff3d Mon Sep 17 00:00:00 2001
From: Anthony Fok <foka@debian.org>
Date: Tue, 8 Oct 2019 23:46:04 -0600
Subject: [PATCH] deps: Update minify to v2.5.2
- v2.5.1 removes import comments, solving a build error with Go 1.13
in GOPATH mode (used Debian packaging for example)
- v2.5.2 no longer converts polyline/rect/polygon/line to path
as it has been reported to break a SVG referenced by CSS,
see tdewolff/minify#260
The test case for Min SVG in TestResourceChains is updated accordingly.
Fixes pocc/tshark.dev#33
---
go.mod | 2 +-
go.sum | 12 ++++++------
hugolib/resource_chain_test.go | 6 +++---
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index 138e7a4a28..10539d1bb2 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -342,8 +342,8 @@ Min HTML: {{ ( resources.Get "mydata/html1.html" | resources.Minify ).Content |
b.AssertFileContent("public/index.html", `Min JS: var x;x=5;document.getElementById(&#34;demo&#34;).innerHTML=x*10;`)
b.AssertFileContent("public/index.html", `Min JSON: {"employees":[{"firstName":"John","lastName":"Doe"},{"firstName":"Anna","lastName":"Smith"},{"firstName":"Peter","lastName":"Jones"}]}`)
b.AssertFileContent("public/index.html", `Min XML: <hello><world>Hugo Rocks!</<world></hello>`)
- b.AssertFileContent("public/index.html", `Min SVG: <svg height="100" width="100"><path d="M5 10 20 40z"/></svg>`)
- b.AssertFileContent("public/index.html", `Min SVG again: <svg height="100" width="100"><path d="M5 10 20 40z"/></svg>`)
+ b.AssertFileContent("public/index.html", `Min SVG: <svg height="100" width="100"><path d="M1e2 1e2H3e2 2e2z"/></svg>`)
+ b.AssertFileContent("public/index.html", `Min SVG again: <svg height="100" width="100"><path d="M1e2 1e2H3e2 2e2z"/></svg>`)
b.AssertFileContent("public/index.html", `Min HTML: <html><a href=#>Cool</a></html>`)
}},
@@ -580,7 +580,7 @@ document.getElementById("demo").innerHTML = x * 10;
b.WithSourceFile(filepath.Join("assets", "mydata", "svg1.svg"), `
<svg height="100" width="100">
- <line x1="5" y1="10" x2="20" y2="40"/>
+ <path d="M 100 100 L 300 100 L 200 100 z"/>
</svg>
`)

View File

@ -4,7 +4,7 @@
# https://github.com/gohugoio/hugo
%global goipath github.com/gohugoio/hugo
Version: 0.58.3
Version: 0.59.1
%gometa
@ -26,14 +26,6 @@ URL: %{gourl}
Source0: %{gosource}
# Skip test that uses the network.
Patch0001: https://sources.debian.org/data/main/h/hugo/0.58.3-1/debian/patches/0005-skip-modules-TestClient.patch
# Fix build against golang-github-kyokomi-emoji 2.1
Patch0002: 0001-Fix-tests-against-latest-emoji-package.patch
# Fix build against golang-github-tdewolff-minify 2.5.2
Patch0003: https://github.com/gohugoio/hugo/pull/6403.patch
# Fix test susceptible to inconsistent directory order.
Patch0004: https://github.com/gohugoio/hugo/pull/6385.patch
# Fix image tests on other arches.
Patch0005: https://github.com/gohugoio/hugo/pull/6396.patch
BuildRequires: golang(github.com/alecthomas/chroma)
BuildRequires: golang(github.com/alecthomas/chroma/formatters)
@ -133,10 +125,6 @@ BuildRequires: rubygem-asciidoctor
%goprep
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
# Replace blackfriday import path to avoid conflict with v2
# Depend on unversioned tdewolff/minify until Go modules are supported in Fedora
@ -190,6 +178,9 @@ install -Dp man/* -t %{buildroot}%{_mandir}/man1
%changelog
* Fri Nov 01 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.59.1-1
- Update to latest version
* Wed Oct 16 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.58.3-1
- Update to latest version

View File

@ -1 +1 @@
SHA512 (hugo-0.58.3.tar.gz) = eb567c5966532f17a09e50d116077baada398f5440e802395ddfd155270a99ae5377ff208276616089828279365ce680f37014bb211b3c0f3df33a2ef135bf8b
SHA512 (hugo-0.59.1.tar.gz) = 850ca17e7c8c861baabf149fe3f28100b11053b3ad544b562ec52c093207e9b008517400ca0c41f3f4013a10021e009c2abdaef29304878b714e763129228fdd