def add_sequence(control, rules, sequence): control.source['Build-Depends'] = add_dependency( control.source.get('Build-Depends'), 'dh-vim-addon') def add_with(line, target): if line.startswith(b'dh ') or line.startswith(b'dh_'): return dh_invoke_add_with(line, sequence.replace('-', '_').encode()) return line update_rules(add_with)
#!/usr/bin/python3 from debmutate.control import ( get_relation, add_dependency, drop_dependency, ) from lintian_brush.fixer import control, report_result with control as updater: try: pos, old = get_relation(updater.source.get('Build-Depends-Indep', ''), 'debhelper-compat') except KeyError: pass else: updater.source['Build-Depends'] = add_dependency( updater.source.get('Build-Depends', ''), old) updater.source['Build-Depends-Indep'] = drop_dependency( updater.source.get('Build-Depends-Indep', ''), 'debhelper-compat') if not updater.source['Build-Depends-Indep'].strip(): del updater.source['Build-Depends-Indep'] report_result( 'Move debhelper-compat from Build-Depends-Indep to Build-Depends.')
binary['Built-Using'], '${misc:Built-Using}') if not binary['Built-Using']: del binary['Built-Using'] removed.append(binary['Package']) issue.report_fixed() else: built_using = binary.get('Built-Using', '') try: get_relation(built_using, "${misc:Built-Using}") except KeyError: issue = LintianIssue( updater.source, 'missing-built-using-field-for-golang-package', binary['Package']) if issue.should_fix(): binary["Built-Using"] = add_dependency( built_using, "${misc:Built-Using}") added.append(binary['Package']) issue.report_fixed() if added and removed: report_result( 'Added ${misc:Built-Using} to %s and removed it from %s.' % (', '.join(added), ', '.join(removed))) if added: report_result( 'Add missing ${misc:Built-Using} to Built-Using on %s.' % ', '.join(added)) if removed: report_result( 'Remove unnecessary ${misc:Built-Using} for %s' %
from lintian_brush.fixer import control, report_result, fixed_lintian_tag compat_version = get_debhelper_compat_level() if compat_version is None or compat_version <= 11: # N/A sys.exit(0) added = set() # Add Pre-Depends: ${misc:Pre-Depends} iff: # - a package has both a init script and a (ubuntu | systemd) unit with control as updater: for binary in updater.binaries: name = binary["Package"] if not os.path.exists('debian/%s.init' % name): continue if not (os.path.exists('debian/%s.service' % name) or os.path.exists('debian/%s.upstart' % name)): continue if "${misc:Pre-Depends}" in binary.get("Pre-Depends", ""): continue binary["Pre-Depends"] = add_dependency(binary.get("Pre-Depends", ""), "${misc:Pre-Depends}") added.add(name) fixed_lintian_tag(updater.source, 'skip-systemd-native-flag-missing-pre-depends') report_result("Add missing Pre-Depends: ${misc:Pre-Depends} in %s." % ", ".join(sorted(added)))
return True return False with control as updater: for entry in parse_relations(updater.source.get("Build-Depends", '')): (head_whitespace, relation, tail_whitespace) = entry if any(r.name in ('debhelper', 'debhelper-compat') for r in relation): uses_debhelper = True break if uses_debhelper: for binary in updater.binaries: if (has_misc_depends(binary.get('Depends', '')) or has_misc_depends(binary.get('Pre-Depends', ''))): continue else: issue = LintianIssue( updater.source, 'debhelper-but-no-misc-depends', info=binary['Package']) if issue.should_fix(): binary["Depends"] = add_dependency( binary.get("Depends", ''), "${misc:Depends}") misc_depends_added.append(binary["Package"]) issue.report_fixed() report_result( "Add missing ${misc:Depends} to Depends for %s." % ", ".join(misc_depends_added))
with control as updater: for deps, issues, kind, name in need: parsed = PkgRelation.parse(deps) is_implied = False if is_relation_implied(parsed, 'debhelper'): is_implied = True for field in ['Build-Depends', 'Build-Depends-Indep', 'Build-Depends-Arch']: for unused1, existing, unused2 in parse_relations( updater.source.get(field, '')): if is_relation_implied(parsed, existing): is_implied = True if not is_implied: build_deps = updater.source.get('Build-Depends', '') updater.source['Build-Depends'] = add_dependency(build_deps, deps) for issue in issues: issue.report_fixed() changed.append((deps, issue, kind, name)) if len(changed) == 1: (dep, issue, kind, name) = changed[0] report_result('Add missing build dependency on %s for %s %s.' % (dep, kind, name)) else: report_result( 'Add missing build dependencies:' + '\n'.join('* %s for %s %s' % (dep, kind, name) for (dep, issue, kind, name) in changed))
get_relation, drop_dependency, add_dependency, ) from lintian_brush.fixer import control, report_result, LintianIssue with control as updater: try: get_relation( updater.source.get('Build-Depends-Indep', ''), 'libmodule-build-perl') except KeyError: pass else: issue = LintianIssue( updater.source, 'libmodule-build-perl-needs-to-be-in-build-depends', '') if issue.should_fix(): updater.source['Build-Depends-Indep'] = drop_dependency( updater.source['Build-Depends-Indep'], 'libmodule-build-perl') updater.source['Build-Depends'] = add_dependency( updater.source.get('Build-Depends', ''), 'libmodule-build-perl') issue.report_fixed() report_result( 'Move libmodule-build-perl from Build-Depends-Indep to Build-Depends.')