[Apt-listbugs-commits] [apt-listbugs] 01/02: make ParseStep configurable (Closes: #562499)
Francesco Poli
frx-guest at moszumanska.debian.org
Sat Mar 29 15:29:27 UTC 2014
This is an automated email from the git hooks/post-receive script.
frx-guest pushed a commit to branch master
in repository apt-listbugs.
commit bc5059d0d1eabaa92c8e63eba2ae0fd89b3dce91
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date: Sun Mar 23 21:30:51 2014 +0100
make ParseStep configurable (Closes: #562499)
---
apt-listbugs | 8 ++++++++
debian/TODO | 1 -
debian/changelog | 2 ++
lib/apt-listbugs/logic.rb | 10 ++++++++--
lib/debian/bts.rb | 10 ++++------
5 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/apt-listbugs b/apt-listbugs
index faf5eaf..60513f8 100755
--- a/apt-listbugs
+++ b/apt-listbugs
@@ -228,6 +228,14 @@ notable configuration options are
nothing. A possible suggested value is "FTBFS", since those bugs tend
to not affect the user.
+: AptListbugs::ParseStep
+
+ Maximum number of bug reports to be queried (on the Debian Bug Tracking
+ System) and parsed in a single batch. Default value is 200. The query
+ and parse operation is performed in batches of at most ParseStep bugs,
+ for performance reasons; setting a lower value may slow down apt-listbugs,
+ but may increase reliability on poor network links.
+
== OUTPUT EXAMPLE
[bug severity] bugs of [package] ([current version] -> [package version to be installed]) <[state of bug report]>
diff --git a/debian/TODO b/debian/TODO
index e75e22c..57e4e55 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -3,7 +3,6 @@ Release goals for version 0.2.0
* replace the old tests in tests/* with appropriate tests, maybe implemented by using autopkgtest (see http://dep.debian.net/deps/dep8/)
* close #536613 - apt-listbugs: lists no bugs and returns 0 for non existing packages [waiting on debbugs, #553661]
* close #493632 - apt-listbugs: should try and be more informative on "invalid date" SOAP parsing error [Merged with: 499657] [Note: is there any relation with bug #524768 ?]
-* close #562499 - apt-listbugs: make ParseStep configurable
Release goals for version 0.3.0
-------------------------------
diff --git a/debian/changelog b/debian/changelog
index af85954..322f621 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,8 @@ apt-listbugs (0.1.13) UNRELEASED; urgency=medium
supplied)": implemented the --force-pin option, thanks to Famelis George
for the initial patch, updated by Serafeim Zanikolas (thanks!) and
further modified by me (Closes: #441689)
+ * fixed "make ParseStep configurable": created an APT configuration
+ option (Closes: #562499)
-- Francesco Poli (wintermute) <invernomuto at paranoici.org> Sat, 01 Feb 2014 15:43:19 +0100
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index 49f7d0c..57e31db 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -86,6 +86,7 @@ class AppConfig
@show_downgrade = false
@hostname = "bugs.debian.org"
@port = 80
+ @parsestep = 200
@quiet = false
@command = nil
@parser = nil
@@ -112,7 +113,7 @@ class AppConfig
end
attr_accessor :severity, :stats, :quiet, :title
- attr_accessor :show_downgrade, :hostname, :tag, :fbugs
+ attr_accessor :show_downgrade, :hostname, :tag, :fbugs, :parsestep
attr_accessor :frontend, :pin_priority, :yes, :ignore_regexp, :force_pin
attr_reader :command, :parser, :querybts, :ignore_bugs, :system_ignore_bugs, :browser, :arrow, :xarrow
@@ -126,6 +127,10 @@ class AppConfig
end
end
+ if /qb='(.*)'/ =~ `apt-config #{@apt_conf} shell qb AptListbugs::ParseStep`
+ @parsestep = $1.to_i if $1.to_i > 0
+ end
+
# this hack is not nice: it should be dropped, once
# Debian support for Ruby 1.8 is long gone
getoptlong_ambiguousoption = if RUBY_VERSION >= "1.9"
@@ -823,8 +828,9 @@ module Factory
# TRANSLATORS: this sentence, followed by the translation of "Done" (see above) should fit in less than 79 columns to work well with default width terminals
yield _("Retrieving bug reports..."), "0%"
begin
+ config.frontend.puts " Using ParseStep = #{config.parsestep}" if $DEBUG
# obtain the array of bugs
- bugs = config.parser.parse(ma_copies, config.severity) { |pct|
+ bugs = config.parser.parse(ma_copies, config.parsestep, config.severity) { |pct|
yield _("Retrieving bug reports..."), pct
}
rescue SOAP::HTTPStreamError => exception
diff --git a/lib/debian/bts.rb b/lib/debian/bts.rb
index c6454aa..2273d8e 100644
--- a/lib/debian/bts.rb
+++ b/lib/debian/bts.rb
@@ -2,7 +2,7 @@
# bts.rb - ruby interface for debian bts
# Copyright (C) 2002 Masato Taruishi <taru at debian.org>
# Copyright (C) 2006-2007 Junichi Uekawa <dancer at debian.org>
-# Copyright (C) 2013 Francesco Poli <invernomuto at paranoici.org>
+# Copyright (C) 2013-2014 Francesco Poli <invernomuto at paranoici.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,9 +45,7 @@ module Debian
@buf = nil
end
- ParseStep = 200
-
- def parse(ma_copies, severities = ["critical", "grave"])
+ def parse(ma_copies, parsestep, severities = ["critical", "grave"])
require 'debian/btssoap'
soap = Debian::BTSSOAP::Soap.new(@host, @port)
sa = Debian::BTSSOAP::StringArray.new
@@ -66,10 +64,10 @@ module Debian
offset_i = 0
# process each bug number and get contents, in batches of
- # ParseStep bugs
+ # parsestep bugs
reqbugs.each { |bug|
sa << bug
- if sa.length > ParseStep
+ if sa.length > parsestep
soap.get_status(sa, ma_copies).each { |b| bugs << b }
offset_i += sa.length
sa = Debian::BTSSOAP::StringArray.new
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/apt-listbugs/apt-listbugs.git
More information about the Apt-listbugs-commits
mailing list