Package: qa.debian.org Severity: normal Tags: patch User: qa.debian....@packages.debian.org Usertags: debsources
Until now the sticky suites plots are not configured to be updated. While this is normal as they are not supposed to receive any updates this is troublesome when there are modifications in the plotting methods. For example one there are changes in the axes, the pie charts etc. The patch uses the debsources-suite-archive to enable the refresh on the sticky suites plots. In addition it includes the sticky suites in the bar chart plot. -- System Information: Debian Release: 8.0 APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
>From d35fbe36876b55edb6bf886cad2a668ee0cc143f Mon Sep 17 00:00:00 2001 From: Orestis Ioannou <ores...@oioannou.com> Date: Tue, 24 Mar 2015 16:10:16 +0100 Subject: [PATCH 2/2] charts: add sticky suites in bar chart, enable refresh of charts Bar charts now take into account the sticky suites as well. The suite-archive has a new action refresh that refreshes a stage for example --stage charts will replot charts for sticky suites --- bin/debsources-suite-archive | 9 +++++++-- debsources/statistics.py | 4 +++- debsources/updater.py | 17 ++++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bin/debsources-suite-archive b/bin/debsources-suite-archive index d580d88..d1c39c2 100755 --- a/bin/debsources-suite-archive +++ b/bin/debsources-suite-archive @@ -29,13 +29,14 @@ import sys from debsources import archiver from debsources import debmirror from debsources import mainlib +from debsources import updater def main(): cmdline = argparse.ArgumentParser(description='Debsources suite ' 'archive manager') cmdline.add_argument('action', metavar='ACTION', - choices=['add', 'list', 'remove'], + choices=['add', 'list', 'remove', 'refresh'], help='action to perform on the archive of ' 'sticky suites') cmdline.add_argument('suite', metavar='SUITE', nargs='?', default=None, @@ -45,7 +46,8 @@ def main(): args = cmdline.parse_args() if args.action in ['add', 'remove'] and args.suite is None: cmdline.error('%s requires a suite name' % args.action) - + if args.action == 'refresh' and args.stages is None: + cmdline.error('%s requires a stage' % args.action) conf = mainlib.load_conf(args.conffile or mainlib.guess_conffile()) mainlib.override_conf(conf, args) mainlib.init_logging(conf, mainlib.log_level_of_verbosity(args.verbose)) @@ -68,6 +70,9 @@ def main(): (suite, present['db'], present['archive'])) elif args.action == 'remove': archiver.remove_suite(conf, session, args.suite) + elif args.action == 'refresh': + conf['refresh'] = True + updater.update(conf, session, stages=conf['stages']) if conf['single_transaction']: session.commit() except SystemExit: # exit as requested diff --git a/debsources/statistics.py b/debsources/statistics.py index b2904f4..d8350b8 100644 --- a/debsources/statistics.py +++ b/debsources/statistics.py @@ -66,13 +66,15 @@ def suites(session, suites='release'): return sorted(db_suites, cmp=by_release_date) -def sticky_suites(session): +def sticky_suites(session, order=None): """list sticky suites currently present in Debsources DB """ q = session.query(SuiteInfo.name) \ .filter(SuiteInfo.sticky == True) # NOQA, # '== True' can be dropped starting with sqlalchemy >= 0.8 + if order: + q = q.order_by("release_date") return [row[0] for row in q] diff --git a/debsources/updater.py b/debsources/updater.py index 0c90826..524c575 100644 --- a/debsources/updater.py +++ b/debsources/updater.py @@ -512,7 +512,10 @@ def update_charts(status, conf, session, suites=None): logging.info('update charts...') ensure_stats_dir(conf) - suites = __target_suites(session, suites) + if 'refresh' in conf.keys(): + suites = statistics.sticky_suites(session, True) + else: + suites = __target_suites(session, suites) CHARTS = [ # <period, granularity> paris ('1 month', 'hourly'), @@ -547,26 +550,30 @@ def update_charts(status, conf, session, suites=None): charts.sloc_plot(mseries, chart_file) # sloccount: current pie charts - sloc_per_suite = [] for suite in suites + ['ALL']: sloc_suite = suite if sloc_suite == 'ALL': sloc_suite = None slocs = statistics.sloccount_summary(session, suite=sloc_suite) - if suite not in ['ALL']: - sloc_per_suite.append(slocs) chart_file = os.path.join(conf['cache_dir'], 'stats', '%s-sloc_pie-current.png' % suite) if not conf['dry_run']: charts.sloc_pie(slocs, chart_file) # sloccount: bar chart plot + all_suites = statistics.sticky_suites(session, True) \ + + __target_suites(session, None) + sloc_per_suite = [] + for suite in all_suites: + slocs = statistics.sloccount_summary(session, suite=suite) + sloc_per_suite.append(slocs) + if 'charts_top_langs' in conf.keys(): top_langs = int(conf['charts_top_langs']) else: top_langs = 6 chart_file = os.path.join(conf['cache_dir'], 'stats', 'sloc_bar_plot.png') - charts.bar_chart(sloc_per_suite, suites, chart_file, top_langs) + charts.bar_chart(sloc_per_suite, all_suites, chart_file, top_langs) # update stages (STAGE_EXTRACT, -- 2.1.4