commit:     e952001587955e058a35908e0c0ff6eb93d9a2dd
Author:     Ronny (tastytea) Gutbrod <gentoo <AT> tastytea <DOT> de>
AuthorDate: Tue Mar 29 17:54:10 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Mon Apr 11 13:12:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9520015

www-apps/hugo: add 0.96.0, enable tests

- Enable tests
- Improve unbundling patch
- Don't set buildDate, it is expected to be the time of the git revision
  <https://github.com/gohugoio/hugo/commit/64afb7c>
- Add PVR to vendorInfo to match upstreams expectations
  <https://github.com/gohugoio/hugo/commit/e8df097>

Signed-off-by: Ronny (tastytea) Gutbrod <gentoo <AT> tastytea.de>
Closes: https://github.com/gentoo/gentoo/pull/24812
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 www-apps/hugo/Manifest                             |   2 +
 .../hugo/files/hugo-0.96.0-skip-some-tests.patch   | 120 +++++++++++++++++++++
 .../hugo-0.96.0-unbundle-libwebp-and-libsass.patch |  44 ++++++++
 www-apps/hugo/hugo-0.96.0.ebuild                   |  98 +++++++++++++++++
 4 files changed, 264 insertions(+)

diff --git a/www-apps/hugo/Manifest b/www-apps/hugo/Manifest
index 344172428384..d9c3ee4c6a96 100644
--- a/www-apps/hugo/Manifest
+++ b/www-apps/hugo/Manifest
@@ -2,3 +2,5 @@ DIST hugo-0.93.3-vendor.tar.xz 4828092 BLAKE2B 
4df3e876ffcc71f4caa089512510bec47
 DIST hugo-0.93.3.tar.gz 27852078 BLAKE2B 
8e21fcbacc55cb304314d24f7a1258c9192655cb603e33c2ac2cac5fcc21f83045c1fc3a3ee7bd227507fd08be54e15dcd9cc9629e320bae9b41f1c87d03e163
 SHA512 
c65cc776588604a6ca2fbe5c4081db252ec007311eae54ed81ea65e983f1787edf6e10774d8ace82284eb7c42f6cb70650135ec44b2ddc8994ed511ba2a7d55e
 DIST hugo-0.95.0-vendor.tar.xz 4781084 BLAKE2B 
ead2d42b615fa838995853df38c304c63baccb109f32b5034449cb64c8edacb78e5fac615f2018e8d4acb693f83df0abaa73bc511f5ba31b3a30bdec476420b1
 SHA512 
941061396433a20b524694c8dd2838d84454fbee98c48aa2860881fd9b31b6d480d22f6fd54bd2e17f1f90b1c9e6c3c5813682131fd01c7d3eabc063dcbb01b2
 DIST hugo-0.95.0.tar.gz 27859168 BLAKE2B 
3667ab14c19f586d0f45b76072786a49f2448367cdf4151df2b44a329a57047544dcbbe4db8774433cf2042024c17ccca3269f5eeb508392aed00d31955de55a
 SHA512 
fbe43fc9698325c380d7e7499ee726aba448eebba087f7bdc7cdf14d01e0649869359c07fefaa9a0d9623c910523b82efc2a2b57e152d391443e2b890a29affb
+DIST hugo-0.96.0-vendor.tar.xz 4721504 BLAKE2B 
d8516c848be292f2097961a599450b719b2d760ad3464036929a0937ae6b401ec4b7b90df3281f11a70c4f9a7e94d74e821d78639b9cb3a335a59c5f6e645e65
 SHA512 
d58cbded19c5e2595838725a181e5fcdad94888f1e140e8961d9815c17d7719644483bb9bb34141c26bfccd87412632b1c896c12b85abb76c6448de3d0c8642d
+DIST hugo-0.96.0.tar.gz 27853655 BLAKE2B 
8161eb31b66a9643e31967629852475496dcabd0ef04e806f0d004f3933de07553a10572c201f8b798c7c257d20d7e0e6381bb2892728f89fd3416cc768d76f2
 SHA512 
