Blame golang-github-hashicorp-hcl.spec

c408b63
# If any of the following macros should be set otherwise,
c408b63
# you can wrap any of them with the following conditions:
c408b63
# - %%if 0%%{centos} == 7
c408b63
# - %%if 0%%{?rhel} == 7
c408b63
# - %%if 0%%{?fedora} == 23
c408b63
# Or just test for particular distribution:
c408b63
# - %%if 0%%{centos}
c408b63
# - %%if 0%%{?rhel}
c408b63
# - %%if 0%%{?fedora}
c408b63
#
c408b63
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
c408b63
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
c408b63
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
c408b63
c408b63
# Generate devel rpm
Fridolin Pokorny a17912a
%global with_devel 1
c408b63
# Build project from bundled dependencies
Fridolin Pokorny a17912a
%global with_bundled 0
c408b63
# Build with debug info rpm
Fridolin Pokorny a17912a
%global with_debug 0
c408b63
# Run tests in check section
Fridolin Pokorny a17912a
%global with_check 1
c408b63
# Generate unit-test rpm
Fridolin Pokorny a17912a
%global with_unit_test 1
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
%if 0%{?with_debug}
Fridolin Pokorny a17912a
%global _dwz_low_mem_die_limit 0
Fridolin Pokorny a17912a
%else
8f6edcf
%global debug_package   %{nil}
Fridolin Pokorny a17912a
%endif
Fridolin Pokorny a17912a
8f6edcf
%global provider        github
8f6edcf
%global provider_tld    com
8f6edcf
%global project         hashicorp
8f6edcf
%global repo            hcl
8f6edcf
# https://github.com/hashicorp/hcl
Fridolin Pokorny a17912a
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
Fridolin Pokorny a17912a
%global import_path     %{provider_prefix}
5e070b5
%global commit          ef8133da8cda503718a74741312bf50821e6de79
8f6edcf
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
8f6edcf
8f6edcf
Name:           golang-%{provider}-%{project}-%{repo}
8f6edcf
Version:        0
5e070b5
Release:        0.10.git%{shortcommit}%{?dist}
8f6edcf
Summary:        HCL is a configuration language
8f6edcf
License:        MPLv2.0
Fridolin Pokorny a17912a
URL:            https://%{provider_prefix}
Fridolin Pokorny a17912a
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
8f6edcf
5130261
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
c408b63
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
5130261
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
5130261
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
8f6edcf
8f6edcf
%description
8f6edcf
%{summary}
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
%if 0%{?with_devel}
8f6edcf
%package devel
8f6edcf
Summary:       %{summary}
Fridolin Pokorny a17912a
BuildArch:     noarch
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
%if 0%{?with_check}
Fridolin Pokorny a17912a
%endif
Fridolin Pokorny a17912a
8f6edcf
Provides:      golang(%{import_path}) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/ast) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/fmtcmd) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/parser) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/printer) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/scanner) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/strconv) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/hcl/token) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/json/parser) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/json/scanner) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/json/token) = %{version}-%{release}
5e070b5
Provides:      golang(%{import_path}/testhelper) = %{version}-%{release}
8f6edcf
8f6edcf
%description devel
8f6edcf
%{summary}
8f6edcf
8f6edcf
This package contains library source intended for
Fridolin Pokorny a17912a
building other packages which use import path with
Fridolin Pokorny a17912a
%{import_path} prefix.
Fridolin Pokorny a17912a
%endif
Fridolin Pokorny a17912a
5130261
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny a17912a
%package unit-test
Fridolin Pokorny a17912a
Summary:         Unit tests for %{name} package
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
%if 0%{?with_check}
Fridolin Pokorny a17912a
#Here comes all BuildRequires: PACKAGE the unit tests
Fridolin Pokorny a17912a
#in %%check section need for running
5e070b5
BuildRequires: golang(github.com/davecgh/go-spew/spew)
Fridolin Pokorny a17912a
%endif
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
# test subpackage tests code from devel subpackage
Fridolin Pokorny a17912a
Requires:        %{name}-devel = %{version}-%{release}
5e070b5
Requires: golang(github.com/davecgh/go-spew/spew)
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
%description unit-test
Fridolin Pokorny a17912a
%{summary}
Fridolin Pokorny a17912a
Fridolin Pokorny a17912a
This package contains unit tests for project
Fridolin Pokorny a17912a
providing packages with %{import_path} prefix.
Fridolin Pokorny a17912a
%endif
8f6edcf
8f6edcf
%prep
8f6edcf
%setup -q -n %{repo}-%{commit}
8f6edcf
8f6edcf
%build
8f6edcf
8f6edcf
%install
Fridolin Pokorny a17912a
# source codes for building projects
Fridolin Pokorny a17912a
%if 0%{?with_devel}
8f6edcf
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
5130261
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
Fridolin Pokorny a17912a
# find all *.go but no *_test.go files and generate devel.file-list
Fridolin Pokorny a17912a
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
5130261
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
Fridolin Pokorny a17912a
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Fridolin Pokorny a17912a
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Fridolin Pokorny a17912a
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
Fridolin Pokorny a17912a
done
Fridolin Pokorny a17912a
%endif
8f6edcf
Fridolin Pokorny a17912a
# testing files for this project
5130261
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny a17912a
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
Fridolin Pokorny a17912a
# find all *_test.go files and generate unit-test.file-list
Fridolin Pokorny a17912a
for file in $(find . -iname "*_test.go"); do
5130261
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
Fridolin Pokorny a17912a
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Fridolin Pokorny a17912a
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Fridolin Pokorny a17912a
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
Fridolin Pokorny a17912a
done
f56abea
echo "%%{gopath}/src/%%{import_path}/test-fixtures" >> unit-test.file-list
f56abea
cp -r ./test-fixtures %{buildroot}/%{gopath}/src/%{import_path}/.
f56abea
f56abea
echo "%%{gopath}/src/%%{import_path}/hcl/parser/test-fixtures" >> unit-test.file-list
f56abea
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/hcl/parser
f56abea
cp -r ./hcl/parser/test-fixtures %{buildroot}/%{gopath}/src/%{import_path}/hcl/parser/.
f56abea
echo "%%{gopath}/src/%%{import_path}/hcl/printer/testdata" >> unit-test.file-list
f56abea
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/hcl/printer
f56abea
cp -r ./hcl/printer/testdata %{buildroot}/%{gopath}/src/%{import_path}/hcl/printer/.
f56abea
f56abea
echo "%%{gopath}/src/%%{import_path}/json/parser/test-fixtures" >> unit-test.file-list
f56abea
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/json/parser
f56abea
cp -r ./json/parser/test-fixtures %{buildroot}/%{gopath}/src/%{import_path}/json/parser/.
f56abea
Fridolin Pokorny a17912a
%endif
8f6edcf
5130261
%if 0%{?with_devel}
5130261
sort -u -o devel.file-list devel.file-list
5130261
%endif
5130261
8f6edcf
%check
Fridolin Pokorny a17912a
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
5130261
%if ! 0%{?with_bundled}
5130261
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
8f6edcf
%else
5130261
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
Fridolin Pokorny a17912a
%endif
5130261
5130261
%if ! 0%{?gotest:1}
5130261
%global gotest go test
8f6edcf
%endif
Fridolin Pokorny a17912a
5130261
%gotest %{import_path}
f56abea
%gotest %{import_path}/hcl/ast
f56abea
%gotest %{import_path}/hcl/parser
f56abea
%gotest %{import_path}/hcl/printer
f56abea
%gotest %{import_path}/hcl/scanner
f56abea
%gotest %{import_path}/hcl/strconv
f56abea
%gotest %{import_path}/hcl/token
f56abea
%gotest %{import_path}/json/parser
f56abea
%gotest %{import_path}/json/scanner
f56abea
%gotest %{import_path}/json/token
Fridolin Pokorny a17912a
%endif
Fridolin Pokorny a17912a
5130261
#define license tag if not already defined
5130261
%{!?_licensedir:%global license %doc}
5130261
Fridolin Pokorny a17912a
%if 0%{?with_devel}
Fridolin Pokorny a17912a
%files devel -f devel.file-list
5130261
%license LICENSE
Fridolin Pokorny a17912a
%doc README.md
8f6edcf
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
Fridolin Pokorny a17912a
%endif
Fridolin Pokorny a17912a
5130261
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny a17912a
%files unit-test -f unit-test.file-list
5130261
%license LICENSE
Fridolin Pokorny a17912a
%doc README.md
Fridolin Pokorny a17912a
%endif
8f6edcf
8f6edcf
%changelog
5e070b5
* Fri Jan 13 2017 Jan Chaloupka <jchaloup@redhat.com> - 0-0.10.gitef8133d
5e070b5
- Bump to upstream ef8133da8cda503718a74741312bf50821e6de79
5e070b5
  related: #1250468
