def check_4_4_0():
    # Check that the package uses debhelper.
    if os.path.exists("debian/compat"):
        return
    with open('debian/control') as f:
        source = next(Deb822.iter_paragraphs(f))
        build_deps = source.get('Build-Depends', '')
        try:
            get_relation(build_deps, 'debhelper-compat')
        except KeyError:
            raise UpgradeCheckFailure("4.9", "package does not use dh")
        else:
            return
Exemple #2
0
#!/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.')
Exemple #3
0
            if 'Built-Using' in binary:
                issue = LintianIssue(
                    updater.source,
                    'built-using-field-on-arch-all-package',
                    binary['Package'])
                if issue.should_fix():
                    binary['Built-Using'] = drop_dependency(
                        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)))
Exemple #4
0
#!/usr/bin/python3

from lintian_brush.fixer import control, LintianIssue, report_result
from debmutate.control import get_relation, drop_dependency
from debmutate._rules import RulesEditor
from lintian_brush.debhelper import add_sequence

with control:
    for binary in control.binaries:
        try:
            rel = get_relation(binary.get('Depends', ''), 'vim-addon-manager')
        except KeyError:
            continue
        issue = LintianIssue(binary, 'obsolete-vim-addon-manager')
        if not issue.should_fix():
            continue
        binary['Depends'] = drop_dependency(binary['Depends'],
                                            'vim-addon-manager')
        with RulesEditor() as rules:
            add_sequence(control, rules, 'vim-addon')
        issue.report_fixed()

report_result('Migrate from vim-addon-manager to dh-vim-addon.')
            cf.write('%s\n' % new_debhelper_compat_version)
    else:
        # Nothing to do
        sys.exit(2)

    with control as updater:
        updater.source["Build-Depends"] = ensure_minimum_version(
            updater.source.get("Build-Depends", ""), "debhelper",
            "%d~" % new_debhelper_compat_version)
else:
    try:
        # Assume that the compat version is set in Build-Depends
        with control as updater:
            try:
                offset, debhelper_compat_relation = get_relation(
                    updater.source.get("Build-Depends", ""),
                    "debhelper-compat")
            except KeyError:
                sys.exit(2)
            else:
                if len(debhelper_compat_relation) > 1:
                    # Not sure how to deal with this..
                    sys.exit(2)
                if debhelper_compat_relation[0].version[0] != '=':
                    # Not sure how to deal with this..
                    sys.exit(2)
                current_debhelper_compat_version = int(
                    debhelper_compat_relation[0].version[1])
            if current_debhelper_compat_version < new_debhelper_compat_version:
                updater.source["Build-Depends"] = ensure_exact_version(
                    updater.source["Build-Depends"], "debhelper-compat",
#!/usr/bin/python3

from debmutate.control import (
    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()