[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.52-10-gf959c6c

Andreas Beckmann anbe at debian.org
Tue May 28 11:08:47 UTC 2013


The following commit has been merged in the develop branch:
commit 510f602017983654b87b8333db49f4f54ca49dea
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue May 28 11:39:28 2013 +0200

    *.py: run through reindent.py
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/piuparts-slave.manpages b/debian/piuparts-slave.manpages
index 2c817aa..52b889d 100644
--- a/debian/piuparts-slave.manpages
+++ b/debian/piuparts-slave.manpages
@@ -1,3 +1,2 @@
 debian/tmp/usr/share/man/man8/piuparts_slave_run.8.gz
 debian/tmp/usr/share/man/man8/piuparts_slave_join.8.gz
-
diff --git a/master-bin/detect_well_known_errors.py b/master-bin/detect_well_known_errors.py
index 592c0e0..1080cde 100755
--- a/master-bin/detect_well_known_errors.py
+++ b/master-bin/detect_well_known_errors.py
@@ -264,9 +264,9 @@ def get_kpr_path( logpath ):
 
 def pts_subdir( source ):
     if source[:3] == "lib":
-      return source[:4]
+        return source[:4]
     else:
-      return source[:1]
+        return source[:1]
 
 def source_pkg( pkgspec, db ):
     source_name = db.get_control_header(get_pkg(pkgspec), "Source")
@@ -316,21 +316,21 @@ def clean_cache_files( logdict, cachedict, recheck=False, recheck_failed=False,
 
     count = 0
     for pkgspec in cachedict:
-      try:
-        if pkgspec not in logdict \
-        or (mtime(logdict[pkgspec])>mtime(cachedict[pkgspec]) and not skipnewer)\
-        or get_where(logdict[pkgspec]) != get_where(cachedict[pkgspec])\
-        or recheck\
-        or (recheck_failed and not get_where(cachedict[pkgspec]) in ['pass']):
-
-            try:
-                os.remove(cachedict[pkgspec])
-                count = count + 1
-            except OSError:
-                print "Error deleting %s" % cachedict[pkgspec]
-      except IOError:
-	# logfile may have disappeared
-	pass
+        try:
+            if pkgspec not in logdict \
+            or (mtime(logdict[pkgspec])>mtime(cachedict[pkgspec]) and not skipnewer)\
+            or get_where(logdict[pkgspec]) != get_where(cachedict[pkgspec])\
+            or recheck\
+            or (recheck_failed and not get_where(cachedict[pkgspec]) in ['pass']):
+
+                try:
+                    os.remove(cachedict[pkgspec])
+                    count = count + 1
+                except OSError:
+                    print "Error deleting %s" % cachedict[pkgspec]
+        except IOError:
+            # logfile may have disappeared
+            pass
 
     return( count )
 
@@ -507,22 +507,22 @@ def process_section( section, config, problem_list,
 def detect_well_known_errors( config, problem_list, recheck, recheck_failed ):
 
     for section in config['sections'].split():
-      try:
-        print time.strftime( "%a %b %2d %H:%M:%S %Z %Y", time.localtime() )
-        print "%s:" % section
-
-        ( del_cnt, add_cnt, failures ) = \
-                  process_section( section, config, problem_list,
-                                   recheck, recheck_failed )
-
-        print "parsed logfiles: %d removed, %d added" % (del_cnt, add_cnt)
-
-        for prob in problem_list:
-            pcount = len(failures.filtered(prob.name))
-            if pcount:
-                print "%7d %s" % (pcount, prob.name)
-      except MissingSection:
-        pass
+        try:
+            print time.strftime( "%a %b %2d %H:%M:%S %Z %Y", time.localtime() )
+            print "%s:" % section
+
+            ( del_cnt, add_cnt, failures ) = \
+                      process_section( section, config, problem_list,
+                                       recheck, recheck_failed )
+
+            print "parsed logfiles: %d removed, %d added" % (del_cnt, add_cnt)
+
+            for prob in problem_list:
+                pcount = len(failures.filtered(prob.name))
+                if pcount:
+                    print "%7d %s" % (pcount, prob.name)
+        except MissingSection:
+            pass
 
     print time.strftime( "%a %b %2d %H:%M:%S %Z %Y", time.localtime() )
 
diff --git a/piuparts-master-backend.py b/piuparts-master-backend.py
index df0e374..d11a60f 100644
--- a/piuparts-master-backend.py
+++ b/piuparts-master-backend.py
@@ -272,7 +272,7 @@ class Master(Protocol):
             raise CommandSyntaxError("Need exactly %d args: %s %s" %
                                      (count, command, " ".join(args)))
     def dump_pkgs(self):
-         for st in self._binary_db.get_states():
+        for st in self._binary_db.get_states():
             for name in self._binary_db.get_pkg_names_in_state(st):
                 logging.debug("%s : %s\n" % (st,name))
 
diff --git a/piuparts-report.py b/piuparts-report.py
index 2ac2b58..65e4416 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -41,7 +41,7 @@ try:
     from rpy2 import robjects
     from rpy2.robjects.packages import importr
 except:
-  pass
+    pass
 
 import piupartslib
 from piupartslib.conf import MissingSection
@@ -478,15 +478,15 @@ def emphasize_reason(reason):
         "does-not-exist",
     ]
     if reason in bad_states:
-      reason = "<em>"+reason+"</em>"
+        reason = "<em>"+reason+"</em>"
     return reason
 
 
 def source_subdir(source):
     if source[:3] == "lib":
-      return source[:4]
+        return source[:4]
     else:
-      return source[:1]
+        return source[:1]
 
 
 def maintainer_subdir(maintainer):
@@ -586,10 +586,10 @@ def create_section_navigation(section_names,current_section, doc_root):
 def get_email_address(maintainer):
     email = "INVALID maintainer address: %s" % (maintainer)
     try:
-      m = re.match(r"(.+)(<)(.+ at .+)(>)", maintainer)
-      email = m.group(3)
+        m = re.match(r"(.+)(<)(.+ at .+)(>)", maintainer)
+        email = m.group(3)
     except:
-      pass
+        pass
     return email
 
 
@@ -696,9 +696,9 @@ class Section:
             lines.append(line)
 
         if "FAIL" in preface:
-          title_style="alerttitlecell"
+            title_style="alerttitlecell"
         else:
-          title_style="titlecell"
+            title_style="titlecell"
 
         htmlpage = string.Template(HTML_HEADER + LOG_LIST_BODY_TEMPLATE + HTML_FOOTER)
         f = file(filename, "w")
@@ -737,39 +737,39 @@ class Section:
         links = []
         for vdir in dirs:
 
-          # avoid linear search against log file names by caching in a dict
-          #
-          # this cache was added to avoid a very expensive linear search
-          # against the arrays in logs_by_dir. Note that the use of this cache
-          # assumes that the contents of logs_by_dir is invarient across calls
-          # to find_links_to_logs()
-          #
-          if vdir not in self._log_name_cache:
-              self._log_name_cache[vdir] = {}
-
-              for basename in logs_by_dir[vdir]:
-                  if basename.endswith(".log"):
-                      package, version = basename[:-len(".log")].split("_")
-
-                      self._log_name_cache[vdir][package] = version
-
-          if vdir == "fail":
-            style = " class=\"needs-bugging\""
-          else:
-            style = ""
-
-          if package_name in self._log_name_cache[vdir]:
-              basename = package_name \
-                       + "_" \
-                       + self._log_name_cache[vdir][package_name] \
-                       + ".log"
-
-              links.append("<a href=\"%s/%s\"%s>%s</a>" % (
-                      self._doc_root,
-                      os.path.join(self._config.section, vdir, basename),
-                      style,
-                      html_protect(self._log_name_cache[vdir][package_name]),
-                      ))
+            # avoid linear search against log file names by caching in a dict
+            #
+            # this cache was added to avoid a very expensive linear search
+            # against the arrays in logs_by_dir. Note that the use of this cache
+            # assumes that the contents of logs_by_dir is invarient across calls
+            # to find_links_to_logs()
+            #
+            if vdir not in self._log_name_cache:
+                self._log_name_cache[vdir] = {}
+
+                for basename in logs_by_dir[vdir]:
+                    if basename.endswith(".log"):
+                        package, version = basename[:-len(".log")].split("_")
+
+                        self._log_name_cache[vdir][package] = version
+
+            if vdir == "fail":
+                style = " class=\"needs-bugging\""
+            else:
+                style = ""
+
+            if package_name in self._log_name_cache[vdir]:
+                basename = package_name \
+                         + "_" \
+                         + self._log_name_cache[vdir][package_name] \
+                         + ".log"
+
+                links.append("<a href=\"%s/%s\"%s>%s</a>" % (
+                        self._doc_root,
+                        os.path.join(self._config.section, vdir, basename),
+                        style,
+                        html_protect(self._log_name_cache[vdir][package_name]),
+                        ))
 
         return links
 
@@ -803,10 +803,10 @@ class Section:
                 "state-"+state+".html"+"#"+package_name,
                 link_target)
         else:
-          if link_target == package_name:
-            link = html_protect(package_name)
-          else:
-            link = "unknown-package"
+            if link_target == package_name:
+                link = html_protect(package_name)
+            else:
+                link = "unknown-package"
 
         return link
 
@@ -815,20 +815,20 @@ class Section:
         dirs = ""
 
         if state == "successfully-tested":
-          dirs = ["pass"]
+            dirs = ["pass"]
         elif state == "failed-testing":
-          dirs = ["fail", "bugged", "affected"]
+            dirs = ["fail", "bugged", "affected"]
         elif state == "cannot-be-tested":
-          dirs = ["untestable"]
+            dirs = ["untestable"]
 
         if dirs != "":
-          links = self.find_links_to_logs (package_name, dirs, logs_by_dir)
-          link = ", ".join(links)
+            links = self.find_links_to_logs (package_name, dirs, logs_by_dir)
+            link = ", ".join(links)
 
         if "/bugged/" in link or "/affected/" in link:
-          link += " - <a href=\"http://bugs.debian.org/cgi-bin/pkgreport.cgi?package=" \
-                  + package_name \
-                  + "\" target=\"_blank\" class=\"bugged\"> bug filed </a>\n"
+            link += " - <a href=\"http://bugs.debian.org/cgi-bin/pkgreport.cgi?package=" \
+                    + package_name \
+                    + "\" target=\"_blank\" class=\"bugged\"> bug filed </a>\n"
 
         return link
 
@@ -851,11 +851,11 @@ class Section:
 
         countsfile = os.path.join(self._output_directory, "counts.txt")
         if not os.path.isfile(countsfile):
-          logging.debug("writing new file: %s" % countsfile)
-          write_file(countsfile, header)
-          last_line = ""
+            logging.debug("writing new file: %s" % countsfile)
+            write_file(countsfile, header)
+            last_line = ""
         else:
-          last_line = read_file(countsfile)[-1]
+            last_line = read_file(countsfile)[-1]
         if not current_day in last_line:
             append_file(countsfile, counts)
             logging.debug("appending line: %s" % counts.strip())
@@ -872,7 +872,7 @@ class Section:
             sources = maintainers[maintainer]
             maintainer_subdir_path = os.path.join(maintainer_dir, maintainer_subdir(maintainer))
             if not os.path.exists(maintainer_subdir_path):
-              os.mkdir(maintainer_subdir_path)
+                os.mkdir(maintainer_subdir_path)
             rows = ""
             package_rows = ""
             packages = {}
@@ -901,18 +901,18 @@ class Section:
                           + "<td class=\"contentcell2\" colspan=\"5\">"
 
             for section in self._section_names:
-              if section != self._config.section:
-                distrolinks += "<a href=\"" \
-                               + self._doc_root \
-                               + "/" \
-                               + section \
-                               + "/maintainer/" \
-                               + maintainer_subdir(maintainer) \
-                               + "/" \
-                               + maintainer \
-                               + ".html\">" \
-                               + html_protect(section) \
-                               + "</a> "
+                if section != self._config.section:
+                    distrolinks += "<a href=\"" \
+                                   + self._doc_root \
+                                   + "/" \
+                                   + section \
+                                   + "/maintainer/" \
+                                   + maintainer_subdir(maintainer) \
+                                   + "/" \
+                                   + maintainer \
+                                   + ".html\">" \
+                                   + html_protect(section) \
+                                   + "</a> "
             distrolinks += "</td></tr>"
 
             htmlpage = string.Template(HTML_HEADER + MAINTAINER_BODY_TEMPLATE + HTML_FOOTER)
@@ -944,9 +944,9 @@ class Section:
         failed = False
         binaryrows = ""
         for binary in sorted([x.strip() for x in binaries.split(",") if x.strip()]):
-          if not self._binary_db.has_package(binary):
-                # udebs or binary packages for other architectures
-                # The latter is a FIXME which needs parsing the Packages files from other archs too
+            if not self._binary_db.has_package(binary):
+                    # udebs or binary packages for other architectures
+                    # The latter is a FIXME which needs parsing the Packages files from other archs too
                 binaryrows +=   "<tr class=\"normalrow\">" \
                               + "<td class=\"labelcell\">Binary:</td>" \
                               + "<td class=\"contentcell2\">%s</td>" \
@@ -955,99 +955,99 @@ class Section:
                               + "</tr>\n"
                 continue
 
-          state = self._binary_db.get_package_state(binary)
-
-          if not "waiting" in state and "dependency" in state:
-            state_style="lightalertlabelcell"
-          elif state == "failed-testing":
-            state_style="lightlabelcell"
-          else:
-            state_style="labelcell"
-
-          binary_version = self._binary_db.get_control_header(binary, "Version")
-          binaryrows +=   "<tr class=\"normalrow\">" \
-                        + "<td class=\"labelcell\">Binary:</td>" \
-                        + "<td class=\"contentcell2\">%s</td>" \
-                          % binary\
-                        + "<td class=\"%s\">piuparts-result:</td>" \
-                          % state_style \
-                        + "<td class=\"contentcell2\">%s %s</td>" \
-                          % ( self.link_to_state_page(self._config.section,binary,state),
-                              self.links_to_logs(binary, state, logs_by_dir) ) \
-                        + "<td class=\"labelcell\">Version:</td>" \
-                        + "<td class=\"contentcell2\">%s</td>" \
-                          % html_protect(binary_version) \
-                        + "</tr>\n"
+            state = self._binary_db.get_package_state(binary)
+
+            if not "waiting" in state and "dependency" in state:
+                state_style="lightalertlabelcell"
+            elif state == "failed-testing":
+                state_style="lightlabelcell"
+            else:
+                state_style="labelcell"
+
+            binary_version = self._binary_db.get_control_header(binary, "Version")
+            binaryrows +=   "<tr class=\"normalrow\">" \
+                          + "<td class=\"labelcell\">Binary:</td>" \
+                          + "<td class=\"contentcell2\">%s</td>" \
+                            % binary\
+                          + "<td class=\"%s\">piuparts-result:</td>" \
+                            % state_style \
+                          + "<td class=\"contentcell2\">%s %s</td>" \
+                            % ( self.link_to_state_page(self._config.section,binary,state),
+                                self.links_to_logs(binary, state, logs_by_dir) ) \
+                          + "<td class=\"labelcell\">Version:</td>" \
+                          + "<td class=\"contentcell2\">%s</td>" \
+                            % html_protect(binary_version) \
+                          + "</tr>\n"
 
-          if state not in ("successfully-tested", "essential-required"):
-            success = False
-          if state in ("failed-testing", "dependency-does-not-exist", "cannot-be-tested"):
-            failed = True
+            if state not in ("successfully-tested", "essential-required"):
+                success = False
+            if state in ("failed-testing", "dependency-does-not-exist", "cannot-be-tested"):
+                failed = True
 
         if binaryrows != "":
-          source_state="unknown"
-
-          if success: source_state="<img src=\"%s/images/sunny.png\">" % self._doc_root
-          if failed:  source_state="<img src=\"%s/images/weather-severe-alert.png\">" % self._doc_root
+            source_state="unknown"
 
-          sourcerows =    "<tr class=\"titlerow\">" \
-                        + "<td class=\"titlecell\" colspan=\"6\" id=\"%s\">%s in %s</td>" \
-                          % (source, source, self._config.section) \
-                        + "</tr>\n"
+            if success: source_state="<img src=\"%s/images/sunny.png\">" % self._doc_root
+            if failed:  source_state="<img src=\"%s/images/weather-severe-alert.png\">" % self._doc_root
 
-          sourcerows +=   "<tr class=\"normalrow\">" \
-                        + "<td class=\"labelcell\">Source:</td>" \
-                        + "<td class=\"contentcell2\">" \
-                          + "<a href=\"http://packages.qa.debian.org/%s\" target=\"_blank\">%s</a>" \
-                            % ( source, html_protect(source) ) \
-                          + "</td>" \
-                        + "<td class=\"labelcell\">piuparts summary:</td>" \
-                        + "<td class=\"contentcell2\">%s</td>" \
-                          % source_state \
-                        + "<td class=\"labelcell\">Version:</td>" \
-                        + "<td class=\"contentcell2\">%s</td>" \
-                          % html_protect(source_version) \
-                        + "</tr>\n"
+            sourcerows =    "<tr class=\"titlerow\">" \
+                          + "<td class=\"titlecell\" colspan=\"6\" id=\"%s\">%s in %s</td>" \
+                            % (source, source, self._config.section) \
+                          + "</tr>\n"
 
-          sourcerows += "<tr class=\"normalrow\">" \
-                        + "<td class=\"labelcell\">Maintainer:</td>" \
-                        + "<td class=\"contentcell2\" colspan=\"5\">%s</td>" \
-                          % self.link_to_maintainer_summary(maintainer) \
-                        + "</tr>\n"
+            sourcerows +=   "<tr class=\"normalrow\">" \
+                          + "<td class=\"labelcell\">Source:</td>" \
+                          + "<td class=\"contentcell2\">" \
+                            + "<a href=\"http://packages.qa.debian.org/%s\" target=\"_blank\">%s</a>" \
+                              % ( source, html_protect(source) ) \
+                            + "</td>" \
+                          + "<td class=\"labelcell\">piuparts summary:</td>" \
+                          + "<td class=\"contentcell2\">%s</td>" \
+                            % source_state \
+                          + "<td class=\"labelcell\">Version:</td>" \
+                          + "<td class=\"contentcell2\">%s</td>" \
+                            % html_protect(source_version) \
+                          + "</tr>\n"
 
-          if uploaders:
             sourcerows += "<tr class=\"normalrow\">" \
-                          + "<td class=\"labelcell\">Uploaders:</td>" \
+                          + "<td class=\"labelcell\">Maintainer:</td>" \
                           + "<td class=\"contentcell2\" colspan=\"5\">%s</td>" \
-                            % self.link_to_uploaders(uploaders) \
+                            % self.link_to_maintainer_summary(maintainer) \
                           + "</tr>\n"
 
-          source_summary_page_path = os.path.join( self._output_directory,
-                                                  "source",
-                                                   source_subdir(source))
-
-          if not os.path.exists(source_summary_page_path):
-             os.makedirs(source_summary_page_path)
-
-          filename = os.path.join(source_summary_page_path, (source + ".html"))
-          htmlpage = string.Template(HTML_HEADER + SOURCE_PACKAGE_BODY_TEMPLATE + HTML_FOOTER)
-
-          f = file(filename, "w")
-          f.write(htmlpage.safe_substitute( {
-             "page_title": html_protect("Status of source package "+source+" in "+self._config.section),
-             "section_navigation": create_section_navigation(self._section_names,self._config.section,self._doc_root),
-             "time": time.strftime("%Y-%m-%d %H:%M %Z"),
-             "rows": sourcerows+binaryrows,
-             "doc_root": self._doc_root,
-          }))
-          f.close()
-
-          # return parsable values
-          if success: source_state = "pass"
-          if failed:  source_state = "fail"
+            if uploaders:
+                sourcerows += "<tr class=\"normalrow\">" \
+                              + "<td class=\"labelcell\">Uploaders:</td>" \
+                              + "<td class=\"contentcell2\" colspan=\"5\">%s</td>" \
+                                % self.link_to_uploaders(uploaders) \
+                              + "</tr>\n"
+
+            source_summary_page_path = os.path.join( self._output_directory,
+                                                    "source",
+                                                     source_subdir(source))
+
+            if not os.path.exists(source_summary_page_path):
+                os.makedirs(source_summary_page_path)
+
+            filename = os.path.join(source_summary_page_path, (source + ".html"))
+            htmlpage = string.Template(HTML_HEADER + SOURCE_PACKAGE_BODY_TEMPLATE + HTML_FOOTER)
+
+            f = file(filename, "w")
+            f.write(htmlpage.safe_substitute( {
+               "page_title": html_protect("Status of source package "+source+" in "+self._config.section),
+               "section_navigation": create_section_navigation(self._section_names,self._config.section,self._doc_root),
+               "time": time.strftime("%Y-%m-%d %H:%M %Z"),
+               "rows": sourcerows+binaryrows,
+               "doc_root": self._doc_root,
+            }))
+            f.close()
+
+            # return parsable values
+            if success: source_state = "pass"
+            if failed:  source_state = "fail"
         else:
-          source_state = "udeb"
-          sourcerows = ""
+            source_state = "udeb"
+            sourcerows = ""
 
         return sourcerows, binaryrows, source_state, maintainer, uploaders
 
@@ -1114,58 +1114,58 @@ class Section:
     def create_and_link_to_analysises(self,state):
         link="<ul>"
         for template, linktarget in linktarget_by_template:
-          # sucessful logs only have issues and failed logs only have errors
-          if (state == "failed-testing" and template[-9:] != "issue.tpl") \
-              or (state == "successfully-tested" and template[-9:] == "issue.tpl"):
-            substats = ""
-
-            tpl = os.path.join(self._output_directory, template)
-            try:
-              f = file(tpl, "r")
-              rows = file.read(f)
-              f.close()
-              os.unlink(tpl)
-
-              htmlpage = string.Template(HTML_HEADER + ANALYSIS_BODY_TEMPLATE + HTML_FOOTER)
-              filename = os.path.join(self._output_directory, template[:-len(".tpl")]+".html")
-              f = file(filename, "w")
-              f.write(htmlpage.safe_substitute( {
-                 "page_title": html_protect("Packages in state "+state+" "+linktarget),
-                 "section_navigation": create_section_navigation(self._section_names,self._config.section,self._doc_root),
-                 "time": time.strftime("%Y-%m-%d %H:%M %Z"),
-                 "rows": rows,
-                 "doc_root": self._doc_root,
-               }))
-              f.close()
-              if state == "failed-testing":
-                count_bugged = string.count(rows, '"bugged/')
-                count_affected = string.count(rows, '"affected/')
-                count_failed = string.count(rows, '"fail/')
-                sep = ": "
-                if count_bugged > 0:
-                  substats += sep + "%s bugged" % count_bugged
-                  sep = ", "
-                if count_affected > 0:
-                  substats += sep + "%s affected" % count_affected
-                  sep = ", "
-                if count_failed > 0:
-                  substats += sep + "<span id=\"needs-bugging\">%s failed</span>" % count_failed
-              else:
-                  count_passed = string.count(rows, '"pass/')
-                  if count_passed > 0:
-                    substats += ": %s passed" % count_passed
-              link += "<li><a href=%s>%s</a>%s</li>\n" % \
-                       (
-                           template[:-len(".tpl")]+".html",
-                           linktarget,
-                           substats,
-                       )
-            except:
-              logging.debug("analysis template %s does not exist." % template)
+            # sucessful logs only have issues and failed logs only have errors
+            if (state == "failed-testing" and template[-9:] != "issue.tpl") \
+                or (state == "successfully-tested" and template[-9:] == "issue.tpl"):
+                substats = ""
+
+                tpl = os.path.join(self._output_directory, template)
+                try:
+                    f = file(tpl, "r")
+                    rows = file.read(f)
+                    f.close()
+                    os.unlink(tpl)
+
+                    htmlpage = string.Template(HTML_HEADER + ANALYSIS_BODY_TEMPLATE + HTML_FOOTER)
+                    filename = os.path.join(self._output_directory, template[:-len(".tpl")]+".html")
+                    f = file(filename, "w")
+                    f.write(htmlpage.safe_substitute( {
+                       "page_title": html_protect("Packages in state "+state+" "+linktarget),
+                       "section_navigation": create_section_navigation(self._section_names,self._config.section,self._doc_root),
+                       "time": time.strftime("%Y-%m-%d %H:%M %Z"),
+                       "rows": rows,
+                       "doc_root": self._doc_root,
+                     }))
+                    f.close()
+                    if state == "failed-testing":
+                        count_bugged = string.count(rows, '"bugged/')
+                        count_affected = string.count(rows, '"affected/')
+                        count_failed = string.count(rows, '"fail/')
+                        sep = ": "
+                        if count_bugged > 0:
+                            substats += sep + "%s bugged" % count_bugged
+                            sep = ", "
+                        if count_affected > 0:
+                            substats += sep + "%s affected" % count_affected
+                            sep = ", "
+                        if count_failed > 0:
+                            substats += sep + "<span id=\"needs-bugging\">%s failed</span>" % count_failed
+                    else:
+                        count_passed = string.count(rows, '"pass/')
+                        if count_passed > 0:
+                            substats += ": %s passed" % count_passed
+                    link += "<li><a href=%s>%s</a>%s</li>\n" % \
+                             (
+                                 template[:-len(".tpl")]+".html",
+                                 linktarget,
+                                 substats,
+                             )
+                except:
+                    logging.debug("analysis template %s does not exist." % template)
 
         link += "</ul>"
         if link == "<ul></ul>":
-          link = ""
+            link = ""
         return link
 
     def write_section_index_page(self,dirs,total_packages):
@@ -1174,18 +1174,18 @@ class Section:
             dir_link = ""
             analysis = ""
             for vdir in dirs:
-              if vdir in ("pass", "fail", "bugged", "affected", "untestable") and state_by_dir[vdir] == state:
-                dir_link += "<a href='%s.html'>%s</a> logs<br>" % (vdir, html_protect(vdir))
+                if vdir in ("pass", "fail", "bugged", "affected", "untestable") and state_by_dir[vdir] == state:
+                    dir_link += "<a href='%s.html'>%s</a> logs<br>" % (vdir, html_protect(vdir))
             if state in ("successfully-tested", "failed-testing"):
-              analysis = self.create_and_link_to_analysises(state)
+                analysis = self.create_and_link_to_analysises(state)
             tablerows += ("<tr class=\"normalrow\"><td class=\"contentcell2\"><a href='state-%s.html'>%s</a>%s</td>" +
                           "<td class=\"contentcell2\">%d</td><td class=\"contentcell2\">%s</td></tr>\n") % \
                           (html_protect(state), html_protect(state), analysis, len(self._binary_db.get_pkg_names_in_state(state)),
                           dir_link)
         try:
-          tablerows += self.make_stats_graph();
+            tablerows += self.make_stats_graph();
         except:
-          logging.debug("Error generating the graph images, probably python-rpy2 is not installed, disabling graphs.")
+            logging.debug("Error generating the graph images, probably python-rpy2 is not installed, disabling graphs.")
 
         tablerows += "<tr class=\"normalrow\"> <td class=\"labelcell2\">Total</td> <td class=\"labelcell2\" colspan=\"2\">%d</td></tr>\n" % total_packages
         htmlpage = string.Template(HTML_HEADER + SECTION_INDEX_BODY_TEMPLATE + HTML_FOOTER)
@@ -1382,25 +1382,25 @@ def main():
     if os.path.exists(master_directory):
         packagedb_cache = {}
         for section_name in section_names:
-          try:
-            section = Section(section_name, master_directory, doc_root, packagedb_cache=packagedb_cache)
-          except MissingSection as e:
-            logging.error("Configuration Error in section '%s': %s" % (section_name, e))
-          else:
-            section.generate_output(output_directory=output_directory, section_names=section_names)
+            try:
+                section = Section(section_name, master_directory, doc_root, packagedb_cache=packagedb_cache)
+            except MissingSection as e:
+                logging.error("Configuration Error in section '%s': %s" % (section_name, e))
+            else:
+                section.generate_output(output_directory=output_directory, section_names=section_names)
 
         # static pages
         logging.debug("Writing static pages")
         for page in ("index", "bug_howto"):
-          tpl = os.path.join(output_directory,page+".tpl")
-          INDEX_BODY = "".join(read_file(tpl))
-          htmlpage = string.Template(HTML_HEADER + INDEX_BODY + HTML_FOOTER)
-          write_file(os.path.join(output_directory,page+".html"), htmlpage.safe_substitute( {
-                                 "page_title": "About piuparts.debian.org and News",
-                                 "section_navigation": create_section_navigation(section_names,"sid",doc_root),
-                                 "time": time.strftime("%Y-%m-%d %H:%M %Z"),
-                                 "doc_root": doc_root,
-                              }))
+            tpl = os.path.join(output_directory,page+".tpl")
+            INDEX_BODY = "".join(read_file(tpl))
+            htmlpage = string.Template(HTML_HEADER + INDEX_BODY + HTML_FOOTER)
+            write_file(os.path.join(output_directory,page+".html"), htmlpage.safe_substitute( {
+                                   "page_title": "About piuparts.debian.org and News",
+                                   "section_navigation": create_section_navigation(section_names,"sid",doc_root),
+                                   "time": time.strftime("%Y-%m-%d %H:%M %Z"),
+                                   "doc_root": doc_root,
+                                }))
 
     else:
         logging.debug("Warning: %s does not exist!?! Creating it for you now." % master_directory)
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 212fe9b..ccc9ed7 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -932,11 +932,11 @@ def main():
 
 
 if __name__ == "__main__":
-  try:
-     main()
-  except KeyboardInterrupt:
-     print ''
-     print 'Slave interrupted by the user, exiting...'
-     sys.exit(1)
+    try:
+        main()
+    except KeyboardInterrupt:
+        print ''
+        print 'Slave interrupted by the user, exiting...'
+        sys.exit(1)
 
 # vi:set et ts=4 sw=4 :
diff --git a/piuparts.py b/piuparts.py
index 435aba0..b705102 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -997,10 +997,10 @@ class Chroot:
             lines.append('force-confdef\n')
             logging.info("Warning: dpkg has been configured to use the force-confdef option. This will hide problems, see #466118.")
         if lines:
-          if not os.path.exists(self.relative("etc/dpkg/dpkg.cfg.d")):
-              os.mkdir(self.relative("etc/dpkg/dpkg.cfg.d"))
-          create_file(self.relative("etc/dpkg/dpkg.cfg.d/piuparts"),
-            "".join(lines))
+            if not os.path.exists(self.relative("etc/dpkg/dpkg.cfg.d")):
+                os.mkdir(self.relative("etc/dpkg/dpkg.cfg.d"))
+            create_file(self.relative("etc/dpkg/dpkg.cfg.d/piuparts"),
+              "".join(lines))
 
     def create_policy_rc_d(self):
         """Create a policy-rc.d that prevents daemons from running."""
@@ -1017,7 +1017,7 @@ class Chroot:
         if settings.eatmydata and os.path.isfile('/usr/bin/eatmydata'):
             prefix.append('eatmydata')
         if settings.do_not_verify_signatures:
-          logging.info("Warning: not using --keyring option when running debootstrap!")
+            logging.info("Warning: not using --keyring option when running debootstrap!")
         options = [settings.keyringoption]
         if settings.eatmydata:
             options.append('--include=eatmydata')
@@ -1031,7 +1031,7 @@ class Chroot:
     def minimize(self):
         """Minimize a chroot by removing (almost all) unnecessary packages"""
         if settings.skip_minimize or not settings.minimize:
-             return
+            return
         self.run(["apt-get", "install", "debfoster"])
         debfoster_command = ["debfoster"] + settings.debfoster_options
         if settings.eatmydata:
@@ -1635,11 +1635,11 @@ class VirtServ(Chroot):
 
     def _vs_send(self, cmd):
         if type(cmd) == type([]):
-                def maybe_quote(a):
-                    if type(a) != type(()): return a
-                    (a,) = a
-                    return urllib.quote(a)
-                cmd = ' '.join(map(maybe_quote,cmd))
+            def maybe_quote(a):
+                if type(a) != type(()): return a
+                (a,) = a
+                return urllib.quote(a)
+            cmd = ' '.join(map(maybe_quote,cmd))
         logging.debug('adt-virt >> %s', cmd)
         print >>self._vs.stdin, cmd
         return cmd.split(' ')[0]
@@ -2146,12 +2146,12 @@ def check_results(chroot, chroot_state, file_owners, deps_info=None):
 
     if new:
         if settings.warn_on_leftovers_after_purge:
-          logging.info("Warning: Package purging left files on system:\n" +
-                       file_list(new, file_owners))
+            logging.info("Warning: Package purging left files on system:\n" +
+                         file_list(new, file_owners))
         else:
-          logging.error("FAIL: Package purging left files on system:\n" +
-                       file_list(new, file_owners))
-          ok = False
+            logging.error("FAIL: Package purging left files on system:\n" +
+                         file_list(new, file_owners))
+            ok = False
     if removed:
         logging.error("FAIL: After purging files have disappeared:\n" +
                       file_list(removed, file_owners))
@@ -2797,11 +2797,11 @@ def parse_command_line():
     settings.keyring = opts.keyring
     settings.do_not_verify_signatures = opts.do_not_verify_signatures
     if settings.do_not_verify_signatures:
-      settings.keyringoption=""
-      settings.apt_unauthenticated="Yes"
+        settings.keyringoption=""
+        settings.apt_unauthenticated="Yes"
     else:
-      settings.keyringoption="--keyring=%s" % settings.keyring
-      settings.apt_unauthenticated="No"
+        settings.keyringoption="--keyring=%s" % settings.keyring
+        settings.apt_unauthenticated="No"
     settings.install_recommends = opts.install_recommends
     settings.eatmydata = not opts.no_eatmydata
     settings.dpkg_force_unsafe_io = not opts.dpkg_noforce_unsafe_io
@@ -2821,7 +2821,7 @@ def parse_command_line():
     settings.skip_minimize = opts.skip_minimize
     settings.minimize = opts.minimize
     if settings.minimize:
-      settings.skip_minimize = False
+        settings.skip_minimize = False
     settings.debfoster_options = opts.debfoster_options.split()
     # tests and checks
     settings.no_install_purge_test = opts.no_install_purge_test
@@ -2845,7 +2845,7 @@ def parse_command_line():
     settings.ignored_files += opts.ignore
     settings.ignored_patterns += opts.ignore_regex
     if not settings.pedantic_purge_test:
-      settings.ignored_patterns += settings.non_pedantic_ignore_patterns
+        settings.ignored_patterns += settings.non_pedantic_ignore_patterns
 
     if opts.adt_virt is None:
         settings.adt_virt = None
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 13e0dfb..7876f73 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -108,7 +108,7 @@ class Package(UserDict.UserDict):
     def prefer_alt_depends(self, header_name,dep_idx,dep):
         if header_name in self:
             if header_name not in self._parsed_deps:
-                  self._parse_dependencies(header_name)
+                self._parse_dependencies(header_name)
             if self._parsed_deps[header_name][dep_idx]:
                 self._parsed_deps[header_name][dep_idx] = dep
 
@@ -630,29 +630,29 @@ class PackagesDB:
     def get_control_header(self, package_name, header):
         self._find_all_packages()
         if header == "Source":
-          # binary packages build from the source package with the same name
-          # don't have a Source header, so let's try:
-          try:
-            _source = self._packages[package_name][header]
-            # for binNMU the Source header in Packages files holds the version
-            # too, so we need to chop it of:
-            if " " in _source:
-              source, version = _source.split(" ")
-            else:
-              source = _source
-          except:
-            source = self._packages[package_name]["Package"]
-          return source
+            # binary packages build from the source package with the same name
+            # don't have a Source header, so let's try:
+            try:
+                _source = self._packages[package_name][header]
+                # for binNMU the Source header in Packages files holds the version
+                # too, so we need to chop it of:
+                if " " in _source:
+                    source, version = _source.split(" ")
+                else:
+                    source = _source
+            except:
+                source = self._packages[package_name]["Package"]
+            return source
         elif header == "Uploaders":
-          # not all (source) packages have an Uploaders header
-          uploaders = ""
-          try:
-            uploaders = self._packages[package_name][header]
-          except:
-            pass
-          return uploaders
+            # not all (source) packages have an Uploaders header
+            uploaders = ""
+            try:
+                uploaders = self._packages[package_name][header]
+            except:
+                pass
+            return uploaders
         else:
-          return self._packages[package_name][header]
+            return self._packages[package_name][header]
 
     def get_package_state(self, package_name, resolve_virtual=True, recurse=True):
         self._compute_package_states()

-- 
piuparts git repository



More information about the Piuparts-commits mailing list