Example #1
0
def reportNBSMetadata(suite_name, suite_id, session, rdeps=False):
    rows = queryNBS_metadata(suite_id, session)
    title = 'NBS packages (from metadata) in suite %s' % suite_name
    if rows.rowcount > 0:
        print('%s\n%s\n' % (title, '-' * len(title)))
    for row in rows:
        (packages, architecture, source, version) = row
        print("* source package %s version %s no longer builds" %
              (source, version))
        print("  binary package(s): %s" % packages)
        print("  on %s" % architecture)
        print("  - suggested command:")
        message = '"[auto-cruft] NBS (no longer built by %s - based on source metadata)"' % source
        print("    dak rm -o -m %s -s %s -a %s -p -R -b %s" %
              (message, suite_name, architecture, packages))
        if rdeps:
            archs = [architecture]
            if architecture == "all":
                # when archs is None, rdeps are checked on all archs in the suite
                archs = None
            if utils.check_reverse_depends(packages.split(), suite_name, archs,
                                           session, True):
                print()
            else:
                print("  - No dependency problem found\n")
        else:
            print()
Example #2
0
def reportNBS(suite_name, suite_id, rdeps=False):
    session = DBConn().session()
    nbsRows = queryNBS(suite_id, session)
    title = 'NBS packages in suite %s' % suite_name
    if nbsRows.rowcount > 0:
	print '%s\n%s\n' % (title, '-' * len(title))
    for row in nbsRows:
	(pkg_list, arch_list, source, version) = row
	pkg_string = ' '.join(pkg_list)
	arch_string = ','.join(arch_list)
	print "* source package %s version %s no longer builds" % \
	    (source, version)
	print "  binary package(s): %s" % pkg_string
	print "  on %s" % arch_string
	print "  - suggested command:"
	message = '"[auto-cruft] NBS (no longer built by %s)"' % source
	print "    dak rm -m %s -s %s -a %s -p -R -b %s" % \
	    (message, suite_name, arch_string, pkg_string)
        if rdeps:
            if utils.check_reverse_depends(pkg_list, suite_name, arch_list, session, True):
                print
            else:
                print "  - No dependency problem found\n"
        else:
            print
    session.close()
Example #3
0
def reportNBS(suite_name, suite_id, rdeps=False):
    session = DBConn().session()
    nbsRows = queryNBS(suite_id, session)
    title = 'NBS packages in suite %s' % suite_name
    if nbsRows.rowcount > 0:
        print('%s\n%s\n' % (title, '-' * len(title)))
    for row in nbsRows:
        (pkg_list, arch_list, source, version) = row
        pkg_string = ' '.join(pkg_list)
        arch_string = ','.join(arch_list)
        print("* source package %s version %s no longer builds" %
              (source, version))
        print("  binary package(s): %s" % pkg_string)
        print("  on %s" % arch_string)
        print("  - suggested command:")
        message = '"[auto-cruft] NBS (no longer built by %s)"' % source
        print("    dak rm -o -m %s -s %s -a %s -p -R -b %s" %
              (message, suite_name, arch_string, pkg_string))
        if rdeps:
            if utils.check_reverse_depends(pkg_list, suite_name, arch_list,
                                           session, True):
                print()
            else:
                print("  - No dependency problem found\n")
        else:
            print()
    session.close()
Example #4
0
def reverse_depends_check(removals, suite, arches=None, session=None, include_arch_all=True):
    print "Checking reverse dependencies..."
    if utils.check_reverse_depends(removals, suite, arches, session, include_arch_all=include_arch_all):
        print "Dependency problem found."
        if not Options["No-Action"]:
            game_over()
    else:
        print "No dependency problem found."
    print
Example #5
0
def reverse_depends_check(removals, suite, arches=None, session=None):
    print "Checking reverse dependencies..."
    if utils.check_reverse_depends(removals, suite, arches, session):
        print "Dependency problem found."
        if not Options["No-Action"]:
            game_over()
    else:
        print "No dependency problem found."
    print
Example #6
0
def reverse_depends_check(removals,
                          suite,
                          arches=None,
                          session=None,
                          include_arch_all=True):
    print("Checking reverse dependencies...")
    if utils.check_reverse_depends(removals,
                                   suite,
                                   arches,
                                   session,
                                   include_arch_all=include_arch_all):
        print("Dependency problem found.")
        if not Options["No-Action"]:
            game_over()
    else:
        print("No dependency problem found.")
    print()
Example #7
0
def reportWithoutSource(suite_name, suite_id, session, rdeps=False):
    rows = queryWithoutSource(suite_id, session)
    title = 'packages without source in suite %s' % suite_name
    if rows.rowcount > 0:
        print '%s\n%s\n' % (title, '-' * len(title))
    message = '"[auto-cruft] no longer built from source"'
    for row in rows:
        (package, version) = row
        print "* package %s in version %s is no longer built from source" % \
            (package, version)
        print "  - suggested command:"
        print "    dak rm -m %s -s %s -a all -p -R -b %s" % \
            (message, suite_name, package)
        if rdeps:
            if utils.check_reverse_depends([package], suite_name, [], session, True):
                print
            else:
                print "  - No dependency problem found\n"
        else:
            print
Example #8
0
def reportWithoutSource(suite_name, suite_id, session, rdeps=False):
    rows = query_without_source(suite_id, session)
    title = 'packages without source in suite %s' % suite_name
    if rows.rowcount > 0:
        print('%s\n%s\n' % (title, '-' * len(title)))
    message = '"[auto-cruft] no longer built from source"'
    for row in rows:
        (package, version) = row
        print("* package %s in version %s is no longer built from source" %
            (package, version))
        print("  - suggested command:")
        print("    dak rm -m %s -s %s -a all -p -R -b %s" %
            (message, suite_name, package))
        if rdeps:
            if utils.check_reverse_depends([package], suite_name, [], session, True):
                print()
            else:
                print("  - No dependency problem found\n")
        else:
            print()
