[Piuparts-commits] [piuparts] 05/08: p-a: catch, dump, ignore unknown exceptions while processing logfiles

Holger Levsen holger at layer-acht.org
Tue Jan 24 10:45:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 4e284b0fb6d55cbd4d7b0298368f535ccbce0bbc
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Jan 24 05:57:50 2017 +0100

    p-a: catch, dump, ignore unknown exceptions while processing logfiles
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog    |  1 +
 piuparts-analyze.py | 89 ++++++++++++++++++++++++++++-------------------------
 2 files changed, 48 insertions(+), 42 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7bdfff2..d365635 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,7 @@ piuparts (0.75) UNRELEASED; urgency=medium
     - Add new suite: stretch2proposed.
   * piuparts-analyze.py:
     - Adjust debianbts syntax to be compatible with both jessie and stretch.
+    - Improve exception handling.
   * Add/adjust some exceptions for ancient packages.
   * scripts/pre_install_extras: Add examples how to preseed license acceptance
     for non-free and downloader packages.
diff --git a/piuparts-analyze.py b/piuparts-analyze.py
index baee354..c65706a 100644
--- a/piuparts-analyze.py
+++ b/piuparts-analyze.py
@@ -175,51 +175,56 @@ def bts_update_found(bugnr, newversion):
 
 def mark_logs_with_reported_bugs():
     for failed_log in find_logs("fail"):
-        pname = package_name(failed_log)
-        pversion = package_source_version(failed_log)
-        failed_errors = extract_errors(failed_log)
-        moved = False
         try:
+            pname = package_name(failed_log)
+            pversion = package_source_version(failed_log)
+            try:
+                failed_errors = extract_errors(failed_log)
+            except IOError:
+                print('IOError while processing %s' % failed_log)
+                continue
+            moved = False
             abugs = piuparts_bugs_affecting(pname)
             bugs = piuparts_bugs_in(pname)
-        except SOAPpy.Errors.HTTPError:
-            continue
-        for bug in abugs + bugs:
-            if moved:
-                break
-            if bug in abugs:
-                bugged = "affected"
-            else:
-                bugged = "bugged"
-            found_versions = get_bug_versions(bug)
-            if pversion in found_versions:
-                move_to_bugged(failed_log, bugged, bug)
-                moved = True
-                break
-            for bug_version in found_versions:
-                # print('DEBUG: %s/%s #%d %s' % (pname, pversion, bug, bug_version))
-
-                if apt_pkg.version_compare(pversion, bug_version) > 0:  # pversion > bug_version
-                    bugged_logs = find_bugged_logs(failed_log)
-                    if not bugged_logs and not moved:
-                        print('%s/%s: Maybe the bug was filed earlier: https://bugs.debian.org/%d against %s/%s'
-                              % (pname, pversion, bug, pname, bug_version))
-                        break
-                    for bugged_log in bugged_logs:
-                        old_pversion = package_source_version(bugged_log)
-                        bugged_errors = extract_errors(bugged_log)
-                        if (apt_pkg.version_compare(old_pversion, bug_version) == 0  # old_pversion == bug_version
-                            and
-                                failed_errors == bugged_errors):
-                            # a bug was filed for an old version of the package,
-                            # and the errors were the same back then - assume it is the same bug.
-                            if not moved:
-                                mark_bugged_version(failed_log, bugged_log)
-                                moved = True
-                                bts_update_found(bug, pversion)
-                                break
-        if not moved:
-            write_bug_file(failed_log, abugs + bugs)
+            for bug in abugs + bugs:
+                if moved:
+                    break
+                if bug in abugs:
+                    bugged = "affected"
+                else:
+                    bugged = "bugged"
+                found_versions = get_bug_versions(bug)
+                if pversion in found_versions:
+                    move_to_bugged(failed_log, bugged, bug)
+                    moved = True
+                    break
+                for bug_version in found_versions:
+                    # print('DEBUG: %s/%s #%d %s' % (pname, pversion, bug, bug_version))
+
+                    if apt_pkg.version_compare(pversion, bug_version) > 0:  # pversion > bug_version
+                        bugged_logs = find_bugged_logs(failed_log)
+                        if not bugged_logs and not moved:
+                            print('%s/%s: Maybe the bug was filed earlier: https://bugs.debian.org/%d against %s/%s'
+                                  % (pname, pversion, bug, pname, bug_version))
+                            break
+                        for bugged_log in bugged_logs:
+                            old_pversion = package_source_version(bugged_log)
+                            bugged_errors = extract_errors(bugged_log)
+                            if (apt_pkg.version_compare(old_pversion, bug_version) == 0  # old_pversion == bug_version
+                                and
+                                    failed_errors == bugged_errors):
+                                # a bug was filed for an old version of the package,
+                                # and the errors were the same back then - assume it is the same bug.
+                                if not moved:
+                                    mark_bugged_version(failed_log, bugged_log)
+                                    moved = True
+                                    bts_update_found(bug, pversion)
+                                    break
+            if not moved:
+                write_bug_file(failed_log, abugs + bugs)
+        except:
+            print('ERROR processing %s' % failed_log)
+            print sys.exc_info()[0]
 
 
 def report_packages_with_many_logs():

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list