c6ad581
%if 0%{?fedora} || 0%{?rhel} == 6
c6ad581
%global with_devel 1
c6ad581
%global with_bundled 1
75f2310
%global with_debug 0
c6ad581
%global with_check 1
c6ad581
%global with_unit_test 1
c6ad581
%else
c6ad581
%global with_devel 0
c6ad581
%global with_bundled 1
c6ad581
%global with_debug 0
c6ad581
%global with_check 0
c6ad581
%global with_unit_test 0
c6ad581
%endif
c6ad581
c6ad581
%if 0%{?with_debug}
c6ad581
%global _dwz_low_mem_die_limit 0
c6ad581
%else
c6ad581
%global debug_package   %{nil}
c6ad581
%endif
c6ad581
c6ad581
%if ! 0%{?gobuild:1}
c6ad581
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
c6ad581
%endif
c6ad581
c6ad581
%global provider        github
c6ad581
%global provider_tld    com
c6ad581
%global project         openshift
c6ad581
%global repo            source-to-image
c6ad581
# https://github.com/openshift/source-to-image
c6ad581
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
c6ad581
%global import_path     %{provider_prefix}
ae25f20
%global commit          226afa1319c3498f47b974ec8ceb36526341a19c
c6ad581
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
c6ad581
c6ad581
%global majorFromGit    1
c6ad581
%global minorFromGit    0+
76a747b
%global versionFromGit  v1.0.9
c6ad581
%global commitFromGit   %{commit}
c6ad581
c6ad581
c6ad581
Name:           %{repo}
ae25f20
Version:        1.1.7
5bbd09d
Release:        3%{?dist}
c6ad581
Summary:        A tool for building artifacts from source and injecting into docker images
c6ad581
License:        ASL 2.0
c6ad581
URL:            https://%{provider_prefix}
76a747b
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
c6ad581
c6ad581
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
c6ad581
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
5a2282a
# there is no docker on ppc64, only on ppc64le
5a2282a
# https://bugzilla.redhat.com/show_bug.cgi?id=1465159
5a2282a
ExcludeArch: ppc64
c6ad581
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
76a747b
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
c6ad581
c6ad581
%if ! 0%{?with_bundled}
c6ad581
BuildRequires: golang(github.com/fsouza/go-dockerclient)
c6ad581
BuildRequires: golang(github.com/golang/glog)
c6ad581
BuildRequires: golang(github.com/spf13/cobra)
c6ad581
BuildRequires: golang(github.com/spf13/pflag)
c6ad581
%endif
c6ad581
c6ad581
Requires:      docker
c6ad581
Requires:      git
c6ad581
Requires:      tar
c6ad581
09e18a1
Provides:      s2i = %{version}-%{release}
09e18a1
c6ad581
%description
c6ad581
%{summary}
c6ad581
c6ad581
%if 0%{?with_devel}
c6ad581
%package devel
c6ad581
Summary:       %{summary}
c6ad581
BuildArch:     noarch
c6ad581
c6ad581
%if 0%{?with_check}
c6ad581
BuildRequires: golang(github.com/fsouza/go-dockerclient)
c6ad581
BuildRequires: golang(github.com/golang/glog)
c6ad581
BuildRequires: golang(github.com/spf13/cobra)
c6ad581
BuildRequires: golang(github.com/spf13/pflag)
c6ad581
%endif
c6ad581
c6ad581
Requires:      golang(github.com/fsouza/go-dockerclient)
c6ad581
Requires:      golang(github.com/golang/glog)
c6ad581
Requires:      golang(github.com/spf13/cobra)
c6ad581
Requires:      golang(github.com/spf13/pflag)
c6ad581
c6ad581
Provides:      golang(%{import_path}) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/api) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/api/describe) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/api/validation) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/build) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/build/ignore) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/build/strategies) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/build/strategies/layered) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/build/strategies/onbuild) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/build/strategies/sti) = %{version}-%{release}
76a747b
Provides:      golang(%{import_path}/pkg/cmd) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/config) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/create) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/create/templates) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/docker) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/docker/test) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/errors) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/ignore) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/run) = %{version}-%{release}
76a747b
Provides:      golang(%{import_path}/pkg/scm) = %{version}-%{release}
76a747b
Provides:      golang(%{import_path}/pkg/scm/empty) = %{version}-%{release}
76a747b
Provides:      golang(%{import_path}/pkg/scm/file) = %{version}-%{release}
76a747b
Provides:      golang(%{import_path}/pkg/scm/git) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/scripts) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/tar) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/test) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/util) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/util/user) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/pkg/version) = %{version}-%{release}
c6ad581
Provides:      golang(%{import_path}/test/integration) = %{version}-%{release}
c6ad581
c6ad581
%description devel
c6ad581
%{summary}
c6ad581
c6ad581
This package contains library source intended for
c6ad581
building other packages which use import path with
c6ad581
%{import_path} prefix.
c6ad581
%endif
c6ad581
c6ad581
%if 0%{?with_unit_test} && 0%{?with_devel}
c6ad581
%package unit-test
c6ad581
Summary:         Unit tests for %{name} package
c6ad581
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
76a747b
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
76a747b
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
c6ad581
c6ad581
%if 0%{?with_check}
c6ad581
#Here comes all BuildRequires: PACKAGE the unit tests
c6ad581
#in %%check section need for running
c6ad581
%endif
c6ad581
c6ad581
# test subpackage tests code from devel subpackage
c6ad581
Requires:        %{name}-devel = %{version}-%{release}
c6ad581
c6ad581
%description unit-test
c6ad581
%{summary}
c6ad581
c6ad581
This package contains unit tests for project
c6ad581
providing packages with %{import_path} prefix.
c6ad581
%endif
c6ad581
c6ad581
%prep
76a747b
%setup -q -n %{repo}-%{commit}
c6ad581
c6ad581
%build
c6ad581
mkdir -p src/github.com/openshift
c6ad581
ln -s ../../../ src/github.com/openshift/source-to-image
c6ad581
c6ad581
%if ! 0%{?with_bundled}
c6ad581
export GOPATH=$(pwd):%{gopath}
c6ad581
%else
c6ad581
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
c6ad581
%endif
c6ad581
c6ad581
export STI_GIT_MAJOR=1.0
c6ad581
export STI_GIT_MINOR=2
c6ad581
export STI_GIT_VERSION=%{commit}
c6ad581
20e0b19
export LDFLAGS="\
20e0b19
	-X %{import_path}/pkg/version.majorFromGit=%{majorFromGit} \