Example #9
0
def report_outdated_nonfree(suite, session, rdeps=False):

    packages = {}
    query = """WITH outdated_sources AS (
                 SELECT s.source, s.version, s.id
                 FROM source s
                 JOIN src_associations sa ON sa.source = s.id
                 WHERE sa.suite IN (
                   SELECT id
                   FROM suite
                   WHERE suite_name = :suite )
                 AND sa.created < (now() - interval :delay)
                 EXCEPT SELECT s.source, max(s.version) AS version, max(s.id)
                 FROM source s
                 JOIN src_associations sa ON sa.source = s.id
                 WHERE sa.suite IN (
                   SELECT id
                   FROM suite
                   WHERE suite_name = :suite )
                 AND sa.created < (now() - interval :delay)
                 GROUP BY s.source ),
               binaries AS (
                 SELECT b.package, s.source, (
                   SELECT a.arch_string
                   FROM architecture a
                   WHERE a.id = b.architecture ) AS arch
                 FROM binaries b
                 JOIN outdated_sources s ON s.id = b.source
                 JOIN bin_associations ba ON ba.bin = b.id
                 JOIN override o ON o.package = b.package AND o.suite = ba.suite
                 WHERE ba.suite IN (
                   SELECT id
                   FROM suite
                   WHERE suite_name = :suite )
                 AND o.component IN (
                   SELECT id
                   FROM component
                   WHERE name = 'non-free' ) )
               SELECT DISTINCT package, source, arch
               FROM binaries
               ORDER BY source, package, arch"""

    res = session.execute(query, {'suite': suite, 'delay': "'15 days'"})
    for package in res:
        binary = package[0]
        source = package[1]
        arch = package[2]
        if arch == 'all':
            continue
        if not source in packages:
            packages[source] = {}
        if not binary in packages[source]:
            packages[source][binary] = set()
        packages[source][binary].add(arch)
    if packages:
        title = 'Outdated non-free binaries in suite %s' % suite
        message = '"[auto-cruft] outdated non-free binaries"'
        print '%s\n%s\n' % (title, '-' * len(title))
        for source in sorted(packages):
            archs = set()
            binaries = set()
            print '* package %s has outdated non-free binaries' % source
            print '  - suggested command:'
            for binary in sorted(packages[source]):
                binaries.add(binary)
                archs = archs.union(packages[source][binary])
            print '    dak rm -m %s -s %s -a %s -p -R -b %s' % \
                   (message, suite, ','.join(archs), ' '.join(binaries))
            if rdeps:
                if utils.check_reverse_depends(list(binaries), suite, archs, session, True):
                    print
                else:
                    print "  - No dependency problem found\n"
            else:
                print
Example #10
0
def report_outdated_nonfree(suite, session, rdeps=False):

    packages = {}
    query = """WITH outdated_sources AS (
                 SELECT s.source, s.version, s.id
                 FROM source s
                 JOIN src_associations sa ON sa.source = s.id
                 WHERE sa.suite IN (
                   SELECT id
                   FROM suite
                   WHERE suite_name = :suite )
                 AND sa.created < (now() - interval :delay)
                 EXCEPT SELECT s.source, max(s.version) AS version, max(s.id)
                 FROM source s
                 JOIN src_associations sa ON sa.source = s.id
                 WHERE sa.suite IN (
                   SELECT id
                   FROM suite
                   WHERE suite_name = :suite )
                 AND sa.created < (now() - interval :delay)
                 GROUP BY s.source ),
               binaries AS (
                 SELECT b.package, s.source, (
                   SELECT a.arch_string
                   FROM architecture a
                   WHERE a.id = b.architecture ) AS arch
                 FROM binaries b
                 JOIN outdated_sources s ON s.id = b.source
                 JOIN bin_associations ba ON ba.bin = b.id
                 JOIN override o ON o.package = b.package AND o.suite = ba.suite
                 WHERE ba.suite IN (
                   SELECT id
                   FROM suite
                   WHERE suite_name = :suite )
                 AND o.component IN (
                   SELECT id
                   FROM component
                   WHERE name = 'non-free' ) )
               SELECT DISTINCT package, source, arch
               FROM binaries
               ORDER BY source, package, arch"""

    res = session.execute(query, {'suite': suite, 'delay': "'15 days'"})
    for package in res:
        binary = package[0]
        source = package[1]
        arch = package[2]
        if arch == 'all':
            continue
        if source not in packages:
            packages[source] = {}
        if binary not in packages[source]:
            packages[source][binary] = set()
        packages[source][binary].add(arch)
    if packages:
        title = 'Outdated non-free binaries in suite %s' % suite
        message = '"[auto-cruft] outdated non-free binaries"'
        print('%s\n%s\n' % (title, '-' * len(title)))
        for source in sorted(packages):
            archs = set()
            binaries = set()
            print('* package %s has outdated non-free binaries' % source)
            print('  - suggested command:')
            for binary in sorted(packages[source]):
                binaries.add(binary)
                archs = archs.union(packages[source][binary])
            print('    dak rm -o -m %s -s %s -a %s -p -R -b %s' %
                  (message, suite, ','.join(archs), ' '.join(binaries)))
            if rdeps:
                if utils.check_reverse_depends(list(binaries), suite, archs,
                                               session, True):
                    print()
                else:
                    print("  - No dependency problem found\n")
            else:
                print()