#!/usr/bin/python3

import os
import sys

from lintian_brush.fixer import (
    opinionated,
    report_result,
)

if not opinionated():
    sys.exit(0)

try:
    with open('debian/patches/series', 'r') as f:
        if not f.read().strip():
            os.unlink('debian/patches/series')
except FileNotFoundError:
    pass

report_result('Remove empty debian/patches/series.')
Ejemplo n.º 2
0
        if architecture_included:
            return None
        else:
            # Nothing wrong here
            return line
    lineno = -1  # TODO(jelmer): Pass this up
    fixed_lintian_tag('source',
                      'debian-rules-sets-dpkg-architecture-variable',
                      info='%s (line %d)' % (variable, lineno))
    if architecture_included:
        message = 'Rely on existing architecture.mk include.'
        return None
    return re.sub(b'([:?]?=)', b'?=', line)


if opinionated():
    try:
        mf = Makefile.from_path('debian/rules')
    except FileNotFoundError:
        pass
    else:
        for line in mf.contents:
            if (isinstance(line, bytes)
                    and is_dpkg_architecture_line(line)[1:3] == (True, True)):
                update_rules(global_line_cb=drop_arch_line)
                message = (
                    'Rely on pre-initialized dpkg-architecture variables.')
                break
else:
    message = 'Use ?= for assignments to architecture variables.'
    update_rules(global_line_cb=update_assignment_kind)