Blame SPECS/docker-distribution.spec

8a47c0
%if 0%{?fedora} || 0%{?rhel} == 6
8a47c0
%global with_devel 1
8a47c0
%global with_bundled 0
8a47c0
%global with_debug 1
8a47c0
%global with_check 1
8a47c0
%global with_unit_test 1
8a47c0
%else
8a47c0
%global with_devel 0
8a47c0
%global with_bundled 1
8a47c0
%global with_debug 0
8a47c0
%global with_check 0
8a47c0
%global with_unit_test 0
8a47c0
%endif
8a47c0
8a47c0
%if 0%{?with_debug}
8a47c0
%global _dwz_low_mem_die_limit 0
8a47c0
%else
8a47c0
%global debug_package   %{nil}
8a47c0
%endif
8a47c0
8a47c0
%if ! 0%{?gobuild:1}
8a47c0
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
8a47c0
%endif
8a47c0
8a47c0
%if ! 0%{?gotest:1}
8a47c0
%define gotest() go test -ldflags "${LDFLAGS:-}" %{?**}
8a47c0
%endif
8a47c0
8a47c0
%global provider        github
8a47c0
%global provider_tld    com
8a47c0
%global project         docker
8a47c0
%global repo            distribution
8a47c0
# https://github.com/docker/distribution
8a47c0
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
8a47c0
%global import_path     %{provider_prefix}
444916
%global commit          03efb43768979f4d2ea5187bef995656441829e5
8a47c0
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
8a47c0
8a47c0
Name:           %{project}-%{repo}
444916
Version:        2.4.1
444916
Release:        1%{?dist}
8a47c0
Summary:        Docker toolset to pack, ship, store, and deliver content
8a47c0
License:        ASL 2.0
8a47c0
URL:            https://%{provider_prefix}
8a47c0
Source0:        https://%{provider_prefix}/archive/%{commit}.tar.gz
8a47c0
Source1:        %{name}.service
8a47c0
Source2:        config.yml
8a47c0
BuildRequires: systemd
8a47c0
Requires(post): systemd
8a47c0
Requires(preun): systemd
8a47c0
Requires(postun): systemd
db8110
Obsoletes:      docker-registry <= 0.9.1-7
db8110
Provides:       docker-registry = %{version}-%{release}
8a47c0
8a47c0
8a47c0
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
8a47c0
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
8a47c0
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
8a47c0
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
8a47c0
8a47c0
%if ! 0%{?with_bundled}
8a47c0
BuildRequires: golang(github.com/AdRoll/goamz/aws)
8a47c0
BuildRequires: golang(github.com/AdRoll/goamz/cloudfront)
8a47c0
BuildRequires: golang(github.com/AdRoll/goamz/s3)
8a47c0
BuildRequires: golang(github.com/Azure/azure-sdk-for-go/storage)
8a47c0
BuildRequires: golang(github.com/Sirupsen/logrus)
8a47c0
BuildRequires: golang(github.com/Sirupsen/logrus/formatters/logstash)
8a47c0
BuildRequires: golang(github.com/bugsnag/bugsnag-go)
8a47c0
BuildRequires: golang(github.com/denverdino/aliyungo/oss)
8a47c0
BuildRequires: golang(github.com/docker/docker/pkg/tarsum)
8a47c0
BuildRequires: golang(github.com/docker/libtrust)
8a47c0
BuildRequires: golang(github.com/garyburd/redigo/redis)
8a47c0
BuildRequires: golang(github.com/gorilla/handlers)
8a47c0
BuildRequires: golang(github.com/gorilla/mux)
8a47c0
BuildRequires: golang(github.com/mitchellh/mapstructure)
8a47c0
BuildRequires: golang(github.com/ncw/swift)
8a47c0
BuildRequires: golang(github.com/ncw/swift/swifttest)
8a47c0
BuildRequires: golang(github.com/noahdesu/go-ceph/rados)
8a47c0
BuildRequires: golang(github.com/stevvooe/resumable)
8a47c0
BuildRequires: golang(github.com/stevvooe/resumable/sha256)
8a47c0
BuildRequires: golang(github.com/stevvooe/resumable/sha512)
8a47c0
BuildRequires: golang(github.com/yvasiyarov/gorelic)
8a47c0
BuildRequires: golang(golang.org/x/crypto/bcrypt)
8a47c0
BuildRequires: golang(golang.org/x/net/context)
8a47c0
BuildRequires: golang(gopkg.in/check.v1)
8a47c0
BuildRequires: golang(gopkg.in/yaml.v2)
8a47c0
%endif
8a47c0
8a47c0
%description
8a47c0
%{summary}
8a47c0
8a47c0
%if 0%{?with_devel}
8a47c0
%package devel
8a47c0
Summary:       %{summary}
8a47c0
BuildArch:     noarch
8a47c0
8a47c0
%if 0%{?with_check}
8a47c0
BuildRequires: golang(github.com/AdRoll/goamz/aws)
8a47c0
BuildRequires: golang(github.com/AdRoll/goamz/cloudfront)
8a47c0
BuildRequires: golang(github.com/AdRoll/goamz/s3)
8a47c0
BuildRequires: golang(github.com/Azure/azure-sdk-for-go/storage)
8a47c0
BuildRequires: golang(github.com/Sirupsen/logrus)
8a47c0
BuildRequires: golang(github.com/denverdino/aliyungo/oss)
8a47c0
BuildRequires: golang(github.com/docker/docker/pkg/tarsum)
8a47c0
BuildRequires: golang(github.com/docker/libtrust)
8a47c0
BuildRequires: golang(github.com/garyburd/redigo/redis)
8a47c0
BuildRequires: golang(github.com/gorilla/handlers)
8a47c0
BuildRequires: golang(github.com/gorilla/mux)
8a47c0
BuildRequires: golang(github.com/mitchellh/mapstructure)
8a47c0
BuildRequires: golang(github.com/ncw/swift)
8a47c0
BuildRequires: golang(github.com/ncw/swift/swifttest)
8a47c0
BuildRequires: golang(github.com/noahdesu/go-ceph/rados)
8a47c0
BuildRequires: golang(github.com/stevvooe/resumable)
8a47c0
BuildRequires: golang(github.com/stevvooe/resumable/sha256)
8a47c0
BuildRequires: golang(github.com/stevvooe/resumable/sha512)
8a47c0
BuildRequires: golang(golang.org/x/crypto/bcrypt)
8a47c0
BuildRequires: golang(golang.org/x/net/context)
8a47c0
BuildRequires: golang(gopkg.in/check.v1)
8a47c0
BuildRequires: golang(gopkg.in/yaml.v2)
8a47c0
%endif
8a47c0
8a47c0
Requires:      golang(github.com/AdRoll/goamz/aws)
8a47c0
Requires:      golang(github.com/AdRoll/goamz/cloudfront)
8a47c0
Requires:      golang(github.com/AdRoll/goamz/s3)
8a47c0
Requires:      golang(github.com/Azure/azure-sdk-for-go/storage)
8a47c0
Requires:      golang(github.com/Sirupsen/logrus)
8a47c0
Requires:      golang(github.com/denverdino/aliyungo/oss)
8a47c0
Requires:      golang(github.com/docker/docker/pkg/tarsum)
8a47c0
Requires:      golang(github.com/docker/libtrust)
8a47c0
Requires:      golang(github.com/garyburd/redigo/redis)
8a47c0
Requires:      golang(github.com/gorilla/handlers)
8a47c0
Requires:      golang(github.com/gorilla/mux)
8a47c0
Requires:      golang(github.com/mitchellh/mapstructure)
8a47c0
Requires:      golang(github.com/ncw/swift)
8a47c0
Requires:      golang(github.com/ncw/swift/swifttest)
8a47c0
Requires:      golang(github.com/noahdesu/go-ceph/rados)
8a47c0
Requires:      golang(github.com/stevvooe/resumable)
8a47c0
Requires:      golang(github.com/stevvooe/resumable/sha256)
8a47c0
Requires:      golang(github.com/stevvooe/resumable/sha512)
8a47c0
Requires:      golang(golang.org/x/crypto/bcrypt)
8a47c0
Requires:      golang(golang.org/x/net/context)
8a47c0
Requires:      golang(gopkg.in/check.v1)
8a47c0
Requires:      golang(gopkg.in/yaml.v2)
8a47c0
8a47c0
Provides:      golang-%{provider}-%{project}-%{repo}-devel = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/configuration) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/context) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/digest) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/health) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/health/api) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/health/checks) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/manifest) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/notifications) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/api/errcode) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/api/v2) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/auth) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/auth/htpasswd) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/auth/silly) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/auth/token) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/client) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/client/auth) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/client/transport) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/handlers) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/listener) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/middleware/registry) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/middleware/repository) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/proxy) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/proxy/scheduler) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/cache) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/cache/memory) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/cache/redis) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/azure) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/base) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/factory) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/filesystem) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/inmemory) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/middleware) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/middleware/cloudfront) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/oss) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/rados) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/s3) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/swift) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/registry/storage/driver/testsuites) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/testutil) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/uuid) = %{version}-%{release}
8a47c0
Provides:      golang(%{import_path}/version) = %{version}-%{release}
8a47c0
8a47c0
%description devel
8a47c0
%{summary}
8a47c0
8a47c0
This package contains library source intended for
8a47c0
building other packages which use import path with
8a47c0
%{import_path} prefix.
8a47c0
%endif
8a47c0
8a47c0
%if 0%{?with_unit_test} && 0%{?with_devel}
8a47c0
%package unit-test
8a47c0
Summary:         Unit tests for %{name} package
8a47c0
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
8a47c0
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
8a47c0
8a47c0
%if 0%{?with_check}
8a47c0
#Here comes all BuildRequires: PACKAGE the unit tests
8a47c0
#in %%check section need for running
8a47c0
%endif
8a47c0
8a47c0
# test subpackage tests code from devel subpackage
8a47c0
Requires:        %{name}-devel = %{version}-%{release}
8a47c0
8a47c0
%description unit-test
8a47c0
%{summary}
8a47c0
8a47c0
This package contains unit tests for project
8a47c0
providing packages with %{import_path} prefix.
8a47c0
%endif
8a47c0
8a47c0
%prep
8a47c0
%setup -q -n %{repo}-%{commit}
8a47c0
db8110
pushd vendor
db8110
mkdir src
db8110
mv g* src/.
db8110
popd
db8110
8a47c0
%build
8a47c0
mkdir _build
8a47c0
8a47c0
pushd _build
8a47c0
mkdir -p src/github.com/%{project}
8a47c0
ln -s $(dirs +1 -l) src/%{import_path}
8a47c0
popd
8a47c0
8a47c0
%if ! 0%{?with_bundled}
8a47c0
export GOPATH=$(pwd)/_build:%{gopath}
8a47c0
%else
db8110
export GOPATH=$(pwd)/_build:$(pwd)/vendor:%{gopath}
8a47c0
%endif
8a47c0
8a47c0
pushd _build/src/%{import_path}/cmd/registry
8a47c0
go build .
8a47c0
popd
8a47c0
8a47c0
%install
8a47c0
install -d -p %{buildroot}%{_bindir}
8a47c0
install -p -m 0755 cmd/registry/registry %{buildroot}%{_bindir}
8a47c0
8a47c0
# install systemd/init scripts
8a47c0
install -d %{buildroot}%{_unitdir}
8a47c0
install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}
8a47c0
8a47c0
# install config file
8a47c0
install -dp %{buildroot}%{_sysconfdir}/%{name}/registry
8a47c0
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/registry
8a47c0
8a47c0
# install root dir
8a47c0
install -d %{buildroot}%{_sharedstatedir}/registry
8a47c0
8a47c0
# source code for building projects
8a47c0
%if 0%{?with_devel}
8a47c0
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
8a47c0
# find all *.go but no *_test.go files and generate devel.file-list
8a47c0
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
8a47c0
    echo "%dir %{gopath}/src/%{import_path}/$(dirname $file)" >> devel.file-list
