setup.py: rename "daemon type" to "init system"
This brings with it other changes, and also makes an install install all of the requisite init files. (ie, cloud-init needs the -local and the non-local)
This commit is contained in:
parent
df76bcdaf0
commit
833740407e
@ -29,7 +29,7 @@ PKG_MP = {
|
||||
}
|
||||
|
||||
|
||||
def write_debian_folder(root, version, revno, daemon_type):
|
||||
def write_debian_folder(root, version, revno, init_sys):
|
||||
deb_dir = util.abs_join(root, 'debian')
|
||||
os.makedirs(deb_dir)
|
||||
|
||||
@ -67,7 +67,7 @@ def write_debian_folder(root, version, revno, daemon_type):
|
||||
|
||||
templater.render_to_file(util.abs_join('debian', 'rules'),
|
||||
util.abs_join(deb_dir, 'rules'),
|
||||
params={'daemon_type': daemon_type})
|
||||
params={'init_sys': init_sys})
|
||||
|
||||
# Just copy the following directly
|
||||
for base_fn in ['dirs', 'copyright', 'compat', 'pycompat']:
|
||||
|
@ -150,7 +150,7 @@ def generate_spec_contents(args, tmpl_fn):
|
||||
else:
|
||||
subs['systemd'] = False
|
||||
|
||||
subs['daemon_type'] = args.boot
|
||||
subs['init_sys'] = args.boot
|
||||
return templater.render_from_file(tmpl_fn, params=subs)
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ binary-install/cloud-init::cloud-init-fixups
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
||||
include /usr/share/cdbs/1/class/python-distutils.mk
|
||||
|
||||
DEB_PYTHON_INSTALL_ARGS_ALL += --daemon-type={{daemon_type}}
|
||||
DEB_PYTHON_INSTALL_ARGS_ALL += --init-system={{init_sys}}
|
||||
|
||||
DEB_DH_INSTALL_SOURCEDIR := debian/tmp
|
||||
|
||||
|
@ -63,7 +63,7 @@ ssh keys and to let the user run various scripts.
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{__python} setup.py install -O1 \
|
||||
--skip-build --root $RPM_BUILD_ROOT \
|
||||
--daemon-type={{daemon_type}}
|
||||
--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
|
||||
|
52
setup.py
52
setup.py
@ -38,31 +38,17 @@ def is_f(p):
|
||||
return os.path.isfile(p)
|
||||
|
||||
|
||||
DAEMON_FILES = {
|
||||
'initd': filter((lambda x: is_f(x)
|
||||
and x.find('local') == -1), glob('initd/*')),
|
||||
'initd-local': filter((lambda x: is_f(x)
|
||||
and not x.endswith('cloud-init')), glob('initd/*')),
|
||||
INITSYS_FILES = {
|
||||
'sysvinit': filter((lambda x: is_f(x)), glob('sysvinit/*')),
|
||||
'systemd': filter((lambda x: is_f(x)), glob('systemd/*')),
|
||||
'upstart': filter((lambda x: is_f(x)
|
||||
and x.find('local') == -1
|
||||
and x.find('nonet') == -1), glob('upstart/*')),
|
||||
'upstart-nonet': filter((lambda x: is_f(x)
|
||||
and x.find('local') == -1
|
||||
and not x.endswith('cloud-init.conf')), glob('upstart/*')),
|
||||
'upstart-local': filter((lambda x: is_f(x)
|
||||
and x.find('nonet') == -1
|
||||
and not x.endswith('cloud-init.conf')), glob('upstart/*')),
|
||||
'upstart': filter((lambda x: is_f(x)), glob('upstart/*')),
|
||||
}
|
||||
DAEMON_ROOTS = {
|
||||
'initd': '/etc/rc.d/init.d',
|
||||
'initd-local': '/etc/rc.d/init.d',
|
||||
INITSYS_ROOTS = {
|
||||
'sysvinit': '/etc/rc.d/init.d',
|
||||
'systemd': '/etc/systemd/system/',
|
||||
'upstart': '/etc/init/',
|
||||
'upstart-nonet': '/etc/init/',
|
||||
'upstart-local': '/etc/init/',
|
||||
}
|
||||
DAEMON_TYPES = sorted(list(DAEMON_ROOTS.keys()))
|
||||
INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys()))
|
||||
|
||||
|
||||
def tiny_p(cmd, capture=True):
|
||||
@ -94,29 +80,29 @@ def read_requires():
|
||||
|
||||
|
||||
# TODO: Is there a better way to do this??
|
||||
class DaemonInstallData(install):
|
||||
class InitsysInstallData(install):
|
||||
user_options = install.user_options + [
|
||||
# This will magically show up in member variable 'daemon_type'
|
||||
('daemon-type=', None,
|
||||
('daemon type to configure (%s) [default: None]') %
|
||||
(", ".join(DAEMON_TYPES))
|
||||
# This will magically show up in member variable 'init_sys'
|
||||
('init-system=', None,
|
||||
('init system to configure (%s) [default: None]') %
|
||||
(", ".join(INITSYS_TYPES))
|
||||
),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
install.initialize_options(self)
|
||||
self.daemon_type = None
|
||||
self.initsys = None
|
||||
|
||||
def finalize_options(self):
|
||||
install.finalize_options(self)
|
||||
if self.daemon_type and self.daemon_type not in DAEMON_TYPES:
|
||||
if self.initsys and self.initsys not in INITSYS_TYPES:
|
||||
raise DistutilsArgError(
|
||||
("You must specify one of (%s) when"
|
||||
" specifying a daemon type!") % (", ".join(DAEMON_TYPES))
|
||||
" specifying a init system!") % (", ".join(INITSYS_TYPES))
|
||||
)
|
||||
elif self.daemon_type:
|
||||
self.distribution.data_files.append((DAEMON_ROOTS[self.daemon_type],
|
||||
DAEMON_FILES[self.daemon_type]))
|
||||
elif self.initsys:
|
||||
self.distribution.data_files.append((INITSYS_ROOTS[self.initsys],
|
||||
INITSYS_FILES[self.initsys]))
|
||||
# Force that command to reinitalize (with new file list)
|
||||
self.distribution.reinitialize_command('install_data', True)
|
||||
|
||||
@ -145,7 +131,7 @@ setuptools.setup(name='cloud-init',
|
||||
install_requires=read_requires(),
|
||||
cmdclass = {
|
||||
# Use a subclass for install that handles
|
||||
# adding on the right daemon configuration files
|
||||
'install': DaemonInstallData,
|
||||
# adding on the right init system configuration files
|
||||
'install': InitsysInstallData,
|
||||
},
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user