File createrepo.spec of Package createrepo

#
# spec file for package createrepo
#
# Copyright (c) 2014 SUSE LINUX Products 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:           createrepo
Version:        0.10.3
Release:        0
Summary:        Creates a Common Metadata Repository
License:        GPL-2.0+
Group:          System/Packages
Url:            http://linux.duke.edu/metadata/
Source:         http://createrepo.baseurl.org/download/%{name}-%{version}.tar.gz
Patch1:         createrepo-0.9.9-cache_utime.patch
Patch2:         createrepo-0.9.9-cachefix.patch
Patch3:         createrepo-0.9.9-license-to-confirm.patch
Patch4:         createrepo-0.9.9-sort-packages-before-writing-repodata.patch
Patch5:         createrepo-0.9.9-disable-symlinks.patch
Patch6:         createrepo-0.9.9-by_default_no_database.patch
Patch7:         createrepo-0.10.3-modifyrepo-sha.patch
Patch8:         createrepo-0.10.3-fix_MetaDataGenerator.patch
BuildRequires:  python-devel
Requires:       python-deltarpm
Requires:       python-lxml
Requires:       python-urlgrabber
Requires:       rpm >= 4.1.1
Requires:       rpm-python
Requires:       yum-common >= 3.2.25
Requires:       yum-metadata-parser
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This utility generates a common metadata repository from a directory of
RPM packages.

%prep
%setup -q
%patch1
%patch2
%patch3
%patch4 -p1
%patch5
%patch6
%patch7
%patch8 -p1
sed -i "1d" createrepo/{readMetadata,yumbased,utils,deltarpms,merge}.py # Fix non-executable scripts (remove she-bang line)

%build

%install
# Fix the install paths:
sed -i -e 's|PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER)|PYLIBDIR = %{py_libdir}|g' \
%if %{suse_version} < 1120
       -e 's|PKGDIR = $(PYLIBDIR)/site-packages/$(PKGNAME)|PKGDIR = %{_datadir}/%{name}/$(PKGNAME)|g' \
%else
       -e 's|PKGDIR = $(PYLIBDIR)/site-packages/$(PKGNAME)|PKGDIR = %{python_sitearch}/%{name}|g' \
%endif
       createrepo/Makefile
%makeinstall sysconfdir=%{_sysconfdir}
mv $RPM_BUILD_ROOT/%{_sysconfdir}/bash_completion.d/createrepo $RPM_BUILD_ROOT/%{_sysconfdir}/bash_completion.d/createrepo.sh
for i in genpkgmetadata.py mergerepo mergerepo.py modifyrepo modifyrepo.py ; do rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/bash_completion.d/$i ; done

%files
%defattr(-,root,root)
%doc ChangeLog COPYING COPYING.lib README
%{_bindir}/*
%{_mandir}/*/*
%config %{_sysconfdir}/bash_completion.d/createrepo.sh
%{_datadir}/%{name}/
%if %{suse_version} >= 1120
%{python_sitearch}/*
%endif

%changelog
openSUSE Build Service is sponsored by