diff --git a/0001-Fixes-some-tests-descriptions.patch b/0001-Fixes-some-tests-descriptions.patch new file mode 100644 index 0000000..0d723cb --- /dev/null +++ b/0001-Fixes-some-tests-descriptions.patch @@ -0,0 +1,58 @@ +From 63c50ed6fa86ad94dfa3a8444f837617d9b424e2 Mon Sep 17 00:00:00 2001 +From: Martin Conraux +Date: Fri, 16 Nov 2018 17:20:20 +0100 +Subject: [PATCH] Fixes some tests descriptions + +--- + hcl/parser/parser_test.go | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/hcl/parser/parser_test.go b/hcl/parser/parser_test.go +index 2702122..a75ec07 100644 +--- a/hcl/parser/parser_test.go ++++ b/hcl/parser/parser_test.go +@@ -86,7 +86,7 @@ EOF + + list, ok := item.Val.(*ast.ListType) + if !ok { +- t.Errorf("node should be of type LiteralType, got: %T", item.Val) ++ t.Errorf("node should be of type ListType, got: %T", item.Val) + } + + tokens := []token.Type{} +@@ -177,7 +177,7 @@ func TestListType_leadComment(t *testing.T) { + + list, ok := item.Val.(*ast.ListType) + if !ok { +- t.Fatalf("node should be of type LiteralType, got: %T", item.Val) ++ t.Fatalf("node should be of type ListType, got: %T", item.Val) + } + + if len(list.List) != len(l.comment) { +@@ -228,7 +228,7 @@ func TestListType_lineComment(t *testing.T) { + + list, ok := item.Val.(*ast.ListType) + if !ok { +- t.Fatalf("node should be of type LiteralType, got: %T", item.Val) ++ t.Fatalf("node should be of type ListType, got: %T", item.Val) + } + + if len(list.List) != len(l.comment) { +@@ -240,7 +240,7 @@ func TestListType_lineComment(t *testing.T) { + comment := l.comment[i] + + if (lt.LineComment == nil) != (comment == "") { +- t.Fatalf("bad: %s", lt) ++ t.Fatalf("bad: %#v", lt) + } + + if comment == "" { +@@ -321,7 +321,7 @@ func TestObjectType(t *testing.T) { + // is the object + obj, ok := item.Val.(*ast.ObjectType) + if !ok { +- t.Errorf("node should be of type LiteralType, got: %T", item.Val) ++ t.Errorf("node should be of type ObjectType, got: %T", item.Val) + continue + } + diff --git a/golang-github-hashicorp-hcl.spec b/golang-github-hashicorp-hcl.spec index ce859e0..14a21fd 100644 --- a/golang-github-hashicorp-hcl.spec +++ b/golang-github-hashicorp-hcl.spec @@ -1,70 +1,81 @@ -# http://github.com/hashicorp/hcl +# Generated by go2rpm +%bcond_without check +# https://github.com/hashicorp/hcl %global goipath github.com/hashicorp/hcl Version: 1.0.0 %gometa +%global common_description %{expand: +HCL (HashiCorp Configuration Language) is a configuration language built by +HashiCorp. The goal of HCL is to build a structured configuration language that +is both human and machine friendly for use with command-line tools, but +specifically targeted towards DevOps tools, servers, etc. + +HCL is also fully JSON compatible. That is, JSON can be used as completely valid +input to a system expecting HCL. This helps makes systems interoperable with +other systems. + +HCL is heavily inspired by libucl, nginx configuration, and others similar.} + +%global golicenses LICENSE +%global godocs README.md + +%global gosupfiles glide.lock glide.yaml "${testfiles[@]}" + Name: %{goname} -Release: 2%{?dist} -Summary: HCL is a configuration language +Release: 3%{?dist} +Summary: Hashicorp configuration language + +# Upstream license specification: MPL-2.0 License: MPLv2.0 URL: %{gourl} Source0: %{gosource} Source1: glide.yaml Source2: glide.lock +# https://github.com/hashicorp/hcl/pull/267 +Patch0: https://patch-diff.githubusercontent.com/raw/hashicorp/hcl/pull/267.patch#/0001-Fixes-some-tests-descriptions.patch -%description -%{summary} - -%package devel -Summary: %{summary} -BuildArch: noarch +%if %{with check} +# Tests +BuildRequires: golang(github.com/davecgh/go-spew/spew) +%endif -BuildRequires: golang(github.com/davecgh/go-spew/spew) - -%description devel -%{summary} +%description +%{common_description} -This package contains library source intended for -building other packages which use import path with -%{goipath} prefix. +%gopkg %prep -%forgesetup -cp %{SOURCE1} %{SOURCE2} . +%goprep +%patch0 -p1 +cp %{S:1} %{S:2} . %install -#test-fixtures -files="$(find . -iname 'test-fixtures' -type d) $(find . -iname 'testdata' -type d)" -%goinstall glide.lock glide.yaml $(find $files -type f) - -%check -%gochecks -d hcl/ast -d hcl/fmtcmd +mapfile -t testfiles <<< $(find $(find . -iname 'test-fixtures' -type d) -type f) +%gopkginstall -%pretrans -p devel --- Define the path to directory being replaced below. --- DO NOT add a trailing slash at the end. -path = "/usr/share/gocode/src/github.com/hashicorp/hcl/glide.lock" +# Remove in F33 +# Remove erroneous glide.lock folder +%pretrans devel -p +path = "%{gopath}/src/%{goipath}/glide.lock" st = posix.stat(path) if st and st.type == "directory" then - status = os.rename(path, path .. ".rpmmoved") - if not status then - suffix = 0 - while not status do - suffix = suffix + 1 - status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) - end - os.rename(path, path .. ".rpmmoved") - end + os.remove(path) end -%files devel -f devel.file-list -%license LICENSE -%doc README.md -%ghost /usr/share/gocode/src/github.com/hashicorp/hcl/glide.lock.rpmmoved +%if %{with check} +%check +%gocheck +%endif + +%gopkgfiles %changelog +* Thu Apr 25 23:27:17 CEST 2019 Robert-André Mauchin - 1.0.0-3 +- Update to new macros + * Sat Feb 16 2019 Elliott Sales de Andrade - 1.0.0-2 - Fix broken test data packaging - Fix packaging of glide.lock