Hi, I obviously do not have enough time to test this patch and maintain it. Are you interested in maintaining apt-listbugs (in co-maintenance mode probably?)
At Tue, 2 Sep 2008 00:18:25 +0200, Francesco Poli wrote: > > diff -ruN c/aptcleanup g/aptcleanup > --- c/aptcleanup 2008-05-13 00:00:19.000000000 +0200 > +++ g/aptcleanup 2008-09-01 23:41:15.000000000 +0200 > @@ -1,29 +1,74 @@ > #!/usr/bin/ruby -I/usr/share/apt-listbugs > +# > +# aptcleanup: filters /etc/apt/preferences to unpin packages when bugs are > fixed > +# > +# Copyright (C) 2004-2005 Masato Taruishi <[EMAIL PROTECTED]> > +# Copyright (C) 2006-2008 Junichi Uekawa <[EMAIL PROTECTED]> > +# Copyright (C) 2008 Francesco Poli <[EMAIL PROTECTED]> > +# > +# 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 with > +# the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; > +# if not, write to the Free Software Foundation, Inc., 51 Franklin St, > +# Fifth Floor, Boston, MA 02110-1301, USA. > +# > +# > > require 'debian/apt_preferences' > +APTCACHE = "/usr/bin/apt-cache" > +AWK = "/usr/bin/awk" > +LISTBUGS = "/usr/sbin/apt-listbugs" > > p = Debian::AptPreferences.new > -buf = "" > -p.pins.each do |pin| > - buf << " " + pin["Package"] if pin.listbugs? > -end > -pinnedpkgs = buf.split(' ') > -$stderr.puts "Pinned: #{pinnedpkgs.sort.join(' ')}" if $DEBUG > +pinnedpkgs = [] > bugpkgs = [] > -open("|/usr/sbin/apt-listbugs -y -q list #{buf}") { |io| > - array = io.readlines() > - if array.size != 0 > - buf = array[array.size-1].delete(' ').gsub(/\([^\)]+\)/,'').chomp > - bugpkgs = buf.split(',') > +p.pins.each do |pin| > + if pin.listbugs? > + pinned_package = pin["Package"] > + pinnedpkgs << pinned_package > + > + # which version would get installed, if the pinning were removed ? > + unpinned_candidate_version = `#{APTCACHE} -o > Dir::Etc::Preferences=/dev/null policy #{pinned_package} | #{AWK} > '/Candidate:/ { printf "/%s", $2; }'` > + unpinned_candidate_version.chomp! > + if unpinned_candidate_version == "/(none)" > + unpinned_candidate_version = "" > + $stderr.puts "Warning: no candidate version for #{pinned_package}" if > $DEBUG > + end > + buf = pinned_package + unpinned_candidate_version + ' ' > + > + # read which bugs caused the pinning ("bugs that the user fears") > + feared_bugs = pin["Explanation"].scan /#(\d+):/ > + buf << feared_bugs.join(' ') > + > + # are bugs that the user fears still affecting > unpinned_candidate_version ? > + $stderr.puts "Examining #{buf}" if $DEBUG > + open("|#{LISTBUGS} -y -q query #{buf}") { |io| > + array = io.readlines() > + bugpkgs << pinned_package if array.size != 0 > + } > + if $?.exitstatus != 0 > + $stderr.puts "Error... exiting!" if $DEBUG > + exit 1 > + end > end > -} > -if $?.exitstatus != 0 > - $stderr.puts "Error... exiting!" if $DEBUG > - exit 1 > end > + > +$stderr.puts "Pinned: #{pinnedpkgs.sort.join(' ')}" if $DEBUG > $stderr.puts "Bugs: #{bugpkgs.sort.join(' ')}" if $DEBUG > + > if (pinnedpkgs - bugpkgs).size > 0 > $stderr.puts "#{(pinnedpkgs - bugpkgs).join(', ')} has been fixed" > end > + > +# write out filtered preferences file > p.filter( bugpkgs ) > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]