Blame golang-github-dchest-cssmin.spec

9665d2b
# Generate devel rpm
9665d2b
%global with_devel 1
9665d2b
# Build project from bundled dependencies
9665d2b
%global with_bundled 0
9665d2b
# Build with debug info rpm
9665d2b
%global with_debug 0
9665d2b
# Run tests in check section
9665d2b
%global with_check 1
9665d2b
# Generate unit-test rpm
9665d2b
%global with_unit_test 1
9665d2b
9665d2b
%if 0%{?with_debug}
9665d2b
%global _dwz_low_mem_die_limit 0
9665d2b
%else
9665d2b
%global debug_package   %{nil}
9665d2b
%endif
9665d2b
9665d2b
9665d2b
%global provider        github
9665d2b
%global provider_tld    com
9665d2b
%global project         dchest
9665d2b
%global repo            cssmin
9665d2b
# https://github.com/dchest/cssmin
9665d2b
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
9665d2b
%global import_path     %{provider_prefix}
9665d2b
%global commit          fb8d9b44afdc258bfff6052d3667521babcb2239
9665d2b
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
9665d2b
9665d2b
Name:           golang-%{provider}-%{project}-%{repo}
9665d2b
Version:        0
941efb5
Release:        0.8.git%{shortcommit}%{?dist}
9665d2b
Summary:        Go package to minify CSS
9665d2b
License:        BSD
9665d2b
URL:            https://%{provider_prefix}
9665d2b
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
9665d2b
9665d2b
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
9665d2b
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
9665d2b
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
9665d2b
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
9665d2b
9665d2b
9665d2b
9665d2b
%description
9665d2b
%{summary}.
9665d2b
9665d2b
%if 0%{?with_devel}
9665d2b
%package devel
9665d2b
Summary:       %{summary}
9665d2b
BuildArch:     noarch
9665d2b
9665d2b
%if 0%{?with_check} && ! 0%{?with_bundled}
9665d2b
%endif
9665d2b
9665d2b
9665d2b
Provides:      golang(%{import_path}) = %{version}-%{release}
9665d2b
9665d2b
%description devel
9665d2b
%{summary}
9665d2b
9665d2b
This package contains library source intended for
9665d2b
building other packages which use import path with
9665d2b
%{import_path} prefix.
9665d2b
%endif
9665d2b
9665d2b
%if 0%{?with_unit_test} && 0%{?with_devel}
9665d2b
%package unit-test-devel
9665d2b
Summary:         Unit tests for %{name} package
9665d2b
%if 0%{?with_check}
9665d2b
#Here comes all BuildRequires: PACKAGE the unit tests
9665d2b
#in %%check section need for running
9665d2b
%endif
9665d2b
9665d2b
# test subpackage tests code from devel subpackage
9665d2b
Requires:        %{name}-devel = %{version}-%{release}
9665d2b
9665d2b
%if 0%{?with_check} && ! 0%{?with_bundled}
9665d2b
%endif
9665d2b
9665d2b
9665d2b
%description unit-test-devel
9665d2b
%{summary}
9665d2b
9665d2b
This package contains unit tests for project
9665d2b
providing packages with %{import_path} prefix.
9665d2b
%endif
9665d2b
9665d2b
%prep
9665d2b
%setup -q -n %{repo}-%{commit}
9665d2b
9665d2b
%build
9665d2b
%install
9665d2b
# source codes for building projects
9665d2b
%if 0%{?with_devel}
9665d2b
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
9665d2b
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
9665d2b
# find all *.go but no *_test.go files and generate devel.file-list
9665d2b
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
9665d2b
    dirprefix=$(dirname $file)
9665d2b
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
9665d2b
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
9665d2b
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
9665d2b
9665d2b
    while [ "$dirprefix" != "." ]; do
9665d2b
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
9665d2b
        dirprefix=$(dirname $dirprefix)
9665d2b
    done
9665d2b
done
9665d2b
%endif
9665d2b
9665d2b
# testing files for this project
9665d2b
%if 0%{?with_unit_test} && 0%{?with_devel}
9665d2b
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
9665d2b
# find all *_test.go files and generate unit-test-devel.file-list
9665d2b
for file in $(find . -iname "*_test.go") ; do
9665d2b
    dirprefix=$(dirname $file)
9665d2b
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
9665d2b
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
9665d2b
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
9665d2b
9665d2b
    while [ "$dirprefix" != "." ]; do
9665d2b
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
9665d2b
        dirprefix=$(dirname $dirprefix)
9665d2b
    done
9665d2b
done
9665d2b
%endif
9665d2b
9665d2b
%if 0%{?with_devel}
9665d2b
sort -u -o devel.file-list devel.file-list
9665d2b
%endif
9665d2b
9665d2b
%check
9665d2b
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
9665d2b
%if ! 0%{?with_bundled}
9665d2b
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
9665d2b
%else
9665d2b
# No dependency directories so far
9665d2b
9665d2b
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
9665d2b
%endif
9665d2b
9665d2b
%if ! 0%{?gotest:1}
9665d2b
%global gotest go test
9665d2b
%endif
9665d2b
9665d2b
%gotest %{import_path}
9665d2b
%endif
9665d2b
9665d2b
#define license tag if not already defined
9665d2b
%{!?_licensedir:%global license %doc}
9665d2b
9665d2b
9665d2b
%if 0%{?with_devel}
9665d2b
%files devel -f devel.file-list
9665d2b
%license LICENSE
9665d2b
%doc README.md
9665d2b
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
9665d2b
%endif
9665d2b
9665d2b
%if 0%{?with_unit_test} && 0%{?with_devel}
9665d2b
%files unit-test-devel -f unit-test-devel.file-list
9665d2b
%license LICENSE
9665d2b
%doc README.md
9665d2b
%endif
9665d2b
9665d2b
%changelog
941efb5
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.8.gitfb8d9b4
941efb5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
941efb5
a666ba7
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.7.gitfb8d9b4
a666ba7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
a666ba7
7abe8ed
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.gitfb8d9b4
7abe8ed
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7abe8ed
ed5dd6f
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.5.gitfb8d9b4
ed5dd6f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
ed5dd6f
9fe19b7
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.4.gitfb8d9b4
9fe19b7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
9fe19b7
9665d2b
* Mon Mar 06 2017 Athos Ribeiro <athoscr@fedoraproject.org> - 0-0.3.gitfb8d9b4
9665d2b
- Regenerate spec file with gofed 1.0
9665d2b
9665d2b
* Thu Dec 10 2015 Fabio Alessandro Locati <fabio@locati.cc> - 0-0.2.gitfb8d9b4
9665d2b
- Update to version with LICENSE file
9665d2b
9665d2b
* Thu Dec 10 2015 Fabio Alessandro Locati <fabio@locati.cc> - 0-0.1.gita22e1d8
9665d2b
- First package for Fedora