8a47c0
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
8a47c0
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
8a47c0
    echo "%{gopath}/src/%{import_path}/$file" >> devel.file-list
8a47c0
done
8a47c0
%endif
8a47c0
8a47c0
# testing files for this project
8a47c0
%if 0%{?with_unit_test} && 0%{?with_devel}
8a47c0
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
8a47c0
# find all *_test.go files and generate unit-test.file-list
8a47c0
for file in $(find . -iname "*_test.go"); do
8a47c0
    echo "%dir %{gopath}/src/%{import_path}/$(dirname $file)" >> devel.file-list
8a47c0
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
8a47c0
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
8a47c0
    echo "%{gopath}/src/%{import_path}/$file" >> unit-test.file-list
8a47c0
done
8a47c0
%endif
8a47c0
8a47c0
%if 0%{?with_devel}
8a47c0
sort -u -o devel.file-list devel.file-list
8a47c0
%endif
8a47c0
8a47c0
%check
8a47c0
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
8a47c0
%if ! 0%{?with_bundled}
8a47c0
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
8a47c0
%else
8a47c0
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
8a47c0
%endif
8a47c0
make test
8a47c0
%endif
8a47c0
8a47c0
%pre
8a47c0
8a47c0
%post
8a47c0
%systemd_post %{name}.service
8a47c0
8a47c0
%preun
8a47c0
%systemd_preun %{name}.service
8a47c0
8a47c0
%postun
8a47c0
%systemd_postun_with_restart %{name}.service
8a47c0
8a47c0
#define license tag if not already defined
8a47c0
%{!?_licensedir:%global license %doc}
8a47c0
8a47c0
%files
8a47c0
%if 0%{?fedora} >= 23
8a47c0
%license LICENSE
8a47c0
%else
8a47c0
%doc LICENSE
8a47c0
%endif
8a47c0
%doc AUTHORS CONTRIBUTING.md MAINTAINERS README.md
8a47c0
%{_bindir}/registry
8a47c0
%{_unitdir}/%{name}.service
8a47c0
%dir %{_sharedstatedir}/registry
8a47c0
%config(noreplace) %{_sysconfdir}/%{name}/registry/config.yml
8a47c0
8a47c0
%if 0%{?with_devel}
8a47c0
%files devel -f devel.file-list
8a47c0
%license LICENSE
8a47c0
%doc CONTRIBUTING.md README.md ROADMAP.md AUTHORS
8a47c0
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
8a47c0
%dir %{gopath}/src/%{import_path}
8a47c0
%endif
8a47c0
8a47c0
%if 0%{?with_unit_test} && 0%{?with_devel}
8a47c0
%files unit-test -f unit-test.file-list
8a47c0
%license LICENSE
8a47c0
%doc CONTRIBUTING.md README.md ROADMAP.md AUTHORS
8a47c0
%endif
8a47c0
8a47c0
%changelog
444916
* Thu Apr 28 2016 Lokesh Mandvekar <lsm5@redhat.com> - 2.4.1-1
444916
- Resolves: #1338871 - rebase to v2.4.1
444916
- Resolves: #1338824 - s3 driver: Sorting completed parts by part number for
444916
a better accordance with S3 spec (upstream PR# 1670)
444916
db8110
* Thu Apr 28 2016 Lokesh Mandvekar <lsm5@redhat.com> - 2.4.0-2
db8110
- Resolves: #1330393 - update unitfile ExecStart
db8110
- From: Luwen Su <lsu@redhat.com>
db8110
db8110
* Tue Apr 19 2016 Lokesh Mandvekar <lsm5@redhat.com> - 2.4.0-1
db8110
- Resolves: rhbz#1328475 - rebase to v2.4.0
db8110
- Resolves: rhbz#1328526 - obsoletes docker-registry <= 0.9.1-7
db8110
def5f1
* Tue Mar 08 2016 Lokesh Mandvekar <lsm5@redhat.com> - 2.3.1-1
def5f1
- Resolves: rhbz#1315881 - rebase to v2.3.1
def5f1
e92828
* Tue Jan 19 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2.2.1-1
e92828
- Resolves: rhbz#1299915 - rebase to v2.2.1
e92828
8a47c0
* Wed Oct 07 2015 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2.1.1-3
8a47c0
- do not install sysconfig file
8a47c0
- Install root dir /var/lib/registry
8a47c0
8a47c0
* Tue Sep 22 2015 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2.1.1-2
8a47c0
- systemd is a dep
8a47c0
8a47c0
* Tue Sep 22 2015 Lokesh Mandvekar <lsm5@fedoraproject.org> - 2.1.1-1
8a47c0
- Resolves: rhbz#1261613 (rhel 7.2) - initial package