1dc5e9f433953a1ae378d0eeb24e0647a4c096db96a727ece39c1c4e5d3ef40033ca61aa7a9ed322234e41a116f118115e637c0342b52ee60fe47eea5718ffde

diff --git a/www-apps/hugo/files/hugo-0.96.0-skip-some-tests.patch 
b/www-apps/hugo/files/hugo-0.96.0-skip-some-tests.patch
new file mode 100644
index 000000000000..6f09d1c39660
--- /dev/null
+++ b/www-apps/hugo/files/hugo-0.96.0-skip-some-tests.patch
@@ -0,0 +1,120 @@
+From fb829c60a028067b940aaf268362017a73d40e84 Mon Sep 17 00:00:00 2001
+From: tastytea <[email protected]>
+Date: Tue, 29 Mar 2022 22:28:13 +0200
+Subject: [PATCH] Skip some tests
+
+Reasons:
+  - Needs to be in a git repo
+  - Needs special test dependencies
+  - Needs dart-sass-embedded
+---
+ hugolib/page_test.go                                          | 1 +
+ modules/client_test.go                                        | 4 ++++
+ releaser/git_test.go                                          | 3 +++
+ .../resource_transformers/tocss/dartsass/integration_test.go  | 1 +
+ .../resource_transformers/tocss/scss/integration_test.go      | 1 +
+ 5 files changed, 10 insertions(+)
+
+diff --git a/hugolib/page_test.go b/hugolib/page_test.go
+index d29a4f8..7cdff73 100644
+--- a/hugolib/page_test.go
++++ b/hugolib/page_test.go
+@@ -1025,6 +1025,7 @@ func TestPageWithDate(t *testing.T) {
+ }
+ 
+ func TestPageWithLastmodFromGitInfo(t *testing.T) {
++      t.Skip("We are not in a git repo")
+       if htesting.IsCI() {
+               // TODO(bep) figure out why this fails on GitHub actions.
+               t.Skip("Skip GitInfo test on CI")
+diff --git a/modules/client_test.go b/modules/client_test.go
+index 75e3c2b..235d6ed 100644
+--- a/modules/client_test.go
++++ b/modules/client_test.go
+@@ -68,6 +68,7 @@ github.com/gohugoio/hugoTestModules1_darwin/[email protected] 
github.com/gohugoio/h
+       }
+ 
+       c.Run("All", func(c *qt.C) {
++              c.Skip("Test dependencies not available")
+               client, clean := newClient(c, func(cfg *ClientConfig) {
+                       cfg.ModuleConfig = DefaultModuleConfig
+               }, defaultImport)
+@@ -107,6 +108,7 @@ project 
github.com/gohugoio/hugoTestModules1_darwin/[email protected]+vendor
+       })
+ 
+       c.Run("IgnoreVendor", func(c *qt.C) {
++              c.Skip("Test dependencies not available")
+               client, clean := newClient(
+                       c, func(cfg *ClientConfig) {
+                               cfg.ModuleConfig = DefaultModuleConfig
+@@ -125,6 +127,7 @@ project 
github.com/gohugoio/hugoTestModules1_darwin/[email protected]+vendor
+       })
+ 
+       c.Run("NoVendor", func(c *qt.C) {
++              c.Skip("Test dependencies not available")
+               mcfg := DefaultModuleConfig
+               mcfg.NoVendor = "**"
+               client, clean := newClient(
+@@ -144,6 +147,7 @@ project 
github.com/gohugoio/hugoTestModules1_darwin/[email protected]+vendor
+       })
+ 
+       c.Run("VendorClosest", func(c *qt.C) {
++              c.Skip("Test dependencies not available")
+               mcfg := DefaultModuleConfig
+               mcfg.VendorClosest = true
+ 
+diff --git a/releaser/git_test.go b/releaser/git_test.go
+index ff77eb8..1f40a6f 100644
+--- a/releaser/git_test.go
++++ b/releaser/git_test.go
+@@ -20,6 +20,7 @@ import (
+ )
+ 
+ func TestGitInfos(t *testing.T) {
++      t.Skip("We are not in a git repo")
+       c := qt.New(t)
+       skipIfCI(t)
+       infos, err := getGitInfos("v0.20", "hugo", "", false)
+@@ -58,6 +59,7 @@ Streets #20.
+ }
+ 
+ func TestGitVersionTagBefore(t *testing.T) {
++      t.Skip("We are not in a git repo")
+       skipIfCI(t)
+       c := qt.New(t)
+       v1, err := gitVersionTagBefore("v0.18")
+@@ -66,6 +68,7 @@ func TestGitVersionTagBefore(t *testing.T) {
+ }
+ 
+ func TestTagExists(t *testing.T) {
++      t.Skip("We are not in a git repo")
+       skipIfCI(t)
+       c := qt.New(t)
+       b1, err := tagExists("v0.18")
+diff --git 
a/resources/resource_transformers/tocss/dartsass/integration_test.go 
b/resources/resource_transformers/tocss/dartsass/integration_test.go
+index a1ac1d5..fcd8bf5 100644
+--- a/resources/resource_transformers/tocss/dartsass/integration_test.go
++++ b/resources/resource_transformers/tocss/dartsass/integration_test.go
+@@ -106,6 +106,7 @@ T1: {{ $r.Content | safeHTML }}
+ }
+ 
+ func TestTransformThemeOverrides(t *testing.T) {
++      t.Skip("Needs dart-sass-embedded")
+       if !dartsass.Supports() {
+               t.Skip()
+       }
+diff --git a/resources/resource_transformers/tocss/scss/integration_test.go 
b/resources/resource_transformers/tocss/scss/integration_test.go
+index cbc7e19..f2a6034 100644
+--- a/resources/resource_transformers/tocss/scss/integration_test.go
++++ b/resources/resource_transformers/tocss/scss/integration_test.go
+@@ -111,6 +111,7 @@ moo {
+ }
+ 
+ func TestTransformThemeOverrides(t *testing.T) {
++      t.Skip("Needs dart-sass-embedded")
+       if !scss.Supports() {
+               t.Skip()
+       }
+-- 
+2.35.1
+

diff --git a/www-apps/hugo/files/hugo-0.96.0-unbundle-libwebp-and-libsass.patch 
b/www-apps/hugo/files/hugo-0.96.0-unbundle-libwebp-and-libsass.patch
new file mode 100644
index 000000000000..f9efee48cc48
--- /dev/null
+++ b/www-apps/hugo/files/hugo-0.96.0-unbundle-libwebp-and-libsass.patch
@@ -0,0 +1,44 @@
+From 0a44245bf6cfe103bb163f51f230eeccd69ab8c7 Mon Sep 17 00:00:00 2001
+From: tastytea <[email protected]>
+Date: Tue, 29 Mar 2022 21:03:15 +0200
+Subject: [PATCH] Unbundle libwebp and libsass
+
+Use libwebp and libsass from the system instead of the bundled ones.
+---
+ .../github.com/bep/golibsass/internal/libsass/a__cgo.go   | 8 ++++----
+ vendor/github.com/bep/gowebp/internal/libwebp/a__cgo.go   | 3 ++-
+ 2 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/vendor/github.com/bep/golibsass/internal/libsass/a__cgo.go 
b/vendor/github.com/bep/golibsass/internal/libsass/a__cgo.go
+index af51b92..6b5e78b 100644
+--- a/vendor/github.com/bep/golibsass/internal/libsass/a__cgo.go
++++ b/vendor/github.com/bep/golibsass/internal/libsass/a__cgo.go
+@@ -5,9 +5,9 @@
+ //
+ package libsass
+ 
+-// #cgo CFLAGS: -O2 -fPIC
+-// #cgo CPPFLAGS: -I../../libsass_src/include
+-// #cgo CXXFLAGS: -g -std=c++0x -O2 -fPIC
+-// #cgo LDFLAGS: -lstdc++ -lm
++// #cgo CFLAGS: -fPIC
++// #cgo CPPFLAGS: -DUSE_LIBSASS_SRC
++// #cgo CXXFLAGS: -std=c++0x -fPIC
++// #cgo LDFLAGS: -lstdc++ -lm -lsass
+ // #cgo darwin linux LDFLAGS: -ldl
+ import "C"
+diff --git a/vendor/github.com/bep/gowebp/internal/libwebp/a__cgo.go 
b/vendor/github.com/bep/gowebp/internal/libwebp/a__cgo.go
+index 4b105ab..33f429e 100644
+--- a/vendor/github.com/bep/gowebp/internal/libwebp/a__cgo.go
++++ b/vendor/github.com/bep/gowebp/internal/libwebp/a__cgo.go
+@@ -2,5 +2,6 @@
+ 
+ package libwebp
+ 
+-// #cgo linux LDFLAGS: -lm
++// #cgo linux LDFLAGS: -lm -lwebp
++// #cgo CFLAGS: -DLIBWEBP_NO_SRC
+ import "C"
+-- 
+2.35.1
+

diff --git a/www-apps/hugo/hugo-0.96.0.ebuild b/www-apps/hugo/hugo-0.96.0.ebuild
new file mode 100644
index 000000000000..03c50c742f9a
--- /dev/null
+++ b/www-apps/hugo/hugo-0.96.0.ebuild
@@ -0,0 +1,98 @@
+# Copyright 2018-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit go-module bash-completion-r1 optfeature
+
+DESCRIPTION="Fast static HTML and CSS website generator"
+HOMEPAGE="https://gohugo.io https://github.com/gohugoio/hugo";
+SRC_URI="
+       https://github.com/gohugoio/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       https://tastytea.de/files/${P}-vendor.tar.xz
+"
+
+# NOTE: To create the vendor tarball, run:
+# `go mod vendor && cd .. && tar -cJf ${P}-vendor.tar.xz ${P}/vendor`
+
+LICENSE="Apache-2.0 BSD BSD-2 MIT Unlicense"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc +sass test"
+
+BDEPEND="
+       >=dev-lang/go-1.18
+       test? (
+               dev-python/docutils
+               dev-ruby/asciidoctor
+       )
+"
+RDEPEND="
+       media-libs/libwebp:=
+       sass? ( dev-libs/libsass:= )
+"
+DEPEND="${RDEPEND}"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.96.0-unbundle-libwebp-and-libsass.patch"
+       "${FILESDIR}/${PN}-0.96.0-skip-some-tests.patch"
+)
+
+pkg_setup() {
+       if use test; then
+               optfeature_header "Install additional packages for optional 
tests:"
+               optfeature "pandoc converter tests" "app-text/pandoc"
+       fi
+}
+
+src_configure() {
+       export CGO_ENABLED=1
+       export CGO_CFLAGS="${CFLAGS}"
+       export CGO_CPPFLAGS="${CPPFLAGS}"
+       export CGO_CXXFLAGS="${CXXFLAGS}"
+       export CGO_LDFLAGS="${LDFLAGS}"
+
+       MY_BUILDFLAGS="$(usev sass "-tags extended")"
+
+       default
+}
+
+src_compile() {
+       mkdir -pv bin || die
+       ego build -ldflags "-X 
github.com/gohugoio/hugo/common/hugo.vendorInfo=gentoo:${PVR}" \
+               ${MY_BUILDFLAGS} -o "${S}/bin/hugo"
+
+       bin/hugo gen man --dir man || die
+
+       mkdir -pv completions || die
+       bin/hugo completion bash > completions/hugo || die
+       bin/hugo completion fish > completions/hugo.fish || die
+       bin/hugo completion zsh > completions/_hugo || die
+
+       if use doc ; then
+               bin/hugo gen doc --dir doc || die
+       fi
+}
+
+src_test() {
+       ego test -race "./..." ${MY_BUILDFLAGS}
+}
+
+src_install() {
+       dobin bin/*
+       doman man/*
+
+       dobashcomp completions/${PN}
+
+       insinto /usr/share/fish/vendor_completions.d
+       doins completions/${PN}.fish
+
+       insinto /usr/share/zsh/site-functions
+       doins completions/_${PN}
+
+       if use doc ; then
+               dodoc -r doc/*
+       fi
+}

Reply via email to