Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add init, default, preinst, prerm, postinst and postrm #50

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 56 additions & 4 deletions stdeb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'expand_sdist_file','stdeb_cfg_options']

DH_MIN_VERS = '7' # Fundamental to stdeb >= 0.4
DH_IDEAL_VERS = '7.4.3' # fixes Debian bug 548392
DH_IDEAL_VERS = '7.0.15' # fixes Debian bug 548392

PYSUPPORT_MIN_VERS = '0.8.4' # Namespace package support was added
# sometime between 0.7.5ubuntu1 and
Expand Down Expand Up @@ -126,6 +126,12 @@ def check_call(*popenargs, **kwargs):
('shared-mime-file=',None,'shared MIME file'),
('setup-env-vars=',None,'environment variables passed to setup.py'),
('udev-rules=',None,'file with rules to install to udev'),
('init=',None,'the package init script'),
('default=',None,'the package default file'),
('preinst=',None,'the script to execute before installation'),
('postinst=',None,'the script to execute after installation'),
('prerm=',None,'the script to execute before remove'),
('postrm=',None,'the script to execute after remove'),
]

stdeb_cmd_bool_opts = [
Expand Down Expand Up @@ -639,7 +645,7 @@ def __init__(self,
setup_requires=None,
debian_version=None,
workaround_548392=None,
force_buildsystem=None,
force_buildsystem=False,
have_script_entry_points = None,
pycentral_backwards_compatibility=None,
use_setuptools = False,
Expand Down Expand Up @@ -747,6 +753,14 @@ def __init__(self,
self.architecture = 'all'

self.copyright_file = parse_val(cfg,module_name,'Copyright-File')
self.init_file = parse_val(cfg, module_name, 'init')

self.default_file = parse_val(cfg, module_name, 'default')
self.preinst = parse_val(cfg, module_name, 'preinst')
self.postinst = parse_val(cfg, module_name, 'postinst')
self.prerm = parse_val(cfg, module_name, 'prerm')
self.postrm = parse_val(cfg, module_name, 'postrm')

self.mime_file = parse_val(cfg,module_name,'MIME-File')

self.shared_mime_file = parse_val(cfg,module_name,'Shared-MIME-File')
Expand Down Expand Up @@ -965,8 +979,6 @@ def __init__(self,
self.dirlist = ""

setup_env_vars = parse_vals(cfg,module_name,'Setup-Env-Vars')
if force_buildsystem:
setup_env_vars.append('DH_OPTIONS=--buildsystem=python_distutils')
self.force_buildsystem = force_buildsystem
self.exports = ""
if len(setup_env_vars):
Expand Down Expand Up @@ -1194,6 +1206,46 @@ def build_dsc(debinfo,
fd.write('1.0\n')
fd.close()

print """DEBINFO
init: %s
default: %s
preinst: %s
postinst: %s
prerm: %s
postrm: %s""" % (debinfo.init_file, debinfo.default_file, debinfo.preinst,
debinfo.postinst, debinfo.prerm, debinfo.postrm)


# debian/<package>.init
if debinfo.init_file != '':
link_func(debinfo.init_file,
os.path.join(debian_dir, '%s.init' % debinfo.package))

# debian/<package>.default
if debinfo.default_file != '':
link_func(debinfo.default_file,
os.path.join(debian_dir, '%s.default' % debinfo.package))

# debian/preinst
if debinfo.preinst != '':
link_func(debinfo.preinst,
os.path.join(debian_dir, 'preinst'))

# debian/postinst
if debinfo.postinst != '':
link_func(debinfo.postinst,
os.path.join(debian_dir, 'postinst'))

# debian/prerm
if debinfo.prerm != '':
link_func(debinfo.prerm,
os.path.join(debian_dir, 'prerm'))

# debian/postrm
if debinfo.postrm != '':
link_func(debinfo.postrm,
os.path.join(debian_dir, 'postrm'))

if debian_dir_only:
return

Expand Down