cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #01261
[Merge] ~harlowja/cloud-init:kill-brpm into cloud-init:master
Joshua Harlow has proposed merging ~harlowja/cloud-init:kill-brpm into cloud-init:master.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/+git/cloud-init/+merge/307991
Suse may need additional work btw.
--
Your team cloud init development team is requested to review the proposed merge of ~harlowja/cloud-init:kill-brpm into cloud-init:master.
diff --git a/packages/brpm b/packages/brpm
deleted file mode 100755
index 89696ab..0000000
--- a/packages/brpm
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import glob
-import json
-import os
-import shutil
-import sys
-import tempfile
-
-
-def find_root():
- # expected path is in <top_dir>/packages/
- top_dir = os.environ.get("CLOUD_INIT_TOP_D", None)
- if top_dir is None:
- top_dir = os.path.dirname(
- os.path.dirname(os.path.abspath(sys.argv[0])))
- if os.path.isfile(os.path.join(top_dir, 'setup.py')):
- return os.path.abspath(top_dir)
- raise OSError(("Unable to determine where your cloud-init topdir is."
- " set CLOUD_INIT_TOP_D?"))
-
-
-if "avoid-pep8-E402-import-not-top-of-file":
- # Use the util functions from cloudinit
- sys.path.insert(0, find_root())
- from cloudinit import templater
- from cloudinit import util
-
-# Map python requirements to package names. If a match isn't found
-# here, we assume 'python-<pypi_name>'.
-PACKAGE_MAP = {
- 'redhat': {
- 'pyserial': 'pyserial',
- 'pyyaml': 'PyYAML',
- },
- 'suse': {
- 'pyyaml': 'python-yaml',
- }
-}
-
-# Subdirectories of the ~/rpmbuild dir
-RPM_BUILD_SUBDIRS = ['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']
-
-
-def run_helper(helper, args=None, strip=True):
- if args is None:
- args = []
- cmd = [util.abs_join(find_root(), 'tools', helper)] + args
- (stdout, _stderr) = util.subp(cmd)
- if strip:
- stdout = stdout.strip()
- return stdout
-
-
-def read_dependencies():
- '''Returns the Python depedencies from requirements.txt. This explicitly
- removes 'argparse' from the list of requirements for python >= 2.7,
- because with 2.7 argparse became part of the standard library.'''
- stdout = run_helper('read-dependencies')
- return [p.lower().strip() for p in stdout.splitlines()
- if p != 'argparse' or (p == 'argparse' and
- sys.version_info[0:2] < (2, 7))]
-
-
-def translate_dependencies(deps, distro):
- '''Maps python requirements into package names. We assume
- python-<pypi_name> for packages not listed explicitly in
- PACKAGE_MAP.'''
- return [PACKAGE_MAP[distro][req]
- if req in PACKAGE_MAP[distro] else 'python-%s' % req
- for req in deps]
-
-
-def read_version():
- return json.loads(run_helper('read-version', ['--json']))
-
-
-def generate_spec_contents(args, version_data, tmpl_fn, top_dir, arc_fn):
-
- # Tmpl params
- subs = {}
-
- if args.sub_release is not None:
- subs['subrelease'] = str(args.sub_release)
- else:
- subs['subrelease'] = ""
-
- subs['archive_name'] = arc_fn
- subs['source_name'] = os.path.basename(arc_fn).replace('.tar.gz', '')
- subs.update(version_data)
-
- # rpm does not like '-' in the Version, so change
- # X.Y.Z-N-gHASH to X.Y.Z+N.gHASH
- if "-" in version_data.get('version'):
- ver, commits, ghash = version_data['version'].split("-")
- rpm_upstream_version = "%s+%s.%s" % (ver, commits, ghash)
- else:
- rpm_upstream_version = version_data['version']
- subs['rpm_upstream_version'] = rpm_upstream_version
-
- # Map to known packages
- python_deps = read_dependencies()
- package_deps = translate_dependencies(python_deps, args.distro)
- subs['requires'] = package_deps
-
- if args.boot == 'sysvinit':
- subs['sysvinit'] = True
- else:
- subs['sysvinit'] = False
-
- if args.boot == 'systemd':
- subs['systemd'] = True
- else:
- subs['systemd'] = False
-
- subs['init_sys'] = args.boot
- subs['patches'] = [os.path.basename(p) for p in args.patches]
- return templater.render_from_file(tmpl_fn, params=subs)
-
-
-def main():
-
- parser = argparse.ArgumentParser()
- parser.add_argument("-d", "--distro", dest="distro",
- help="select distro (default: %(default)s)",
- metavar="DISTRO", default='redhat',
- choices=('redhat', 'suse'))
- parser.add_argument('--srpm',
- help='Produce a source rpm',
- action='store_true')
- parser.add_argument("-b", "--boot", dest="boot",
- help="select boot type (default: %(default)s)",
- metavar="TYPE", default='sysvinit',
- choices=('sysvinit', 'systemd'))
- parser.add_argument("-v", "--verbose", dest="verbose",
- help=("run verbosely"
- " (default: %(default)s)"),
- default=False,
- action='store_true')
- parser.add_argument('-s', "--sub-release", dest="sub_release",
- metavar="RELEASE",
- help=("a 'internal' release number to concat"
- " with the bzr version number to form"
- " the final version number"),
- type=int,
- default=None)
- parser.add_argument("-p", "--patch", dest="patches",
- help=("include the following patch when building"),
- default=[],
- action='append')
- args = parser.parse_args()
- capture = True
- if args.verbose:
- capture = False
-
- workdir = None
- try:
- workdir = tempfile.mkdtemp(prefix='rpmbuild')
- os.environ['HOME'] = workdir
- topdir = os.path.join(workdir, 'rpmbuild')
- build_dirs = [os.path.join(topdir, dir)
- for dir in RPM_BUILD_SUBDIRS]
- util.ensure_dirs(build_dirs)
-
- version_data = read_version()
-
- # Archive the code
- archive_fn = "cloud-init-%s.tar.gz" % version_data['version_long']
- real_archive_fn = os.path.join(topdir, 'SOURCES', archive_fn)
- archive_fn = run_helper(
- 'make-tarball', ['--long', '--output=' + real_archive_fn])
- print("Archived the code in %r" % (real_archive_fn))
-
- # Form the spec file to be used
- tmpl_fn = util.abs_join(find_root(), 'packages',
- args.distro, 'cloud-init.spec.in')
- contents = generate_spec_contents(args, version_data, tmpl_fn, topdir,
- os.path.basename(archive_fn))
- spec_fn = util.abs_join(topdir, 'SPECS', 'cloud-init.spec')
- util.write_file(spec_fn, contents)
- print("Created spec file at %r" % (spec_fn))
- for p in args.patches:
- util.copy(p, util.abs_join(topdir, 'SOURCES', os.path.basename(p)))
-
- # Now build it!
- print("Running 'rpmbuild' in %r" % (topdir))
-
- if args.srpm:
- cmd = ['rpmbuild', '-bs', '--nodeps', spec_fn]
- else:
- cmd = ['rpmbuild', '-ba', spec_fn]
-
- util.subp(cmd, capture=capture)
-
- # Copy the items built to our local dir
- globs = []
- globs.extend(glob.glob("%s/*.rpm" %
- (util.abs_join(topdir, 'RPMS', 'noarch'))))
- globs.extend(glob.glob("%s/*.rpm" %
- (util.abs_join(topdir, 'RPMS', 'x86_64'))))
- globs.extend(glob.glob("%s/*.rpm" %
- (util.abs_join(topdir, 'RPMS'))))
- globs.extend(glob.glob("%s/*.rpm" %
- (util.abs_join(topdir, 'SRPMS'))))
- for rpm_fn in globs:
- tgt_fn = util.abs_join(os.getcwd(), os.path.basename(rpm_fn))
- shutil.move(rpm_fn, tgt_fn)
- print("Wrote out %s package %r" % (args.distro, tgt_fn))
- finally:
- if workdir is not None:
- shutil.rmtree(workdir)
-
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/packages/redhat/Makefile b/packages/redhat/Makefile
new file mode 100644
index 0000000..798b772
--- /dev/null
+++ b/packages/redhat/Makefile
@@ -0,0 +1,30 @@
+CI_VERSION=$(shell ../../tools/read-version)
+CWD=$(shell pwd)
+ARC_NAME="cloud-init.tar.gz"
+
+ifndef TOPDIR
+ TOPDIR = $(CWD)/build
+endif
+
+rpm: srpm
+ rpmbuild --rebuild --define "_topdir $(TOPDIR)" \
+ --define "_ci_archive $(ARC_NAME)" \
+ $(TOPDIR)/SRPMS/*.src.rpm
+
+srpm: tarball
+ rpmbuild -bs --define "_ci_version $(CI_VERSION)" \
+ --define "_topdir $(TOPDIR)" \
+ --define "_ci_archive $(ARC_NAME)" \
+ cloud-init.spec
+
+tarball:
+ mkdir -p $(TOPDIR)/SOURCES $(TOPDIR)/SRPMS \
+ $(TOPDIR)/SPECS $(TOPDIR)/RPM \
+ $(TOPDIR)/BUILD
+ cd ../../ && ARCHIVE_BASE=cloud-init ./tools/make-tarball \
+ -o $(TOPDIR)/SOURCES/$(ARC_NAME)
+
+clean:
+ rm -rf $(TOPDIR)
+
+.PHONY: srpm tarball clean rpm
diff --git a/packages/redhat/cloud-init.spec b/packages/redhat/cloud-init.spec
new file mode 100644
index 0000000..ec73317
--- /dev/null
+++ b/packages/redhat/cloud-init.spec
@@ -0,0 +1,182 @@
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
+# See: http://www.zarb.org/~jasonc/macros.php
+# Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets
+# Or: http://www.rpm.org/max-rpm/ch-rpm-inside.html
+
+Name: cloud-init
+Version: %{_ci_version}
+Release: 1%{?dist}
+Summary: Cloud instance init scripts
+
+Source0: %{_ci_archive}
+
+Group: System Environment/Base
+License: GPLv3
+URL: http://launchpad.net/cloud-init
+
+BuildArch: noarch
+BuildRoot: %{_tmppath}
+
+BuildRequires: python-devel
+BuildRequires: python-setuptools
+BuildRequires: python-cheetah
+
+# System util packages needed
+Requires: shadow-utils
+Requires: rsyslog
+Requires: iproute
+Requires: e2fsprogs
+Requires: net-tools
+Requires: procps
+Requires: shadow-utils
+Requires: sudo >= 1.7.2p2-3
+
+# Runtime requirements
+Requires: python-jinja2
+Requires: python-prettytable
+Requires: python-oauthlib
+Requires: python-configobj
+Requires: PyYAML
+Requires: python-requests
+Requires: python-jsonpatch
+Requires: python-six
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%define initsys systemd
+%else
+%define initsys sysvinit
+%endif
+
+%if %{initsys} == sysvinit
+Requires(post): chkconfig
+Requires(postun): initscripts
+Requires(preun): chkconfig
+Requires(preun): initscripts
+%else
+BuildRequires: systemd-units
+Requires(post): systemd-units
+Requires(postun): systemd-units
+Requires(preun): systemd-units
+%endif
+
+%description
+Cloud-init is a set of init scripts for cloud instances. Cloud instances
+need special scripts to run during initialization to retrieve and install
+ssh keys and to let the user run various scripts.
+
+%prep
+%setup -q -n cloud-init
+
+%build
+%{__python} setup.py build
+
+%install
+%{__python} setup.py install -O1 \
+ --skip-build --root $RPM_BUILD_ROOT \
+ --init-system=%{initsys}
+
+# Note that /etc/rsyslog.d didn't exist by default until F15.
+# el6 request: https://bugzilla.redhat.com/show_bug.cgi?id=740420
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
+cp -p tools/21-cloudinit.conf \
+ $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
+
+# Remove the tests
+rm -rf $RPM_BUILD_ROOT%{python_sitelib}/tests
+
+# Required dirs...
+mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/cloud
+mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/%{name}
+
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
+cp -p systemd/* $RPM_BUILD_ROOT/%{_unitdir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+
+%if %{initsys} == systemd
+if [ $1 -eq 1 ]
+then
+ /bin/systemctl enable cloud-config.service >/dev/null 2>&1 || :
+ /bin/systemctl enable cloud-final.service >/dev/null 2>&1 || :
+ /bin/systemctl enable cloud-init.service >/dev/null 2>&1 || :
+ /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
+fi
+%else
+/sbin/chkconfig --add %{_initrddir}/cloud-init-local
+/sbin/chkconfig --add %{_initrddir}/cloud-init
+/sbin/chkconfig --add %{_initrddir}/cloud-config
+/sbin/chkconfig --add %{_initrddir}/cloud-final
+%endif
+
+%preun
+
+%if %{initsys} == systemd
+if [ $1 -eq 0 ]
+then
+ /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
+ /bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || :
+ /bin/systemctl --no-reload disable cloud-init.service >/dev/null 2>&1 || :
+ /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
+fi
+%else
+if [ $1 -eq 0 ]
+then
+ /sbin/service cloud-init stop >/dev/null 2>&1 || :
+ /sbin/chkconfig --del cloud-init || :
+ /sbin/service cloud-init-local stop >/dev/null 2>&1 || :
+ /sbin/chkconfig --del cloud-init-local || :
+ /sbin/service cloud-config stop >/dev/null 2>&1 || :
+ /sbin/chkconfig --del cloud-config || :
+ /sbin/service cloud-final stop >/dev/null 2>&1 || :
+ /sbin/chkconfig --del cloud-final || :
+fi
+%endif
+
+%postun
+
+%if %{initsys} == systemd
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%endif
+
+%files
+
+/lib/udev/rules.d/66-azure-ephemeral.rules
+/usr/lib/systemd/system-generators/cloud-init-generator
+
+%if %{initsys} == systemd
+%{_unitdir}/cloud-*
+%{_unitdir}/cloud-*
+%else
+%attr(0755, root, root) %{_initddir}/cloud-config
+%attr(0755, root, root) %{_initddir}/cloud-final
+%attr(0755, root, root) %{_initddir}/cloud-init-local
+%attr(0755, root, root) %{_initddir}/cloud-init
+%endif
+
+# Program binaries
+%{_bindir}/cloud-init*
+%{_libexecdir}/%{name}/uncloud-init
+%{_libexecdir}/%{name}/write-ssh-key-fingerprints
+
+# Docs
+%doc LICENSE ChangeLog TODO.rst requirements.txt
+%doc %{_defaultdocdir}/cloud-init/*
+
+# Configs
+%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
+%dir %{_sysconfdir}/cloud/cloud.cfg.d
+%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
+%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/README
+%dir %{_sysconfdir}/cloud/templates
+%config(noreplace) %{_sysconfdir}/cloud/templates/*
+%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
+
+%{_libexecdir}/%{name}
+%dir %{_sharedstatedir}/cloud
+
+# Python code is here...
+%{python_sitelib}/*
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
deleted file mode 100644
index d0ae048..0000000
--- a/packages/redhat/cloud-init.spec.in
+++ /dev/null
@@ -1,196 +0,0 @@
-## template: cheetah
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
-# See: http://www.zarb.org/~jasonc/macros.php
-# Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets
-# Or: http://www.rpm.org/max-rpm/ch-rpm-inside.html
-
-Name: cloud-init
-Version: ${rpm_upstream_version}
-Release: 1${subrelease}%{?dist}
-Summary: Cloud instance init scripts
-
-Group: System Environment/Base
-License: GPLv3
-URL: http://launchpad.net/cloud-init
-
-Source0: ${archive_name}
-BuildArch: noarch
-BuildRoot: %{_tmppath}
-
-BuildRequires: python-devel
-BuildRequires: python-setuptools
-BuildRequires: python-cheetah
-
-# System util packages needed
-Requires: shadow-utils
-Requires: rsyslog
-Requires: iproute
-Requires: e2fsprogs
-Requires: net-tools
-Requires: procps
-Requires: shadow-utils
-Requires: sudo >= 1.7.2p2-3
-
-# Install pypi 'dynamic' requirements
-#for $r in $requires
-Requires: ${r}
-#end for
-
-# Custom patches
-#set $size = 0
-#for $p in $patches
-Patch${size}: $p
-#set $size += 1
-#end for
-
-#if $sysvinit
-Requires(post): chkconfig
-Requires(postun): initscripts
-Requires(preun): chkconfig
-Requires(preun): initscripts
-#end if
-
-#if $systemd
-BuildRequires: systemd-units
-Requires(post): systemd-units
-Requires(postun): systemd-units
-Requires(preun): systemd-units
-#end if
-
-%description
-Cloud-init is a set of init scripts for cloud instances. Cloud instances
-need special scripts to run during initialization to retrieve and install
-ssh keys and to let the user run various scripts.
-
-%prep
-%setup -q -n ${source_name}
-
-# Custom patches activation
-#set $size = 0
-#for $p in $patches
-%patch${size} -p1
-#set $size += 1
-#end for
-
-%build
-%{__python} setup.py build
-
-%install
-
-%{__python} setup.py install -O1 \
- --skip-build --root \$RPM_BUILD_ROOT \
- --init-system=${init_sys}
-
-# Note that /etc/rsyslog.d didn't exist by default until F15.
-# el6 request: https://bugzilla.redhat.com/show_bug.cgi?id=740420
-mkdir -p \$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
-cp -p tools/21-cloudinit.conf \
- \$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
-
-# Remove the tests
-rm -rf \$RPM_BUILD_ROOT%{python_sitelib}/tests
-
-# Required dirs...
-mkdir -p \$RPM_BUILD_ROOT/%{_sharedstatedir}/cloud
-mkdir -p \$RPM_BUILD_ROOT/%{_libexecdir}/%{name}
-
-#if $systemd
-mkdir -p \$RPM_BUILD_ROOT/%{_unitdir}
-cp -p systemd/* \$RPM_BUILD_ROOT/%{_unitdir}
-#end if
-
-%clean
-rm -rf \$RPM_BUILD_ROOT
-
-%post
-
-#if $systemd
-if [ \$1 -eq 1 ]
-then
- /bin/systemctl enable cloud-config.service >/dev/null 2>&1 || :
- /bin/systemctl enable cloud-final.service >/dev/null 2>&1 || :
- /bin/systemctl enable cloud-init.service >/dev/null 2>&1 || :
- /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
-fi
-#end if
-
-#if $sysvinit
-/sbin/chkconfig --add %{_initrddir}/cloud-init-local
-/sbin/chkconfig --add %{_initrddir}/cloud-init
-/sbin/chkconfig --add %{_initrddir}/cloud-config
-/sbin/chkconfig --add %{_initrddir}/cloud-final
-#end if
-
-%preun
-
-#if $sysvinit
-if [ \$1 -eq 0 ]
-then
- /sbin/service cloud-init stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del cloud-init || :
- /sbin/service cloud-init-local stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del cloud-init-local || :
- /sbin/service cloud-config stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del cloud-config || :
- /sbin/service cloud-final stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del cloud-final || :
-fi
-#end if
-
-#if $systemd
-if [ \$1 -eq 0 ]
-then
- /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
- /bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || :
- /bin/systemctl --no-reload disable cloud-init.service >/dev/null 2>&1 || :
- /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
-fi
-#end if
-
-%postun
-
-#if $systemd
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-#end if
-
-%files
-
-/lib/udev/rules.d/66-azure-ephemeral.rules
-
-#if $sysvinit
-%attr(0755, root, root) %{_initddir}/cloud-config
-%attr(0755, root, root) %{_initddir}/cloud-final
-%attr(0755, root, root) %{_initddir}/cloud-init-local
-%attr(0755, root, root) %{_initddir}/cloud-init
-#end if
-
-#if $systemd
-/usr/lib/systemd/system-generators/cloud-init-generator
-%{_unitdir}/cloud-*
-%{_unitdir}/cloud-*
-#end if
-
-# Program binaries
-%{_bindir}/cloud-init*
-%{_libexecdir}/%{name}/uncloud-init
-%{_libexecdir}/%{name}/write-ssh-key-fingerprints
-
-# Docs
-%doc LICENSE ChangeLog TODO.rst requirements.txt
-%doc %{_defaultdocdir}/cloud-init/*
-
-# Configs
-%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
-%dir %{_sysconfdir}/cloud/cloud.cfg.d
-%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
-%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/README
-%dir %{_sysconfdir}/cloud/templates
-%config(noreplace) %{_sysconfdir}/cloud/templates/*
-%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
-
-%{_libexecdir}/%{name}
-%dir %{_sharedstatedir}/cloud
-
-# Python code is here...
-%{python_sitelib}/*
diff --git a/packages/suse/cloud-init.spec.in b/packages/suse/cloud-init.spec.in
deleted file mode 100644
index f994a0c..0000000
--- a/packages/suse/cloud-init.spec.in
+++ /dev/null
@@ -1,155 +0,0 @@
-## template: cheetah
-
-# See: http://www.zarb.org/~jasonc/macros.php
-# Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets
-# Or: http://www.rpm.org/max-rpm/ch-rpm-inside.html
-
-Name: cloud-init
-Version: ${version}
-Release: 1${subrelease}%{?dist}
-Summary: Cloud instance init scripts
-
-Group: System/Management
-License: GPLv3
-URL: http://launchpad.net/cloud-init
-
-Source0: ${archive_name}
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-
-%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
-
-BuildRequires: fdupes
-BuildRequires: filesystem
-BuildRequires: python-devel
-BuildRequires: python-setuptools
-BuildRequires: python-cheetah
-
-%if 0%{?suse_version} && 0%{?suse_version} <= 1210
- %define initsys sysvinit
-%else
- %define initsys systemd
-%endif
-
-# System util packages needed
-Requires: iproute2
-Requires: e2fsprogs
-Requires: net-tools
-Requires: procps
-Requires: sudo
-
-# Install pypi 'dynamic' requirements
-#for $r in $requires
-Requires: ${r}
-#end for
-
-# Custom patches
-#set $size = 0
-#for $p in $patches
-Patch${size}: $p
-#set $size += 1
-#end for
-
-%description
-Cloud-init is a set of init scripts for cloud instances. Cloud instances
-need special scripts to run during initialization to retrieve and install
-ssh keys and to let the user run various scripts.
-
-%prep
-%setup -q -n ${source_name}
-
-# Custom patches activation
-#set $size = 0
-#for $p in $patches
-%patch${size} -p1
-#set $size += 1
-#end for
-
-%build
-%{__python} setup.py build
-
-%install
-%{__python} setup.py install \
- --skip-build --root=%{buildroot} --prefix=%{_prefix} \
- --record-rpm=INSTALLED_FILES --install-lib=%{python_sitelib} \
- --init-system=%{initsys}
-
-# Remove non-SUSE templates
-rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.debian.*
-rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.redhat.*
-rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.ubuntu.*
-
-# Remove cloud-init tests
-rm -r %{buildroot}/%{python_sitelib}/tests
-
-# Move sysvinit scripts to the correct place and create symbolic links
-%if %{initsys} == sysvinit
- mkdir -p %{buildroot}/%{_initddir}
- mv %{buildroot}%{_sysconfdir}/rc.d/init.d/* %{buildroot}%{_initddir}/
- rmdir %{buildroot}%{_sysconfdir}/rc.d/init.d
- rmdir %{buildroot}%{_sysconfdir}/rc.d
-
- mkdir -p %{buildroot}/%{_sbindir}
- pushd %{buildroot}/%{_initddir}
- for file in * ; do
- ln -s %{_initddir}/\${file} %{buildroot}/%{_sbindir}/rc\${file}
- done
- popd
-%endif
-
-# Move documentation
-mkdir -p %{buildroot}/%{_defaultdocdir}
-mv %{buildroot}/usr/share/doc/cloud-init %{buildroot}/%{_defaultdocdir}
-for doc in TODO LICENSE ChangeLog requirements.txt; do
- cp \${doc} %{buildroot}/%{_defaultdocdir}/cloud-init
-done
-
-# Remove duplicate files
-%if 0%{?suse_version}
- %fdupes %{buildroot}/%{python_sitelib}
-%endif
-
-mkdir -p %{buildroot}/var/lib/cloud
-
-%postun
-%insserv_cleanup
-
-%files
-
-# Sysvinit scripts
-%if %{initsys} == sysvinit
- %attr(0755, root, root) %{_initddir}/cloud-config
- %attr(0755, root, root) %{_initddir}/cloud-final
- %attr(0755, root, root) %{_initddir}/cloud-init-local
- %attr(0755, root, root) %{_initddir}/cloud-init
-
- %{_sbindir}/rccloud-*
-%endif
-
-# Program binaries
-%{_bindir}/cloud-init*
-
-# There doesn't seem to be an agreed upon place for these
-# although it appears the standard says /usr/lib but rpmbuild
-# will try /usr/lib64 ??
-/usr/lib/%{name}/uncloud-init
-/usr/lib/%{name}/write-ssh-key-fingerprints
-
-# Docs
-%doc %{_defaultdocdir}/cloud-init/*
-
-# Configs
-%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
-%dir %{_sysconfdir}/cloud/cloud.cfg.d
-%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
-%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/README
-%dir %{_sysconfdir}/cloud/templates
-%config(noreplace) %{_sysconfdir}/cloud/templates/*
-
-# Python code is here...
-%{python_sitelib}/*
-
-/var/lib/cloud
diff --git a/tools/make-tarball b/tools/make-tarball
index c150dd2..e349929 100755
--- a/tools/make-tarball
+++ b/tools/make-tarball
@@ -35,9 +35,13 @@ while [ $# -ne 0 ]; do
done
rev=${1:-HEAD}
-version=$(git describe ${long_opt} $rev)
+if [ -z "$ARCHIVE_BASE" ]; then
+ version=$(git describe ${long_opt} $rev)
+ archive_base="cloud-init-$version"
+else
+ archive_base="$ARCHIVE_BASE"
+fi
-archive_base="cloud-init-$version"
if [ -z "$output" ]; then
output="$archive_base.tar.gz"
fi
Follow ups