20e0b19
	-X %{import_path}/pkg/version.minorFromGit=%{minorFromGit} \
20e0b19
	-X %{import_path}/pkg/version.versionFromGit=%{versionFromGit} \
20e0b19
	-X %{import_path}/pkg/version.commitFromGit=%{commitFromGit}"
76a747b
%gobuild -o bin/s2i %{import_path}/cmd/s2i
c6ad581
c6ad581
%install
c6ad581
install -d -p %{buildroot}%{_bindir}
c6ad581
install -p -m 0755 bin/s2i %{buildroot}%{_bindir}
c6ad581
c6ad581
# source codes for building projects
c6ad581
%if 0%{?with_devel}
c6ad581
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
c6ad581
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
c6ad581
# find all *.go but no *_test.go files and generate devel.file-list
76a747b
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
c6ad581
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
c6ad581
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
c6ad581
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
c6ad581
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
c6ad581
done
c6ad581
%endif
c6ad581
c6ad581
# testing files for this project
c6ad581
%if 0%{?with_unit_test} && 0%{?with_devel}
c6ad581
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
c6ad581
# find all *_test.go files and generate unit-test.file-list
76a747b
for file in $(find . -iname "*_test.go"); do
c6ad581
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
c6ad581
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
c6ad581
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
c6ad581
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
c6ad581
done
c6ad581
%endif
c6ad581
c6ad581
%if 0%{?with_devel}
c6ad581
sort -u -o devel.file-list devel.file-list
c6ad581
%endif
c6ad581
c6ad581
%check
c6ad581
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
c6ad581
%if ! 0%{?with_bundled}
c6ad581
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
c6ad581
%else
c6ad581
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
c6ad581
%endif
c6ad581
c6ad581
%if ! 0%{?gotest:1}
c6ad581
%global gotest go test
c6ad581
%endif
c6ad581
76a747b
%gotest %{import_path}/pkg/api
76a747b
%gotest %{import_path}/pkg/api/validation
c6ad581
%gotest %{import_path}/pkg/build/strategies/layered
c6ad581
%gotest %{import_path}/pkg/build/strategies/onbuild
c6ad581
%gotest %{import_path}/pkg/build/strategies/sti
c6ad581
%gotest %{import_path}/pkg/docker
c6ad581
%gotest %{import_path}/pkg/ignore
76a747b
#%%gotest %%{import_path}/pkg/scm
20e0b19
#%gotest %{import_path}/pkg/scm/git
c6ad581
%gotest %{import_path}/pkg/scripts
c6ad581
%gotest %{import_path}/pkg/tar
c6ad581
%gotest %{import_path}/pkg/util
c6ad581
%gotest %{import_path}/pkg/util/user
c6ad581
%gotest %{import_path}/test/integration
c6ad581
%endif
c6ad581
c6ad581
#define license tag if not already defined
c6ad581
%{!?_licensedir:%global license %doc}
c6ad581
c6ad581
%files
c6ad581
%license LICENSE
c6ad581
%doc README.md CONTRIBUTING.md AUTHORS
c6ad581
%{_bindir}/s2i
c6ad581
c6ad581
%if 0%{?with_devel}
c6ad581
%files devel -f devel.file-list
c6ad581
%license LICENSE
c6ad581
%doc README.md CONTRIBUTING.md AUTHORS
c6ad581
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
c6ad581
%endif
c6ad581
c6ad581
%if 0%{?with_unit_test} && 0%{?with_devel}
c6ad581
%files unit-test -f unit-test.file-list
c6ad581
%license LICENSE
c6ad581
%doc README.md CONTRIBUTING.md AUTHORS
c6ad581
%endif
c6ad581
c6ad581
%changelog
5bbd09d
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.7-3
5bbd09d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
5bbd09d
7bdc16f
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.7-2
7bdc16f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7bdc16f
ae25f20
* Tue Nov 07 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.1.7-1
ae25f20
- Update to v1.1.7
ae25f20
  resolves: #1510476