5e070b5
c408b63
* Thu Jan 12 2017 Jan Chaloupka <jchaloup@redhat.com> - 0-0.9.git2deb1d1
c408b63
- Polish the spec file
c408b63
  related: #1250468
c408b63
d038f54
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.8.git2deb1d1
d038f54
- https://fedoraproject.org/wiki/Changes/golang1.7
d038f54
d64c5de
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.7.git2deb1d1
d64c5de
- https://fedoraproject.org/wiki/Changes/golang1.6
d64c5de
bf9ddba
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.git2deb1d1
bf9ddba
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
bf9ddba
f56abea
* Wed Jan 13 2016 jchaloup <jchaloup@redhat.com> - 0-0.5.git2deb1d1
f56abea
- Copy missing directories with test data and run removed tests
f56abea
  related: #1250468
f56abea
Fridolin Pokorny 80d5248
* Wed Jan 06 2016 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.4.git2deb1d1
Fridolin Pokorny 80d5248
- Bump to upstream 2deb1d1db27ed473f38fe65a16044572b9ff9d30
Fridolin Pokorny 80d5248
  Removed deleted tests
Fridolin Pokorny 80d5248
  related: #1250468
Fridolin Pokorny 80d5248
5130261
* Sat Sep 12 2015 jchaloup <jchaloup@redhat.com> - 0-0.3.git513e04c
5130261
- Update to spec-2.1
5130261
  related: #1250468
5130261
Fridolin Pokorny a17912a
* Wed Aug 05 2015 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.2.git513e04c
Fridolin Pokorny a17912a
- Update spec file to spec-2.0
Fridolin Pokorny a17912a
  resolves: #1250468
Fridolin Pokorny a17912a
8f6edcf
* Wed Apr 15 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git513e04c
8f6edcf
- First package for Fedora
8f6edcf
  resolves: #1212059
5130261