File docker-distribution.spec of Package docker-distribution.1173

#
# spec file for package docker-distribution
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           docker-distribution
Version:        2.1.1
Release:        0
Summary:        The Docker toolset to pack, ship, store, and deliver content 
License:        Apache-2.0
Group:          System/Management
Url:            http://www.docker.io
Source:         %{name}-%{version}.tar.bz2
Source1:        registry-configuration.yml
Source2:        registry.service
Source3:        README-registry.SUSE
Patch0:         fix_version.patch
BuildRequires:  go >= 1.3
BuildRequires:  make
BuildRequires:  systemd-devel
PreReq:         %fillup_prereq
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  x86_64

%description
The Docker toolset to pack, ship, store, and deliver content.

The main product of this repository is the new registry implementation for
storing and distributing docker images. It supersedes the docker/docker- registry
project with a new API design, focused around security and performance.

The Distribution project has the further long term goal of providing a secure
tool chain for distributing content. The specifications, APIs and tools shoulds
be as useful with docker as they are without.

%package registry
Summary:        Registry server for Docker
Group:          System/Management

%description registry
Registry server for Docker (hosting/delivering of repositories and images).

%prep
%setup -q -n docker-distribution-%{version}
cp %{SOURCE3} .
%patch0 -p1

%build
export DISTRIBUTION_PKG="github.com/docker/distribution"
mkdir -p .gopath/src/"$(dirname "${DISTRIBUTION_PKG}")"
ln -sf ../../../.. .gopath/src/"${DISTRIBUTION_PKG}"
export GOPATH="$(pwd)/.gopath:$(pwd)/Godeps/_workspace"
# patch version
export VERSION=v%{version}
make binaries

%install
install -d %{buildroot}%{_bindir}
install -D -m755 bin/registry %{buildroot}/%{_bindir}/registry
install -D -m644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/registry/config.yml
mkdir -p %{buildroot}/var/lib/docker-registry

#
# systemd service for registry
#
install -Dd -m 0755 \
   %{buildroot}%{_sysconfdir}/init.d \
   %{buildroot}%{_sbindir}
install -D -m 0644 %SOURCE2 %{buildroot}%{_unitdir}/registry.service
ln -sf /sbin/service $RPM_BUILD_ROOT/usr/sbin/rcregistry

%pre registry
%service_add_pre registry.service

%post registry
%service_add_post registry.service
%{fillup_only -n registry}

%preun registry
%service_del_preun registry.service

%postun registry
%service_del_postun registry.service

%files registry
%defattr(-,root,root)
%{_bindir}/registry
/usr/sbin/rcregistry
%{_unitdir}/registry.service
%config %{_sysconfdir}/registry
%config %{_sysconfdir}/registry/config.yml
%doc LICENSE README.md README-registry.SUSE
/var/lib/docker-registry

%changelog
openSUSE Build Service is sponsored by