SHA256
1
0
forked from pool/cloud-init
cloud-init/cloud-init.spec

123 lines
3.8 KiB
RPMSpec
Raw Normal View History

#
# spec file for package cloud-init
#
# Copyright (c) 2013 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/
#
%define component cloud-init
Name: %{component}
Version: 0.6.3
Release: 0
Summary: Cloud node initialization tool
License: GPL-3.0
Group: System/Management
Url: http://launchpad.net/cloud-init/
Source0: %{component}-%{version}.tar.bz2
Source1: cloud.cfg.suse
Source2: cloud-init.init
Patch0: drop-MAAS-datasource.diff
Patch1: drop-python27-only-code.diff
Patch2: drop-ubuntu-default-username.diff
# backport fix from upstream version 0.7.1 for bug bnc#818306
Patch3: relative-authorized-keys-file.diff
Requires: python-boto
Requires: python-cheetah
Requires: python-xml
Requires: python-yaml
BuildRequires: filesystem
BuildRequires: python-devel
BuildRequires: python-setuptools
#BuildRequires: python-distribute
BuildRequires: fdupes
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define docdir %{_defaultdocdir}/%{name}
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%{py_requires}
%description
Cloud-init is an init script that initializes a cloud node (VM)
according to the fetched configuration data from the admin node.
Authors:
--------
Scott Moser <scott.moser@canonical.com>
%prep
%setup -q -n %{component}-%{version}
%patch0 -p1
%if 0%{?suse_version} <= 1130
%patch1 -p1
# disable ecdsa for SLE 11 (not available)
echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{S:1}
%endif
%patch2 -p1
%patch3 -p1
%build
python setup.py build
%install
python setup.py install --skip-build --root=%{buildroot} --prefix=%{_prefix} --record-rpm=INSTALLED_FILES --install-lib=%{python_sitelib}
find %{buildroot} \( -name .gitignore -o -name .placeholder \) -delete
mv %{buildroot}/%{_sysconfdir}/init %{buildroot}/%{_sysconfdir}/cloud/
# from debian install script
for x in "%{buildroot}%{_bindir}/"*.py; do
[ -f "${x}" ] && mv "${x}" "${x%.py}"
done
mkdir -p %{buildroot}%{_localstatedir}/lib/cloud
# move documentation
mkdir -p %{buildroot}%{_defaultdocdir}
mv %{buildroot}/usr/share/doc/%{component} %{buildroot}%{docdir}
cp -a %{S:1} %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg
mkdir -p %{buildroot}/%{_initddir} %{buildroot}/%{_sbindir}
cp -a %SOURCE2 %{buildroot}/%{_initddir}/%{component}
ln -s %{_initddir}/%{component} %{buildroot}/%{_sbindir}/rc%{component}
# remove debian/ubuntu specific profile.d file (bnc#779553)
rm -f %{buildroot}%{_sysconfdir}/profile.d/Z99-cloud-locale-test.sh
# remove duplicate files
%if 0%{?suse_version}
%fdupes %{buildroot}%{python_sitelib}
%endif
%files
%defattr(-,root,root)
%{python_sitelib}/cloudinit
%{python_sitelib}/cloud_init*egg-info
%{_bindir}/cloud-init
%{_bindir}/cloud-init-per
%{_bindir}/cloud-init-cfg
%{_sbindir}/rc%{component}
%config(noreplace) %{_sysconfdir}/cloud/
%doc %{docdir}
/usr/lib/cloud-init
%attr(0755, root, root) %{_initddir}/%{component}
%dir %attr(0755, root, root) %{_localstatedir}/lib/cloud
%postun
%insserv_cleanup
%changelog