File diskimage-builder.spec of Package diskimage-builder

#
# spec file for package diskimage-builder
#
# Copyright (c) 2018 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/
#


# Prevent shebangs of element scripts from being added as a requirement (they
# are only ever run inside the disk image build chroot).

%global         __requires_exclude_from ^%{python_sitelib}/diskimage_builder/elements/.*$
Name:           diskimage-builder
Version:        2.14.1
Release:        0
Summary:        Image Building Tools for OpenStack
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/openstack/diskimage-builder
Source0:        https://pypi.io/packages/source/d/%{name}/%{name}-%{version}.tar.gz
Source99:       diskimage-builder-rpmlintrc
BuildRequires:  fdupes
BuildRequires:  findutils
BuildRequires:  python-PyYAML >= 3.10.0
BuildRequires:  python-devel
BuildRequires:  python2-networkx >= 1.10
# Test requirements:
BuildRequires:  python-fixtures
BuildRequires:  python-oslotest
BuildRequires:  python-pbr >= 2.0.0
BuildRequires:  python-setuptools
BuildRequires:  python-stevedore >= 1.20.0
BuildRequires:  python-testrepository
BuildRequires:  python-testtools
BuildRequires:  sed
# No stuff in python_sitelib, thus autoreqprov won't work:
Requires:       kpartx
Requires:       python-Babel >= 2.3.4
Requires:       python-PyYAML >= 3.10.0
Requires:       python-six >= 1.10.0
Requires:       python-stevedore >= 1.20.0
Requires:       python2-networkx >= 1.10
Requires:       qemu-tools
Requires:       python(abi) = %{py_ver}
# diskimage-builder-2.0.0 was merged with python-dib-utils
Provides:       python-dib-utils = %version
Obsoletes:      python-dib-utils < %version
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
These tools are the components of TripleO
(https://wiki.openstack.org/wiki/TripleO) that are responsible for
building disk images.

%prep
%setup -q
# Fix env-script-interpreter rpmlint warning
find diskimage_builder/elements -type f -perm /a+x \
	-exec sh -c "sed -E -i s@^#\!/usr/bin/env[[:space:]]+python@#\!/usr/bin/python@ {}" \;

%build
%{__python2} setup.py build

%install
%{__python2} setup.py install --prefix=%{_prefix} --root=%{buildroot}
%fdupes %{buildroot}
%py_compile %{buildroot}

%check
if [ ! -d ./.testrepository ] ; then testr init ; fi
testr run %{?_smp_mflags:--parallel %{_smp_flags}} #; RET=$? echo "Slowest Tests" ; testr slowest && exit $RET

%files
%defattr(-,root,root,-)
%doc ChangeLog README.rst LICENSE AUTHORS
%{_bindir}/dib-block-device
%{_bindir}/disk-image-create
%{_bindir}/dib-lint
%{_bindir}/element-info
%{_bindir}/ramdisk-image-create
%{python_sitelib}/diskimage_builder/
%{python_sitelib}/diskimage_builder*.egg-info/

%changelog
openSUSE Build Service is sponsored by