[Piuparts-commits] [piuparts] 02/06: Change pkgsummary 'summ' references to 'summary'
Holger Levsen
holger at moszumanska.debian.org
Wed Apr 30 10:24:46 UTC 2014
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit c5465b61ff3ddb725dd7b28652ca70c79ddb8c07
Author: David Steele <dsteele at gmail.com>
Date: Sun Mar 9 11:08:23 2014 -0400
Change pkgsummary 'summ' references to 'summary'
Twas a silly name anyway.
---
piuparts-report.py | 36 +++++++++++++++++++-----------------
piupartslib/pkgsummary.py | 37 +++++++++++++++++++------------------
2 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/piuparts-report.py b/piuparts-report.py
index fdbfe25..1c2a6fc 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -558,7 +558,7 @@ def source_subdir(source):
else:
return source[:1]
-def source_summ_url(master_host, doc_root, section, src_pkg):
+def source_summary_url(master_host, doc_root, section, src_pkg):
return( "http://%s%s/%s/source/%s/%s.html" %
(
master_host,
@@ -1475,16 +1475,16 @@ class Section:
return flag
def generate_summary(self, master_host):
- summ_path = os.path.join(self._output_directory, "summary.json")
+ summary_path = os.path.join(self._output_directory, "summary.json")
- if os.path.isfile(summ_path):
- os.unlink(summ_path)
+ if os.path.isfile(summary_path):
+ os.unlink(summary_path)
reporting_sections = self._config['reporting-sections'].split()
if reporting_sections:
logging.debug("Generating summary")
- summ = pkgsummary.new_summ()
+ summary = pkgsummary.new_summary()
for reporting_section in reporting_sections:
for binpkg in self._binary_db.get_all_packages():
@@ -1495,13 +1495,15 @@ class Section:
if flag == 'F':
block_cnt = self._binary_db.block_count(pkgname)
srcpkg = self._binary_db.get_source(pkgname)
- url = source_summ_url(master_host, self._doc_root,
- self._config.section, srcpkg)
+ url = source_summary_url(
+ master_host, self._doc_root,
+ self._config.section, srcpkg)
- pkgsummary.add_summ(summ, reporting_section, srcpkg,
- flag, block_cnt, url)
+ pkgsummary.add_summary(
+ summary, reporting_section, srcpkg,
+ flag, block_cnt, url)
- pkgsummary.summ_write(summ, summ_path)
+ pkgsummary.write_summary(summary, summary_path)
def generate_output(self, output_directory, section_names, problem_list, master_host):
# skip output generation for disabled sections
@@ -1529,7 +1531,7 @@ def generate_global_summary(dir, sections):
logging.debug("Generating global summary")
- summ = pkgsummary.new_summ()
+ summary = pkgsummary.new_summary()
def by_precedence(secname):
return(by_precedence.section_precedence[secname])
@@ -1546,13 +1548,13 @@ def generate_global_summary(dir, sections):
for section in sorted(sections, key=by_precedence):
sec_path = os.path.join(dir, section, json_name)
if os.path.isfile(sec_path):
- sec_summ = pkgsummary.summ_read(sec_path)
- summ = pkgsummary.merge_summ(summ, sec_summ)
+ sec_summ = pkgsummary.read_summary(sec_path)
+ summary = pkgsummary.merge_summary(summary, sec_summ)
- summ_path = os.path.join(dir, json_name)
- if os.path.isfile(summ_path):
- os.unlink(summ_path)
- pkgsummary.summ_write(summ, summ_path)
+ summary_path = os.path.join(dir, json_name)
+ if os.path.isfile(summary_path):
+ os.unlink(summary_path)
+ pkgsummary.write_summary(summary, summary_path)
# START detect_well_known_errors
diff --git a/piupartslib/pkgsummary.py b/piupartslib/pkgsummary.py
index 98bbfba..d0b07d6 100644
--- a/piupartslib/pkgsummary.py
+++ b/piupartslib/pkgsummary.py
@@ -93,7 +93,7 @@ SUMMVER = "1.0"
DEFSEC = 'overall'
-def new_summ():
+def new_summary():
cdate_array = datetime.datetime.utcnow().ctime().split()
utcdate = " ".join(cdate_array[:-1] + ["UTC"] + [cdate_array[-1]])
@@ -119,10 +119,11 @@ def worst_flag(*args):
return(min([(sev[x],x) for x in args])[1])
-def add_summ(summ, rep_sec, pkg, flag, block_cnt, url):
- """Add a flag/count/url result to summ for a package in a reporting-section"""
+def add_summary(summary, rep_sec, pkg, flag, block_cnt, url):
+ """Add a flag/count/url result to summary for a package in a
+ reporting-section"""
- pdict = summ["packages"]
+ pdict = summary["packages"]
if pkg not in pdict:
pdict[pkg] = {}
@@ -139,9 +140,9 @@ def add_summ(summ, rep_sec, pkg, flag, block_cnt, url):
else:
pdict[pkg][rep_sec] = [flag, block_cnt, url]
- return summ
+ return summary
-def merge_summ(summ, sec_summ):
+def merge_summary(gbl_summ, sec_summ):
"""Merge a sector summary into the global summary"""
spdict = sec_summ["packages"]
@@ -149,12 +150,12 @@ def merge_summ(summ, sec_summ):
for pkg in spdict:
for rep_sec in spdict[pkg]:
flag, block_cnt, url = spdict[pkg][rep_sec]
- add_summ(summ, rep_sec, pkg, flag, block_cnt, url)
- add_summ(summ, DEFSEC, pkg, flag, block_cnt, url)
+ add_summary(gbl_summ, rep_sec, pkg, flag, block_cnt, url)
+ add_summary(gbl_summ, DEFSEC, pkg, flag, block_cnt, url)
- return summ
+ return gbl_summ
-def tooltip(summ, pkg):
+def tooltip(summary, pkg):
"""Returns e.g. "Failed in testing and stable, blocking 5 packages"."""
tip = ''
@@ -166,7 +167,7 @@ def tooltip(summ, pkg):
'-': 'Unknown',
}
- pkgdict = summ['packages']
+ pkgdict = summary['packages']
if pkg in pkgdict:
flag, block_cnt, url = pkgdict[pkg][DEFSEC]
@@ -190,11 +191,11 @@ def tooltip(summ, pkg):
return tip
-def summ_write(summ, fname):
+def write_summary(summary, fname):
with open(fname, 'w') as fl:
- json.dump(summ, fl, sort_keys=True, indent=1)
+ json.dump(summary, fl, sort_keys=True, indent=1)
-def summ_read(fname):
+def read_summary(fname):
with open(fname, 'r') as fl:
result = json.load(fl)
@@ -207,10 +208,10 @@ if __name__ == '__main__':
import sys
# read a global summary file and return DDPO info by package
- summ = summ_read(sys.argv[1])
+ summary = read_summary(sys.argv[1])
- for pkg in summ['packages']:
- flag, blocked, url = summ['packages'][pkg][DEFSEC]
+ for pkg in summary['packages']:
+ flag, blocked, url = summary['packages'][pkg][DEFSEC]
- print pkg, flag, url, tooltip(summ, pkg)
+ print pkg, flag, url, tooltip(summary, pkg)
--
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