From 37aa678a39d8ac568351ce754d202c1069034d1c Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 2 Jul 2012 15:40:51 -0700 Subject: 1. Fixup the setup.py to not include custom startup scripts, let the packaging solutions handle these 2. Get the cloud-init specfile working for the init.d case (with the right postun and post and install sections) a. It works!!! --- packages/brpm | 106 ++++++++++------------------------------------------------ 1 file changed, 17 insertions(+), 89 deletions(-) (limited to 'packages/brpm') diff --git a/packages/brpm b/packages/brpm index bbf30565..3abd9f15 100755 --- a/packages/brpm +++ b/packages/brpm @@ -71,6 +71,7 @@ def get_log_header(version): def format_change_line(ds, who, comment=None): + # Rpmbuild seems to be pretty strict about the date format d = ds.strftime("%a %b %d %Y") d += " - %s" % (who) if comment: @@ -134,94 +135,22 @@ def generate_spec_contents(args, tmpl_fn): changelog_lines.append(line) subs['changelog'] = "\n".join(changelog_lines) - # See: http://www.zarb.org/~jasonc/macros.php - # Pickup any special files - docs = [ - 'TODO', - 'LICENSE', - 'ChangeLog', - 'Requires', - '%{_defaultdocdir}/cloud-init/*', - ] - subs['docs'] = docs - configs = [ - 'cloud/cloud.cfg', - 'cloud/cloud.cfg.d/*.cfg', - 'cloud/cloud.cfg.d/README', - 'cloud/templates/*', - ] - subs['configs'] = configs - other_files = [ - '%{_bindir}/*', - '/usr/lib/cloud-init/*', - ] - - # Since setup.py installs them all, we need to selectively - # remove the wrong ones and ensure the right one/s are kept - # for the boot mode that is desired... - boot_remove = { - 'initd': [ - '/etc/init.d/cloud-init-local', - # Remove the other auto-start folders - '/etc/systemd/', - '/etc/init/', - ], - 'initd-local': [ - '/etc/init.d/cloud-init', - # Remove the other auto-start folders - '/etc/systemd/', - '/etc/init/', - ], - # It seems like systemd can work with - # all of its files being 'active' (and not have naming - # or event name conflicts??) - 'systemd': [ - # Remove the other auto-start folders - '/etc/init.d/', - '/etc/init/', - ], - 'upstart': [ - '/etc/init/cloud-init-nonet.conf', - '/etc/init/cloud-init-local.conf', - # Remove the other auto-start folders - '/etc/init.d/', - '/etc/systemd/', - ], - 'upstart-local': [ - '/etc/init/cloud-init.conf', - # Remove the other auto-start folders - '/etc/init.d/', - '/etc/systemd/', - ] - } - boot_keep = { - 'systemd': [ - '/etc/systemd/*', - ], - 'upstart': [ - '/etc/init/*', - ], - 'upstart-local': [ - '/etc/init/*', - ], - 'initd-local': [ - '/etc/init.d/*', - ], - 'initd': [ - '/etc/init.d/*', - ], - } - subs['post_remove'] = boot_remove[args.boot] - other_files.extend(boot_keep[args.boot]) - subs['files'] = other_files - return templater.render_from_file(tmpl_fn, params=subs) + if args.boot == 'initd': + subs['init_d'] = True + subs['init_d_local'] = False + elif args.boot == 'initd-local': + subs['init_d'] = True + subs['init_d_local'] = True + else: + subs['init_d'] = False + subs['init_d_local'] = False + + if args.boot == 'systemd': + subs['systemd'] = True + else: + subs['systemd'] = False - -def archive_code(): - (stdout, _stderr) = tiny_p([sys.executable, - join(os.getcwd(), 'make-tarball')]) - (revno, version, bname, arc_fn) = stdout.split(None) - return (revno, version, arc_fn) + return templater.render_from_file(tmpl_fn, params=subs) def main(): @@ -230,8 +159,7 @@ def main(): parser.add_argument("-b", "--boot", dest="boot", help="select boot type (default: %(default)s)", metavar="TYPE", default='initd', - choices=('upstart', 'initd', 'systemd', - 'upstart-local', 'initd-local')) + choices=('initd', 'systemd', 'initd-local')) parser.add_argument("-v", "--verbose", dest="verbose", help=("run verbosely" " (default: %(default)s)"), -- cgit v1.2.3