ae25f20
f3ba684
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-7
f3ba684
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
f3ba684
ecf2641
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-6
ecf2641
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
ecf2641
5a2282a
* Mon Jun 26 2017 Till Maas <opensource@till.name> - 1.0.9-5
5a2282a
- Do not build on ppc64 (does not contain docker)
5a2282a
20e0b19
* Mon May 15 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.0.9-4
20e0b19
- Fix go-1.8 -X importpath/name=value syntax
20e0b19
056ca32
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-3
056ca32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
056ca32
495cd20
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.9-2
495cd20
- https://fedoraproject.org/wiki/Changes/golang1.7
495cd20
76a747b
* Sat May 21 2016 jchaloup <jchaloup@redhat.com> - 1.0.9-1
76a747b
- Update to v1.0.9
76a747b
  resolves: #1273677
76a747b
85edc59
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4-3
85edc59
- https://fedoraproject.org/wiki/Changes/golang1.6
85edc59
5a1d81e
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-2
5a1d81e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
5a1d81e
331a83a
* Thu Dec 10 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.4-1
331a83a
- New upstream release
331a83a
- https://github.com/openshift/source-to-image/releases/tag/v1.0.4
331a83a
69882c1
* Thu Oct 22 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.3-2
4c7bdc4
- Rebase to new upstream version
4c7bdc4
- Package now provides s2i
69882c1
- Disable tests removed by upstream
4c7bdc4
c6ad581
* Thu Sep 17 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.2-4
c6ad581
- Fix dependencies
c6ad581
- Remove -devel sub package
c6ad581
c6ad581
* Tue Sep 15 2015 Tomas Hrcka <thrcka@redhat.com> - 1.0.2-2
c6ad581
- Build the right directory
c6ad581
c6ad581
* Mon Sep 14 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git00d1cb3
c6ad581
- First package for Fedora
c6ad581
c6ad581