summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/reproducible_common.py41
-rwxr-xr-xbin/reproducible_html_notes.py24
2 files changed, 35 insertions, 30 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 0df8cdaf..3d26502b 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -45,20 +45,25 @@ if args.debug or DEBUG:
log_level = logging.DEBUG
if args.quiet or QUIET:
log_level = logging.ERROR
-logging.basicConfig(level=log_level)
-
-logging.debug("BIN_PATH:\t" + BIN_PATH)
-logging.debug("BASE:\t" + BASE)
-logging.debug("NOTES_URI:\t" + NOTES_URI)
-logging.debug("ISSUES_URI:\t" + ISSUES_URI)
-logging.debug("NOTES_PATH:\t" + NOTES_PATH)
-logging.debug("ISSUES_PATH:\t" + ISSUES_PATH)
-logging.debug("RB_PKG_URI:\t" + RB_PKG_URI)
-logging.debug("RB_PKG_PATH:\t" + RB_PKG_PATH)
-logging.debug("REPRODUCIBLE_DB:\t" + REPRODUCIBLE_DB)
-logging.debug("REPRODUCIBLE_JSON:\t" + REPRODUCIBLE_JSON)
-logging.debug("JENKINS_URL:\t\t" + JENKINS_URL)
-logging.debug("REPRODUCIBLE_URL:\t" + REPRODUCIBLE_URL)
+log = logging.getLogger(__name__)
+log.setLevel(log_level)
+sh = logging.StreamHandler()
+sh.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
+log.addHandler(sh)
+
+
+log.debug("BIN_PATH:\t" + BIN_PATH)
+log.debug("BASE:\t" + BASE)
+log.debug("NOTES_URI:\t" + NOTES_URI)
+log.debug("ISSUES_URI:\t" + ISSUES_URI)
+log.debug("NOTES_PATH:\t" + NOTES_PATH)
+log.debug("ISSUES_PATH:\t" + ISSUES_PATH)
+log.debug("RB_PKG_URI:\t" + RB_PKG_URI)
+log.debug("RB_PKG_PATH:\t" + RB_PKG_PATH)
+log.debug("REPRODUCIBLE_DB:\t" + REPRODUCIBLE_DB)
+log.debug("REPRODUCIBLE_JSON:\t" + REPRODUCIBLE_JSON)
+log.debug("JENKINS_URL:\t\t" + JENKINS_URL)
+log.debug("REPRODUCIBLE_URL:\t" + REPRODUCIBLE_URL)
html_header = Template("""<!DOCTYPE html>
<html>\n<head>
@@ -181,10 +186,10 @@ count_good = int(query_db(
'SELECT COUNT(name) FROM source_packages WHERE status="reproducible"')[0][0])
percent_total = round(((count_total/amount)*100), 2)
percent_good = round(((count_good/count_total)*100), 2)
-logging.info('Total packages in Sid:\t' + str(amount))
-logging.info('Total tested packages:\t' + str(count_total))
-logging.info('Total reproducible packages:\t' + str(count_good))
-logging.info('That means that out of the ' + str(percent_total) + '% of ' +
+log.info('Total packages in Sid:\t' + str(amount))
+log.info('Total tested packages:\t' + str(count_total))
+log.info('Total reproducible packages:\t' + str(count_good))
+log.info('That means that out of the ' + str(percent_total) + '% of ' +
'the Sid tested packages the ' + str(percent_good) + '% are ' +
'reproducible!')
diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py
index a89e02da..28081ffa 100755
--- a/bin/reproducible_html_notes.py
+++ b/bin/reproducible_html_notes.py
@@ -74,7 +74,7 @@ def load_notes():
"""
with open(NOTES) as fd:
notes = yaml.load(fd)
- logging.debug("notes loaded. There are " + str(len(notes)) +
+ log.debug("notes loaded. There are " + str(len(notes)) +
" package listed")
return notes
@@ -86,7 +86,7 @@ def load_issues():
"""
with open(ISSUES) as fd:
issues = yaml.load(fd)
- logging.debug("issues loaded. There are " + str(len(issues)) +
+ log.debug("issues loaded. There are " + str(len(issues)) +
" issues listed")
return issues
@@ -100,7 +100,7 @@ def fill_issue_in_note(issue):
desc = details['description'].replace('\n', '<br />')
html += note_issue_html_desc.substitute(description=desc)
else:
- logging.warning("The issue " + issue + " misses a description")
+ log.warning("The issue " + issue + " misses a description")
return note_issue_html.substitute(issue=issue, issue_info=html)
@@ -138,7 +138,7 @@ def gen_html_note(note):
try:
return note_html.substitute(version=str(note['version']), infos=infos)
except KeyError:
- logging.warning('You should really include a version in the ' +
+ log.warning('You should really include a version in the ' +
str(note['package']) + ' note')
return note_html.substitute(version='N/A', infos=infos)
@@ -162,7 +162,7 @@ def gen_html_issue(issue):
try:
desc = issues[issue]['description']
except KeyError:
- logging.warning('You should really include a description in the ' +
+ log.warning('You should really include a description in the ' +
issue + ' issue')
desc = 'N/A'
desc = url2html.sub(r'<a href="\1">\1</a>', desc)
@@ -174,10 +174,10 @@ def iterate_over_notes(notes):
num_notes = str(len(notes))
i = 0
for package in sorted(notes):
- logging.debug('iterating over notes... ' + str(i) + '/' + num_notes)
+ log.debug('iterating over notes... ' + str(i) + '/' + num_notes)
note = notes[package]
note['package'] = package
- logging.debug('\t' + str(note))
+ log.debug('\t' + str(note))
html = gen_html_note(note)
title = 'Notes for ' + package + ' - reproducible builds result'
@@ -186,15 +186,15 @@ def iterate_over_notes(notes):
noheader=True, nofooter=True)
desturl = REPRODUCIBLE_URL + NOTES_URI + '/' + package + '_note.html'
- #logging.info("you can now see your notes at " + desturl)
+ log.info("you can now see your notes at " + desturl)
i = i + 1
def iterate_over_issues(issues):
num_issues = str(len(issues))
i = 0
for issue in sorted(issues):
- logging.debug('iterating over issues... ' + str(i) + '/' + num_issues)
- logging.debug('\t' + str(issue))
+ log.debug('iterating over issues... ' + str(i) + '/' + num_issues)
+ log.debug('\t' + str(issue))
html = gen_html_issue(issue)
title = 'Notes about issue ' + issue
@@ -202,7 +202,7 @@ def iterate_over_issues(issues):
write_html_page(title=title, body=html, destfile=destfile)
desturl = REPRODUCIBLE_URL + ISSUES_URI + '/' + issue + '_issue.html'
- #logging.info("you can now see the issue at " +desturl)
+ log.info("you can now see the issue at " +desturl)
i = i + 1
def index_issues(issues):
@@ -217,7 +217,7 @@ def index_issues(issues):
destfile = BASE + '/userContent/index_issues.html'
desturl = REPRODUCIBLE_URL + '/userContent/index_issues.html'
write_html_page(title=title, body=html, destfile=destfile, nofooter=True)
- logging.info('Issues index now available at ' + desturl)
+ log.info('Issues index now available at ' + desturl)
if __name__ == '__main__':
issues_count = {}