Control: tags -1 patch

On Thu, May 26, 2016 at 06:56:54PM +0200, Andreas Beckmann wrote:
> Package: ftp.debian.org
> Severity: important
>
> Hi,
>
> automatic cruft removal sometimes removes arch:all binary packages on
> source-only uploads even if these packages are not gone, but are just
> lacking a build ... Uploading these binaries later causes unneccessary
> binary-NEW processing.
>
> I don't have concrete examples from main, but some from non-free, where
> source-only uploads were erroneously done for packages that are not
> whitelisted for autobuilding:
>
> * colorfultabs
> * human-icon-theme
> * tangerine-icon-theme (presumably)
>
> There is probably an assumption left from the days before source-only
> uploads and arch:all autobuilders ... that arch:all packges would show
> up together with new source (or never).

Attached is an (untested) patch which I believe should fix this. As
discussed on IRC, rather than keeping the special arch:all cruft removal
for jessie and below, it has been dropped completely.

Regards,
James
>From f4e79ed10726aa1bee52ca33a3a3d849738003c1 Mon Sep 17 00:00:00 2001
From: James Clarke <jrt...@jrtc27.com>
Date: Wed, 23 Nov 2016 16:08:05 +0000
Subject: [PATCH] Don't be so eager to remove outdated arch:all binary packages

Closes: 825398
---
 dak/auto_decruft.py | 36 ++----------------------------------
 dak/cruft_report.py | 24 +-----------------------
 daklib/cruft.py     | 24 +-----------------------
 3 files changed, 4 insertions(+), 80 deletions(-)

diff --git a/dak/auto_decruft.py b/dak/auto_decruft.py
index 66479a4..22eba87 100644
--- a/dak/auto_decruft.py
+++ b/dak/auto_decruft.py
@@ -35,7 +35,7 @@ Check for obsolete binary packages
 
 import sys
 import apt_pkg
-from itertools import chain, product
+from itertools import product
 from collections import defaultdict
 
 from daklib.config import Config
@@ -65,35 +65,6 @@ Automatic removal of common kinds of cruft
 
################################################################################
 
 
-def compute_sourceless_groups(suite_id, session):
-    """Find binaries without a source
-
-    @type suite_id: int
-    @param suite_id: The id of the suite denoted by suite_name
-
-    @type session: SQLA Session
-    @param session: The database session in use
-    """""
-    rows = query_without_source(suite_id, session)
-    message = '[auto-cruft] no longer built from source, no reverse 
dependencies'
-    arch = get_architecture('all', session=session)
-    arch_all_id_tuple = tuple([arch.arch_id])
-    arch_all_list = ["all"]
-    for row in rows:
-        package = row[0]
-        group_info = {
-            "name": "sourceless:%s" % package,
-            "packages": tuple([package]),
-            "architectures": arch_all_list,
-            "architecture_ids": arch_all_id_tuple,
-            "message": message,
-            "removal_request": {
-                package: arch_all_list,
-            },
-        }
-        yield group_info
-
-
 def compute_nbs_groups(suite_id, suite_name, session):
     """Find binaries no longer built
 
@@ -213,10 +184,7 @@ def auto_decruft_suite(suite_name, suite_id, session, 
dryrun, debug):
     group_order = []
     groups = {}
     full_removal_request = []
-    group_generator = chain(
-        compute_sourceless_groups(suite_id, session),
-        compute_nbs_groups(suite_id, suite_name, session)
-    )
+    group_generator = compute_nbs_groups(suite_id, suite_name, session)
     for group in group_generator:
         group_name = group["name"]
         pkgs = group["packages"]
diff --git a/dak/cruft_report.py b/dak/cruft_report.py
index fbbc044..e170709 100755
--- a/dak/cruft_report.py
+++ b/dak/cruft_report.py
@@ -157,7 +157,7 @@ def do_nfu(nfu_packages):
         print "Suggested commands:"
         for architecture in a2p:
             if a2p[architecture]:
-                print (" dak rm -m \"[auto-cruft] NFU\" -s %s -a %s -b %s" % 
+                print (" dak rm -m \"[auto-cruft] NFU\" -s %s -a %s -b %s" %
                     (suite.suite_name, architecture, " 
".join(a2p[architecture])))
         print
 
@@ -210,27 +210,6 @@ def do_newer_version(lowersuite_name, highersuite_name, 
code, session):
 
################################################################################
 
 
-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
-
 def queryNewerAll(suite_name, session):
     """searches for arch != all packages that have an arch == all
     package with a higher version in the same suite"""
@@ -294,7 +273,6 @@ def reportNBS(suite_name, suite_id, rdeps=False):
     session.close()
 
 def reportAllNBS(suite_name, suite_id, session, rdeps=False):
-    reportWithoutSource(suite_name, suite_id, session, rdeps)
     reportNewerAll(suite_name, session)
     reportNBS(suite_name, suite_id, rdeps)
 
diff --git a/daklib/cruft.py b/daklib/cruft.py
index 05666ce..fcd6501 100644
--- a/daklib/cruft.py
+++ b/daklib/cruft.py
@@ -123,28 +123,6 @@ def report_multiple_source(suite):
     print
 
 
-def query_without_source(suite_id, session):
-    """searches for arch: all packages from suite that do no longer
-    reference a source package in the same suite
-
-    subquery unique_binaries: selects all packages with only 1 version
-    in suite since 'dak rm' does not allow to specify version numbers"""
-
-    query = """
-    with unique_binaries as
-        (select package, max(version) as version, max(source) as source
-            from bin_associations_binaries
-        where architecture = 2 and suite = :suite_id
-            group by package having count(*) = 1)
-    select ub.package, ub.version
-        from unique_binaries ub
-        left join src_associations_src sas
-        on ub.source = sas.src and sas.suite = :suite_id
-        where sas.id is null
-        order by ub.package"""
-    return session.execute(query, {'suite_id': suite_id})
-
-
 def queryNBS(suite_id, session):
     """This one is really complex. It searches arch != all packages that
     are no longer built from current source packages in suite.
@@ -182,7 +160,7 @@ create temp table unique_binaries (
 insert into unique_binaries
     select bab.package, bab.architecture, max(bab.source)
         from bin_associations_binaries bab
-        where bab.suite = :suite_id and bab.architecture > 2
+        where bab.suite = :suite_id and bab.architecture >= 2
         group by package, architecture having count(*) = 1;
 
 create temp table newest_binaries (
-- 
2.10.2

Reply via email to