1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#
# bug.rb - ruby interface for debian bug
# Copyright (C) 2002 Masato Taruishi <taru@debian.org>
# Copyright (C) 2006-2007 Junichi Uekawa <dancer@debian.org>
# Copyright (C) 2013-2014 Francesco Poli <invernomuto@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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
module Debian
class Bug
def initialize (pkg_key, bug_number, severity,
stat, desc, tags = [], mergeids = [], time = Time.now )
@pkg_key = pkg_key
@bug_number = bug_number
@severity = severity
@stat = stat
@desc = desc
@tags = tags
@mergeids = mergeids
@log = nil
@time = time
@found = nil
@fixed = nil
@id = nil
end
def to_s
"#" + @bug_number + ":" + @pkg_key + ":" + @desc
end
def inspect
@bug_number + " - " +
@pkg_key + " - " +
@severity + " - " +
@stat + " - " +
@tags.to_s + " - " +
@desc + " merged with: " + @mergeids.join(', ') +
@found.to_s + " - " +
@fixed.to_s + " - " +
@time.to_s + " - b" +
@id.to_s
end
attr_accessor :pkg_key, :bug_number, :severity,
:stat, :desc, :tags, :mergeids, :log, :time, :found, :fixed, :id
end
class Bugs < Array
def each_by_category (pkg_key, sev, stat)
each { |bug|
yield bug if bug.pkg_key == pkg_key &&
bug.severity == sev &&
bug.stat == stat
}
end
def sub(type, val)
sub = Bugs.new
each { |bug|
sub << bug if bug.send(type) == val
}
sub
end
end
end
|