diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2019-10-23 20:28:16 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-10-23 21:47:25 +0100 |
commit | c5e1ff85ebc20da2f2b79ea728a76756f997c5e8 (patch) | |
tree | 3a44fcec1e9c1f0e60a0e9bd54b70a9a7522ebbf /debian/lib/python | |
parent | 90d4cf3fc79784e029999d44b8d2c2a1f438f739 (diff) | |
download | kernel_replicant_linux-c5e1ff85ebc20da2f2b79ea728a76756f997c5e8.tar.gz kernel_replicant_linux-c5e1ff85ebc20da2f2b79ea728a76756f997c5e8.tar.bz2 kernel_replicant_linux-c5e1ff85ebc20da2f2b79ea728a76756f997c5e8.zip |
gencontrol: Generalise substitution of debhelper config template
Currently we have two copies of the _substitute_file() method, and
lots of somewhat similar invocations of it since different binary
packages need different sets of debhelper configs.
We already name the templates in a fairly consistent way, so we can
replace this with a loop that tries to expand all possible templates
for a package and ignores those that are missing. Add a method for
this to the Gencontrol base class and use it in both subclasses
where we prevously used _substitute_file().
Diffstat (limited to 'debian/lib/python')
-rw-r--r-- | debian/lib/python/debian_linux/gencontrol.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/debian/lib/python/debian_linux/gencontrol.py b/debian/lib/python/debian_linux/gencontrol.py index 69619da3ee10..a49b21faa199 100644 --- a/debian/lib/python/debian_linux/gencontrol.py +++ b/debian/lib/python/debian_linux/gencontrol.py @@ -350,6 +350,22 @@ class Gencontrol(object): return re.sub(r'@([-_a-z0-9]+)@', subst, str(s)) + # Substitute kernel version etc. into maintainer scripts, + # bug presubj message and lintian overrides + def substitute_debhelper_config(self, prefix, vars, package_name, + output_dir='debian'): + for id in ['bug-presubj', 'lintian-overrides', + 'postinst', 'postrm', 'preinst', 'prerm']: + name = '%s.%s' % (prefix, id) + try: + template = self.templates[name] + except KeyError: + continue + else: + target = '%s/%s.%s' % (output_dir, package_name, id) + with open(target, 'w') as f: + f.write(self.substitute(template, vars)) + def merge_build_depends(self, packages): # Merge Build-Depends pseudo-fields from binary packages into the # source package |