Blame golang-github-magiconair-properties.spec

6a1bd53
# If any of the following macros should be set otherwise,
6a1bd53
# you can wrap any of them with the following conditions:
6a1bd53
# - %%if 0%%{centos} == 7
6a1bd53
# - %%if 0%%{?rhel} == 7
6a1bd53
# - %%if 0%%{?fedora} == 23
6a1bd53
# Or just test for particular distribution:
6a1bd53
# - %%if 0%%{centos}
6a1bd53
# - %%if 0%%{?rhel}
6a1bd53
# - %%if 0%%{?fedora}
6a1bd53
#
6a1bd53
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
6a1bd53
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
6a1bd53
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
6a1bd53
6a1bd53
# Generate devel rpm
e31fe1c
%global with_devel 1
6a1bd53
# Build project from bundled dependencies
e31fe1c
%global with_bundled 0
6a1bd53
# Build with debug info rpm
e31fe1c
%global with_debug 0
6a1bd53
# Run tests in check section
e31fe1c
%global with_check 1
6a1bd53
# Generate unit-test rpm
e31fe1c
%global with_unit_test 1
e31fe1c
e31fe1c
%if 0%{?with_debug}
e31fe1c
%global _dwz_low_mem_die_limit 0
e31fe1c
%else
e31fe1c
%global debug_package   %{nil}
e31fe1c
%endif
e31fe1c
e31fe1c
%global provider        github
e31fe1c
%global provider_tld    com
e31fe1c
%global project         magiconair
e31fe1c
%global repo            properties
e31fe1c
# https://github.com/magiconair/properties
e31fe1c
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
e31fe1c
%global import_path     %{provider_prefix}
81b3d37
%global commit          0723e352fa358f9322c938cc2dadda874e9151a9
e31fe1c
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
e31fe1c
e31fe1c
Name:           golang-%{provider}-%{project}-%{repo}
81b3d37
Version:        1.7.0
d4a6026
Release:        3%{?dist}
e31fe1c
Summary:        Java properties scanner for Go
e31fe1c
License:        BSD
e31fe1c
URL:            https://%{provider_prefix}
e31fe1c
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
81b3d37
Patch0:         change-import-paths.patch
e31fe1c
e31fe1c
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
6a1bd53
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
e31fe1c
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
e31fe1c
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
e31fe1c
e31fe1c
%description
e31fe1c
%{summary}
e31fe1c
e31fe1c
%if 0%{?with_devel}
e31fe1c
%package devel
e31fe1c
Summary:       %{summary}
e31fe1c
BuildArch:     noarch
e31fe1c
e31fe1c
%if 0%{?with_check}
e31fe1c
BuildRequires: golang(gopkg.in/check.v1)
e31fe1c
%endif
e31fe1c
e31fe1c
Requires:      golang(gopkg.in/check.v1)
e31fe1c
e31fe1c
Provides:      golang(%{import_path}) = %{version}-%{release}
e31fe1c
e31fe1c
%description devel
e31fe1c
%{summary}
e31fe1c
e31fe1c
This package contains library source intended for
e31fe1c
building other packages which use import path with
e31fe1c
%{import_path} prefix.
e31fe1c
%endif
e31fe1c
e31fe1c
%if 0%{?with_unit_test} && 0%{?with_devel}
e31fe1c
%package unit-test
e31fe1c
Summary:         Unit tests for %{name} package
e31fe1c
%if 0%{?with_check}
e31fe1c
#Here comes all BuildRequires: PACKAGE the unit tests
e31fe1c
#in %%check section need for running
e31fe1c
%endif
e31fe1c
e31fe1c
# test subpackage tests code from devel subpackage
e31fe1c
Requires:        %{name}-devel = %{version}-%{release}
e31fe1c
e31fe1c
%description unit-test
e31fe1c
%{summary}
e31fe1c
e31fe1c
This package contains unit tests for project
e31fe1c
providing packages with %{import_path} prefix.
e31fe1c
%endif
e31fe1c
e31fe1c
%prep
e31fe1c
%setup -q -n %{repo}-%{commit}
81b3d37
%patch0 -p1
e31fe1c
e31fe1c
%build
e31fe1c
e31fe1c
%install
e31fe1c
# source codes for building projects
e31fe1c
%if 0%{?with_devel}
e31fe1c
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
e31fe1c
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
e31fe1c
# find all *.go but no *_test.go files and generate devel.file-list
e31fe1c
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
e31fe1c
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
e31fe1c
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
e31fe1c
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
e31fe1c
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
e31fe1c
done
e31fe1c
%endif
e31fe1c
e31fe1c
# testing files for this project
e31fe1c
%if 0%{?with_unit_test} && 0%{?with_devel}
e31fe1c
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
e31fe1c
# find all *_test.go files and generate unit-test.file-list
e31fe1c
for file in $(find . -iname "*_test.go"); do
e31fe1c
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
e31fe1c
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
e31fe1c
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
e31fe1c
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
e31fe1c
done
e31fe1c
%endif
e31fe1c
e31fe1c
%if 0%{?with_devel}
e31fe1c
sort -u -o devel.file-list devel.file-list
e31fe1c
%endif
e31fe1c
e31fe1c
%check
e31fe1c
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
e31fe1c
%if ! 0%{?with_bundled}
e31fe1c
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
e31fe1c
%else
e31fe1c
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
e31fe1c
%endif
e31fe1c
e31fe1c
%if ! 0%{?gotest:1}
e31fe1c
%global gotest go test
e31fe1c
%endif
e31fe1c
e31fe1c
# constant 4294967296 overflows int
e31fe1c
#%%gotest %%{import_path}
e31fe1c
%endif
e31fe1c
e31fe1c
#define license tag if not already defined
e31fe1c
%{!?_licensedir:%global license %doc}
e31fe1c
e31fe1c
%if 0%{?with_devel}
e31fe1c
%files devel -f devel.file-list
e31fe1c
%license LICENSE
e31fe1c
%doc README.md
e31fe1c
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
e31fe1c
%endif
e31fe1c
e31fe1c
%if 0%{?with_unit_test} && 0%{?with_devel}
e31fe1c
%files unit-test -f unit-test.file-list
e31fe1c
%license LICENSE
e31fe1c
%doc README.md
e31fe1c
%endif
e31fe1c
e31fe1c
%changelog
d4a6026
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-3
d4a6026
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
d4a6026
699c2d6
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-2
699c2d6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
699c2d6
81b3d37
* Wed Jan 18 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.7.0-1
81b3d37
- Bump to upstream 0723e352fa358f9322c938cc2dadda874e9151a9
81b3d37
  related: #1413067
81b3d37
6a1bd53
* Fri Jan 13 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.5.3-5
6a1bd53
- Polish the spec file
6a1bd53
  resolves: #1413067
6a1bd53
8fecd54
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.3-4
8fecd54
- https://fedoraproject.org/wiki/Changes/golang1.7
8fecd54
e3fe02b
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.3-3
e3fe02b
- https://fedoraproject.org/wiki/Changes/golang1.6
e3fe02b
253d1ca
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.3-2
253d1ca
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
253d1ca
e31fe1c
* Thu Oct 08 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git6240095
e31fe1c
- First package for Fedora
e31fe1c
  resolves: #1270054