Ejemplo n.º 1
0
def test_piuparts():
    for log, testids in LOGFILES:
        pth = os.path.join(os.path.dirname(__file__), "logs", log)
        lines = open(pth, 'r').readlines()
        for issue in parse_piuparts(lines, pth):
            if issue.testid:
                testids.remove(issue.testid)
        assert testids == set([])
Ejemplo n.º 2
0
def piuparts(chroot, packages, analysis):
    cfg = configparser.ConfigParser()
    if cfg.read("/etc/schroot/chroot.d/%s" % (chroot)) == []:
        raise Exception("Shit. No such tarball")

    block = cfg[chroot]

    if "file" not in block:
        raise Exception("Chroot type isn't of tarball")

    location = block['file']
    copy_location = os.path.join("/tmp", os.path.basename(location))

    with schroot(chroot) as chroot:
        chroot.copy(location, copy_location)
        for package in packages:
            chroot.copy(package, "/tmp")

        print("[     ] Installing...")
        chroot.run(['apt-get', 'install', '-y', 'piuparts'], user='******')
        print("[     ] Piuparts installed.")

        failed = False
        try:
            print("[     ] Running Piuparts..")
            out, err, ret = chroot.run([
                'piuparts',
                '-b',
                copy_location,
            ] + ["/tmp/%s" % (x) for x in packages] + [
                '--warn-on-debsums-errors',
                '--pedantic-purge-test',
            ],
                                       user='******')
        except SchrootCommandError as e:
            out, err = e.out, e.err
            failed = True

        for x in parse_piuparts(out.splitlines(), package):
            analysis.results.append(x)

        return analysis, out, failed
Ejemplo n.º 3
0
def piuparts(chroot, packages, analysis):
    cfg = configparser.ConfigParser()
    if cfg.read("/etc/schroot/chroot.d/%s" % (chroot)) == []:
        raise Exception("Shit. No such tarball")

    block = cfg[chroot]

    if "file" not in block:
        raise Exception("Chroot type isn't of tarball")

    location = block['file']
    copy_location = os.path.join("/tmp", os.path.basename(location))

    with schroot(chroot) as chroot:
        chroot.copy(location, copy_location)
        for package in packages:
            chroot.copy(package, "/tmp")

        print("[     ] Installing...")
        chroot.run(['apt-get', 'install', '-y', 'piuparts'], user='******')
        print("[     ] Piuparts installed.")

        failed = False
        try:
            print("[     ] Running Piuparts..")
            out, err, ret = chroot.run([
                'piuparts',
                    '-b', copy_location,
            ] + [ "/tmp/%s" % (x) for x in packages ] + [
                    '--warn-on-debsums-errors',
                    '--pedantic-purge-test',
            ], user='******')
        except SchrootCommandError as e:
            out, err = e.out, e.err
            failed = True

        for x in parse_piuparts(out.splitlines(), package):
            analysis.results.append(x)

        return analysis, out, failed