Blob Blame History Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

%global commit 097381d336017ba772dffd439e316120b639ffbd
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Summary:    Registry server for Docker
Name:       docker-registry
Version:    0.6.8
Release:    13%{?dist}
License:    ASL 2.0
URL:        https://github.com/dotcloud/docker-registry
Source:     https://github.com/lsm5/docker-registry/archive/%{commit}/docker-registry-%{shortcommit}.tar.gz
Source1:    %{name}.service
Source2:    %{name}.sysconfig

BuildRequires:  python2-devel
BuildRequires:  pkgconfig(systemd)

Requires(post):     systemd
Requires(preun):    systemd
Requires(postun):   systemd

Requires:   m2crypto
Requires:   PyYAML
Requires:   python-requests
Requires:   python-gunicorn
Requires:   python-gevent
Requires:   python-blinker
Requires:   python-backports >= 1.0-8
Requires:   python-backports-lzma >= 0.0.2-8
Requires:   python-jinja2
Requires:   python-flask

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

%prep
%setup -qn docker-registry-%{commit}

# Remove the golang implementation
# It's not the main one (yet?)
rm -rf contrib/golang_impl

%install
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_sysconfdir}/sysconfig
install -d %{buildroot}%{_sharedstatedir}/%{name}
install -d %{buildroot}%{python_sitelib}/%{name}

install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}

install -d %{buildroot}%{_unitdir}
install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service

# Make sure we set proper WorkingDir in the systemd service file
sed -i "s|#WORKDIR#|%{python_sitelib}/%{name}|" %{buildroot}%{_unitdir}/%{name}.service

cp -pr docker_registry test %{buildroot}%{python_sitelib}/%{name}
#cp wsgi.py %{buildroot}%{python_sitelib}/%{name}
cp config/config_sample.yml %{buildroot}%{_sysconfdir}/%{name}.yml

echo "local:
    storage: local
    storage_path: %{_sharedstatedir}/%{name}" >> %{buildroot}%{_sysconfdir}/%{name}.yml

#do not authenticate with docker hub by default
sed -i 's/common:/common:\n    standalone: true/' %{buildroot}%{_sysconfdir}/%{name}.yml

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun_with_restart %{name}.service

%files
%doc LICENSE README.md
%dir %{python_sitelib}/%{name}
%dir %{_sharedstatedir}/%{name}
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/%{name}.yml
%{python_sitelib}/%{name}/docker_registry/*.py
%{python_sitelib}/%{name}/docker_registry/*.pyc
%{python_sitelib}/%{name}/docker_registry/*.pyo
%{python_sitelib}/%{name}/docker_registry/lib/*.py
%{python_sitelib}/%{name}/docker_registry/lib/*.pyc
%{python_sitelib}/%{name}/docker_registry/lib/*.pyo
%{python_sitelib}/%{name}/docker_registry/lib/index/*.py
%{python_sitelib}/%{name}/docker_registry/lib/index/*.pyc
%{python_sitelib}/%{name}/docker_registry/lib/index/*.pyo
%{python_sitelib}/%{name}/docker_registry/storage/*.py
%{python_sitelib}/%{name}/docker_registry/storage/*.pyc
%{python_sitelib}/%{name}/docker_registry/storage/*.pyo
%{python_sitelib}/%{name}/test/*.py
%{python_sitelib}/%{name}/test/*.pyc
%{python_sitelib}/%{name}/test/*.pyo
%{python_sitelib}/%{name}/test/Dockerfile
%{python_sitelib}/%{name}/test/dockertest.sh
%{python_sitelib}/%{name}/test/utils/*.py
%{python_sitelib}/%{name}/test/utils/*.pyc
%{python_sitelib}/%{name}/test/utils/*.pyo
%{_unitdir}/%{name}.service

%changelog
* Thu Jan 29 2015 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-13
- use correct min NVR of python-backports
- preserver timestamps of copied files

* Wed Dec 17 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-12
- No longer noarch because python-backports isn't noarch anymore
- remove unused redis python binding patch

* Wed Dec 17 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-11
- Resolves: rhbz#1175305 - should require python-backports-lzma >= 0.0.2-8
- use systemd and not systemd-units

* Fri Nov 21 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-10
- Resolves: rhbz#1158538 - use python-backports instead of
python-backports-lzma
- remove systemd/sysvinit conditionals, only systemd used in RHEL7
- BR: pkgconfig(systemd)

* Fri Oct 24 2014 Tomas Hrcka <thrcka@redhat.com> - 0.6.8-9
- Set standalone:true in docker_registry.yml

* Tue May 06 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-8
- import lzma if no backports.lzma

* Fri May 02 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-7
- do not complain if redis absent

* Wed Apr 30 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-6
- import json if simplejson fails

* Wed Apr 30 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-5
- Add python-flask to requires

* Tue Apr 29 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-4
- remove python-simplejson runtime requirement

* Tue Apr 29 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-3
- remove redis requirement from unitfile

* Wed Apr 23 2014 Lokesh Mandvekar <lsm5@redhat.com> - 0.6.8-2
- M2Crypto branch used: https://github.com/lsm5/docker-registry/tree/m2crypto
- Built for RHEL7

* Fri Apr 18 2014 Marek Goldmann <mgoldman@redhat.com> - 0.6.8-1
- Upstream release 0.6.8

* Mon Apr 07 2014 Marek Goldmann <mgoldman@redhat.com> - 0.6.6-2
- docker-registry settings in /etc/sysconfig/docker-registry not honored,
  RHBZ#1072523

* Thu Mar 20 2014 Marek Goldmann <mgoldman@redhat.com> - 0.6.6-1
- Upstream release 0.6.6
- docker-registry cannot import module jinja2, RHBZ#1077630

* Mon Feb 17 2014 Marek Goldmann <mgoldman@redhat.com> - 0.6.5-1
- Upstream release 0.6.5

* Tue Jan 07 2014 Marek Goldmann <mgoldman@redhat.com> - 0.6.3-1
- Upstream release 0.6.3
- Added python-backports-lzma and python-rsa to R
- Removed configuration file path patch, it's in upstream

* Fri Dec 06 2013 Marek Goldmann <mgoldman@redhat.com> - 0.6.0-4
- Docker-registry does not currently support moving the config file, RHBZ#1038874

* Mon Dec 02 2013 Marek Goldmann <mgoldman@redhat.com> - 0.6.0-3
- EPEL support
- Comments in the sysconfig/docker-registry file

* Wed Nov 27 2013 Marek Goldmann <mgoldman@redhat.com> - 0.6.0-2
- Added license and readme

* Wed Nov 20 2013 Marek Goldmann <mgoldman@redhat.com> - 0.6.0-1
- Initial packaging