[Piuparts-devel] Piatti dwke crash patch

Dave Steele dsteele at gmail.com
Wed May 8 04:09:04 UTC 2013


In branch dwke-2.6:

    0c669f8 detect_well_known_errors - Fix problem re parsing for python 2.6.

Fixing, on piatti:

Traceback (most recent call last):
  File "/org/piuparts.debian.org/share/piuparts/master/detect_well_known_errors",
line 546, in <module>
    problem_list = create_problem_list( conf['known-problem-directory'] )
  File "/org/piuparts.debian.org/share/piuparts/master/detect_well_known_errors",
line 530, in create_problem_list
    prob = Problem(os.path.join(pdir,pfile))
  File "/org/piuparts.debian.org/share/piuparts/master/detect_well_known_errors",
line 119, in __init__
    self.init_problem()
  File "/org/piuparts.debian.org/share/piuparts/master/detect_well_known_errors",
line 145, in init_problem
    tagged = re.sub( "^([A-Z]+=)", "<hdr>\g<0>", probbody, 0, re.MULTILINE)
TypeError: sub() takes at most 4 arguments (5 given)


>From 0c669f87fa8f4bce6596bad043b8ab297ab484a8 Mon Sep 17 00:00:00 2001
From: David Steele <dsteele at gmail.com>
Date: Tue, 7 May 2013 23:34:26 -0400
Subject: [PATCH] detect_well_known_errors - Fix problem re parsing for python
 2.6.

The script is crashing on piatti.
---
 master-bin/detect_well_known_errors |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/master-bin/detect_well_known_errors
b/master-bin/detect_well_known_errors
index 5697a77..80f224e 100755
--- a/master-bin/detect_well_known_errors
+++ b/master-bin/detect_well_known_errors
@@ -142,11 +142,13 @@ class Problem():
         probbody = pb.read()
         pb.close()

-        tagged = re.sub( "^([A-Z]+=)", "<hdr>\g<0>", probbody, 0, re.MULTILINE)
+        re_obj = re.compile( "^([A-Z]+=)", re.MULTILINE )
+        tagged = re.sub( re_obj, "<hdr>\g<0>", probbody, 0 )

         for chub in re.split( '<hdr>', tagged )[1:]:

-            (name,value) = re.split( "=", chub, 1, re.MULTILINE )
+            re_obj = re.compile( "=", re.MULTILINE )
+            (name,value) = re.split( re_obj, chub, 1 )

             while value[-1] == '\n':
                 value = value[:-1]
--
1.7.10.4



More information about the Piuparts-devel mailing list