[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. 0.51
Holger Levsen
holger at layer-acht.org
Wed May 15 10:09:54 UTC 2013
The following commit has been merged in the master branch:
commit fe8fd870712c2e197b961c67a2f2ca110ab9da75
Merge: dcbc09da4bc6c430bd13634e961ebe4e79bb7b81 81f60717660d74b5fd4de48a4f7918182c87955c
Author: Holger Levsen <holger at layer-acht.org>
Date: Mon Apr 22 11:27:39 2013 +0200
Merge remote-tracking branch 'dave/issue-sort-fixes' into develop
diff --combined debian/changelog
index c05e257,55efd4f..b4d1c4d
--- a/debian/changelog
+++ b/debian/changelog
@@@ -8,7 -8,6 +8,7 @@@ piuparts (0.51) UNRELEASED; urgency=lo
* piuparts.conf:
* distros.conf:
- Update backports setup after integration into the regular archive.
+ - Enable stable security updates when installing stable backports.
* piupartslib/conf.py:
- Raise MissingSection if the requested section is not in piuparts.conf.
* piupartslib/packagesdb.py:
@@@ -60,11 -59,14 +60,14 @@@
[ David Steele ]
* detect_well_known_errors:
- Replace the bash script with an equivalent Python script.
- - Sort known error and issue packages by reverse dependency count.
+ - Sort known error and issue packages by reverse dependency count,
+ separating bugged from everything else.
(Closes: #698526)
- Add a PTS link to issue and error summary entries.
- - Replace the known_problem COMMAND with INCLUDE and EXCLUDE, and replace
- grep shell calls with python re modules calls, for a 10x speedup.
+ - Replace the known_problem COMMAND with PATTERN and EXCLUDE_PATTERN,
+ and replace grep shell calls with python re modules calls, for a
+ 10x speedup.
+ - Validate field names, and only use valid known problem conf files.
- Minor HTML syntax fix.
- Minor template integration.
diff --combined master-bin/detect_well_known_errors
index 6ca072f,d50e3f6..6810a26
--- a/master-bin/detect_well_known_errors
+++ b/master-bin/detect_well_known_errors
@@@ -109,15 -109,29 +109,29 @@@ class Problem()
self.name = os.path.basename(probpath)
self.short_name = os.path.splitext( self.name )[0]
+ self.tags_are_valid = True
+
+ self.required_tags = [ "PATTERN", "WHERE", "ISSUE",
+ "HEADER", "HELPTEXT"]
+ self.optional_tags = ["EXCLUDE_PATTERN", "EXPLAIN", "PRIORITY"]
+
+
self.init_problem()
- self.inc_re = re.compile( self.INCLUDE )
+ for tag in self.required_tags:
+ if not tag in self.__dict__:
+ self.tags_are_valid = False
- if "EXCLUDE" in self.__dict__:
- self.exc_re = re.compile( self.EXCLUDE )
+ self.inc_re = re.compile( self.PATTERN )
+
+ if "EXCLUDE_PATTERN" in self.__dict__:
+ self.exc_re = re.compile( self.EXCLUDE_PATTERN )
else:
self.exc_re = None
+ def valid(self):
+ return self.tags_are_valid
+
def init_problem(self):
"""Load problem file parameters (HELPTEXT="foo" -> self.HELPTEXT)"""
@@@ -138,7 -152,10 +152,10 @@@
or re.search( '^\".+\"$', value, re.MULTILINE|re.DOTALL ):
value = value[1:-1]
- self.__dict__[name] = value
+ if name in self.required_tags or name in self.optional_tags:
+ self.__dict__[name] = value
+ else:
+ self.tags_are_valid = False
self.WHERE = self.WHERE.split(" ")
@@@ -157,10 -174,10 +174,10 @@@
def get_command(self):
- cmd = "grep -E \"%s\"" % self.INCLUDE
+ cmd = "grep -E \"%s\"" % self.PATTERN
- if "EXCLUDE" in self.__dict__:
- cmd += " | grep -v -E \"%s\"" % self.EXCLUDE
+ if "EXCLUDE_PATTERN" in self.__dict__:
+ cmd += " | grep -v -E \"%s\"" % self.EXCLUDE_PATTERN
return(cmd)
@@@ -202,16 -219,19 +219,19 @@@ class FailureManager()
def sort_by_path( self ):
self.failures.sort(key=lambda x: self.logdict[x.pkgspec])
- def sort_by_rdeps( self, pkgsdb ):
+ def sort_by_bugged_and_rdeps( self, pkgsdb ):
self.pkgsdb = pkgsdb
def keyfunc( x, pkgsdb=self.pkgsdb, logdict=self.logdict):
try:
- rdeps = pkgsdb.get_package(get_pkg(x.pkgspec)).rrdep_count()
+ pkg_name = get_pkg(x.pkgspec)
+ rdeps = pkgsdb.get_package(pkg_name).rrdep_count()
except KeyError:
rdeps = 0
- return( (-rdeps, logdict[x.pkgspec]) )
+ is_failed = get_where(logdict[x.pkgspec]) == "fail"
+
+ return( (not is_failed, -rdeps, logdict[x.pkgspec]) )
self.failures.sort( key=keyfunc )
@@@ -347,6 -367,7 +367,7 @@@ def populate_tpl( tmpl, vals )
def update_tpl( basedir, section, problem, failures, logdict, ftpl, ptpl, pkgsdb ):
pkg_text = ""
+ bugged_section = False
for failure in failures:
pkgspec = failure.pkgspec
@@@ -358,6 -379,10 +379,10 @@@
src_pkg = bin_pkg
rdep_cnt = 0
+ if (not bugged_section) and "bugged" in logdict[pkgspec]:
+ bugged_section = True
+ pkg_text += "<br>\n"
+
pkg_text += populate_tpl(ftpl, {
'LOG': section_path(logdict[pkgspec]),
'PACKAGE': bin_pkg,
@@@ -402,11 -427,14 +427,14 @@@ def update_html( section, logdict, prob
def keyfunc( x, pkgsdb=pkgsdb, logdict=logdict):
try:
- rdeps = pkgsdb.get_package(get_pkg(x.pkgspec)).rrdep_count()
+ pkg_name = get_pkg(x.pkgspec)
+ rdeps = pkgsdb.get_package(pkg_name).rrdep_count()
except KeyError:
rdeps = 0
- return( (-rdeps, logdict[x.pkgspec]) )
+ is_failed = get_where(logdict[x.pkgspec]) == "fail"
+
+ return( (not is_failed, -rdeps, logdict[x.pkgspec]) )
unknownsasfailures.sort( key=keyfunc )
@@@ -457,13 -485,12 +485,13 @@@ def process_section( section, config, p
pkgsdb.read_packages_file(pkg_fl)
pkg_fl.close()
+ pkgsdb.compute_package_states()
pkgsdb.calc_rrdep_counts()
os.chdir(oldcwd)
failures = FailureManager( logdict )
- failures.sort_by_rdeps(pkgsdb)
+ failures.sort_by_bugged_and_rdeps(pkgsdb)
update_html( section, logdict, problem_list, failures, config, pkgsdb )
@@@ -493,8 -520,15 +521,15 @@@ def detect_well_known_errors( config, p
def create_problem_list( pdir ):
- pfiles = [x for x in sorted(os.listdir(pdir)) if x.endswith(".conf")]
- plist = [Problem(os.path.join(pdir,x)) for x in pfiles]
+ plist = []
+
+ for pfile in [x for x in sorted(os.listdir(pdir)) if x.endswith(".conf")]:
+ prob = Problem(os.path.join(pdir,pfile))
+
+ if prob.valid():
+ plist.append(prob)
+ else:
+ print "Keyword error in %s - skipping" % pfile
return plist
--
piuparts git repository
More information about the Piuparts-commits
mailing list