Blame golang-github-boombuler-barcode.spec

37fe047
# If any of the following macros should be set otherwise,
37fe047
# you can wrap any of them with the following conditions:
37fe047
# - %%if 0%%{centos} == 7
37fe047
# - %%if 0%%{?rhel} == 7
37fe047
# - %%if 0%%{?fedora} == 23
37fe047
# Or just test for particular distribution:
37fe047
# - %%if 0%%{centos}
37fe047
# - %%if 0%%{?rhel}
37fe047
# - %%if 0%%{?fedora}
37fe047
#
37fe047
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
37fe047
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
37fe047
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
37fe047
37fe047
# Generate devel rpm
37fe047
%global with_devel 1
37fe047
# Build project from bundled dependencies
37fe047
%global with_bundled 0
37fe047
# Build with debug info rpm
37fe047
%global with_debug 0
37fe047
# Run tests in check section
37fe047
%global with_check 1
37fe047
# Generate unit-test rpm
37fe047
%global with_unit_test 1
37fe047
37fe047
%if 0%{?with_debug}
37fe047
%global _dwz_low_mem_die_limit 0
37fe047
%else
37fe047
%global debug_package   %{nil}
37fe047
%endif
37fe047
37fe047
37fe047
%global provider        github
37fe047
%global provider_tld    com
37fe047
%global project         boombuler
37fe047
%global repo            barcode
37fe047
# https://github.com/boombuler/barcode
37fe047
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
37fe047
%global import_path     %{provider_prefix}
37fe047
37fe047
Name:           golang-%{provider}-%{project}-%{repo}
86667da
Version:        1.0.0
86667da
Release:        0%{?dist}
37fe047
Summary:        A barcode creation lib for Go (Golang)
37fe047
License:        MIT
37fe047
URL:            https://%{provider_prefix}
86667da
Source0:        https://%{provider_prefix}/archive/v%{version}/%{repo}-%{version}.tar.gz
86667da
86667da
# Go 1.10 runs "go vet" by default, which triggers a few test failures.
86667da
# https://github.com/boombuler/barcode/pull/37
86667da
Patch0:         barcode-1.0.0-IntToRune-testfix.patch
37fe047
37fe047
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
37fe047
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
37fe047
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
37fe047
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
37fe047
37fe047
37fe047
37fe047
%description
37fe047
%{summary}
37fe047
37fe047
%if 0%{?with_devel}
37fe047
%package devel
37fe047
Summary:       %{summary}
37fe047
BuildArch:     noarch
37fe047
37fe047
%if 0%{?with_check} && ! 0%{?with_bundled}
37fe047
%endif
37fe047
37fe047
37fe047
Provides:      golang(%{import_path}) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/aztec) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/codabar) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/code128) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/code39) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/code93) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/datamatrix) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/ean) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/pdf417) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/qr) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/twooffive) = %{version}-%{release}
37fe047
Provides:      golang(%{import_path}/utils) = %{version}-%{release}
37fe047
37fe047
%description devel
37fe047
%{summary}
37fe047
37fe047
This package contains library source intended for
37fe047
building other packages which use import path with
37fe047
%{import_path} prefix.
37fe047
%endif
37fe047
37fe047
%if 0%{?with_unit_test} && 0%{?with_devel}
37fe047
%package unit-test-devel
37fe047
Summary:         Unit tests for %{name} package
37fe047
%if 0%{?with_check}
37fe047
#Here comes all BuildRequires: PACKAGE the unit tests
37fe047
#in %%check section need for running
37fe047
%endif
37fe047
37fe047
# test subpackage tests code from devel subpackage
37fe047
Requires:        %{name}-devel = %{version}-%{release}
37fe047
37fe047
%if 0%{?with_check} && ! 0%{?with_bundled}
37fe047
%endif
37fe047
37fe047
37fe047
%description unit-test-devel
37fe047
%{summary}
37fe047
37fe047
This package contains unit tests for project
37fe047
providing packages with %{import_path} prefix.
37fe047
%endif
37fe047
37fe047
%prep
86667da
%setup -q -n %{repo}-%{version}
86667da
%patch0 -p1
37fe047
37fe047
%build
37fe047
%install
37fe047
# source codes for building projects
37fe047
%if 0%{?with_devel}
37fe047
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
37fe047
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
37fe047
# find all *.go but no *_test.go files and generate devel.file-list
37fe047
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
37fe047
    dirprefix=$(dirname $file)
37fe047
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
37fe047
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
37fe047
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
37fe047
37fe047
    while [ "$dirprefix" != "." ]; do
37fe047
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
37fe047
        dirprefix=$(dirname $dirprefix)
37fe047
    done
37fe047
done
37fe047
%endif
37fe047
37fe047
# testing files for this project
37fe047
%if 0%{?with_unit_test} && 0%{?with_devel}
37fe047
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
37fe047
# find all *_test.go files and generate unit-test-devel.file-list
37fe047
for file in $(find . -iname "*_test.go") ; do
37fe047
    dirprefix=$(dirname $file)
37fe047
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
37fe047
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
37fe047
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
37fe047
37fe047
    while [ "$dirprefix" != "." ]; do
37fe047
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
37fe047
        dirprefix=$(dirname $dirprefix)
37fe047
    done
37fe047
done
37fe047
%endif
37fe047
37fe047
%if 0%{?with_devel}
37fe047
sort -u -o devel.file-list devel.file-list
37fe047
%endif
37fe047
37fe047
%check
37fe047
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
37fe047
%if ! 0%{?with_bundled}
37fe047
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
37fe047
%else
37fe047
# No dependency directories so far
37fe047
37fe047
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
37fe047
%endif
37fe047
37fe047
%if ! 0%{?gotest:1}
37fe047
%global gotest go test
37fe047
%endif
37fe047
37fe047
%gotest %{import_path}/aztec
37fe047
%gotest %{import_path}/codabar
37fe047
%gotest %{import_path}/code128
37fe047
%gotest %{import_path}/code39
37fe047
%gotest %{import_path}/code93
37fe047
%gotest %{import_path}/datamatrix
37fe047
%gotest %{import_path}/ean
37fe047
%gotest %{import_path}/pdf417
37fe047
%gotest %{import_path}/qr
37fe047
%gotest %{import_path}/twooffive
37fe047
%gotest %{import_path}/utils
37fe047
%endif
37fe047
37fe047
#define license tag if not already defined
37fe047
%{!?_licensedir:%global license %doc}
37fe047
37fe047
37fe047
%if 0%{?with_devel}
37fe047
%files devel -f devel.file-list
37fe047
%license LICENSE
37fe047
%doc README.md
37fe047
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
37fe047
%endif
37fe047
37fe047
%if 0%{?with_unit_test} && 0%{?with_devel}
37fe047
%files unit-test-devel -f unit-test-devel.file-list
37fe047
%license LICENSE
37fe047
%doc README.md
37fe047
%endif
37fe047
37fe047
%changelog
86667da
* Wed Mar 14 2018 Ed Marshall <esm@logic.net> - 1.0.0-0
86667da
- Fix FTBFS, switch to release version number rather than git SHA.
86667da
c1ec276
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2.20170922git3cfea5a
c1ec276
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
c1ec276
37fe047
* Sun Oct 08 2017 Ed Marshall <esm@logic.net> - 0-0.1.20170922git3cfea5a
37fe047
- First package for Fedora