[Apt-listbugs-commits] [SCM] apt-listbugs development tree branch, master, updated. 0.0.95-14-gb48edc5
Ryan Niebur
ryanryan52 at gmail.com
Fri May 15 07:30:27 UTC 2009
The following commit has been merged in the master branch:
commit b342f5382af60dc3d3599b878f56394280ff19b4
Author: Francesco Poli (t1000) <frx at firenze.linux.it>
Date: Mon May 4 22:55:20 2009 +0200
rewrite aptcleanup (Closes: #473175)
fix automatic unpinning of packages: rewrite aptcleanup so that it
checks whether the bugs that caused the pinning still affect the
package candidate versions
diff --git a/aptcleanup b/aptcleanup
index 3cac25c..9ef9fae 100755
--- a/aptcleanup
+++ b/aptcleanup
@@ -1,29 +1,84 @@
-#!/usr/bin/ruby -I/usr/share/apt-listbugs
+#!/usr/bin/ruby -Ilib/
+#
+# aptcleanup: filters /etc/apt/preferences to unpin packages when bugs are fixed
+#
+# Copyright (C) 2004 Masato Taruishi <taru at debian.org>
+# Copyright (C) 2007 Jean Lepropre <jlepropre at gmail.com>
+# Copyright (C) 2008-2009 Francesco Poli <frx at firenze.linux.it>
+#
+# 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'
+require 'tempfile'
+APTCACHE = "/usr/bin/apt-cache"
+AWK = "/usr/bin/awk"
+LISTBUGS = "/usr/sbin/apt-listbugs"
+
+# read apt preferences
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(',')
+
+# store apt preferences with no apt-listbugs pins in a temporary file
+unpinned_pref_file = Tempfile.new('apt_preferences_')
+p.filter( bugpkgs, unpinned_pref_file )
+unpinned_pref_file.flush
+unpinned_preferences = unpinned_pref_file.path
+
+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=#{unpinned_preferences} 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
+ pack_with_vers = pinned_package + unpinned_candidate_version
+
+ # read which bugs caused the pinning ("bugs that the user fears")
+ feared_bugs = pin["Explanation"].scan /#(\d+):/
+ feared_list = feared_bugs.join(',')
+
+ # are bugs that the user fears still affecting unpinned_candidate_version ?
+ $stderr.puts "Checking bug(s) #{feared_list} for #{pack_with_vers}" if $DEBUG
+ open("|#{LISTBUGS} -y -q -B #{feared_list} list #{pack_with_vers}") { |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 "Bugs: #{bugpkgs.sort.join(' ')}" if $DEBUG
+
+$stderr.puts "Pinned packages: #{pinnedpkgs.sort.join(' ')}" if $DEBUG
+$stderr.puts "Buggy packages : #{bugpkgs.sort.join(' ')}" if $DEBUG
+
if (pinnedpkgs - bugpkgs).size > 0
- $stderr.puts "#{(pinnedpkgs - bugpkgs).join(', ')} has been fixed"
+ $stderr.puts "Fixed packages : #{(pinnedpkgs - bugpkgs).sort.join(' ')}"
end
+
+# write out filtered preferences file
p.filter( bugpkgs )
diff --git a/debian/README.Debian b/debian/README.Debian
index c80ee2c..e42f157 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -55,8 +55,8 @@ packages for pinning, to avoid automatically upgrading them. However,
pinning is not effective immediately, and requires restarting your apt
session.
-The pinning will be removed when the package no longer has any
-critical bugs, by cron.daily.
+The pinning will be removed by a cron.daily job, when the bugs no longer
+affect the package candidate version.
If you install www-browser, you can view bug lists in html.
sensible-browser in debianutils (>= 2.0) also available.
@@ -152,3 +152,4 @@ available from debbbugs source.
http://bugs.debian.org/debbugs-source/mainline/Debbugs/Bugs.pm
-- Junichi Uekawa <dancer at debian.org>, Wed, 1 Oct 2008 20:50:27 -0700
+ -- Francesco Poli (t1000) <frx at firenze.linux.it> Mon, 27 Apr 2009 23:07:41 +0200
diff --git a/debian/changelog b/debian/changelog
index e7a8114..009e7a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,7 +16,12 @@ apt-listbugs (0.0.96) UNRELEASED; urgency=low
* update Copyright statements
* don't ignore errors from 'make clean'
- -- Ryan Niebur <ryanryan52 at gmail.com> Tue, 21 Apr 2009 21:53:17 -0700
+ [ Francesco Poli (t1000) ]
+ * Fix "pinned packages are not automatically unpinned": rewrite aptcleanup
+ so that it checks whether the bugs that caused the pinning still affect
+ the package candidate versions (Closes: #473175)
+
+ -- Francesco Poli (t1000) <frx at firenze.linux.it> Mon, 27 Apr 2009 23:07:41 +0200
apt-listbugs (0.0.95) unstable; urgency=low
diff --git a/debian/copyright b/debian/copyright
index 687630f..31469f6 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -4,8 +4,9 @@ The original source can always be found at:
http://ftp.debian.org/debian/pool/main/a/apt-listbugs/
http://git.debian.org/?p=apt-listbugs/apt-listbugs.git
-Copyright (C) 2002 Masato Taruishi <taru at debian.org>
+Copyright (C) 2002-2004 Masato Taruishi <taru at debian.org>
Copyright (C) 2006-2008 Junichi Uekawa <dancer at debian.org>
+Copyright (C) 2007 Jean Lepropre <jlepropre at gmail.com>
Copyright (C) 2008-2009 Francesco Poli <frx at firenze.linux.it>
Copyright (C) 2009 Ryan Niebur <ryanryan52 at gmail.com>
diff --git a/debian/rules b/debian/rules
index b6eebff..0f11370 100755
--- a/debian/rules
+++ b/debian/rules
@@ -45,7 +45,10 @@ common-install-indep:: common-build-indep
chmod 755 $(DEB_DESTDIR)/usr/sbin/apt-listbugs
install -m 644 10apt-listbugs $(DEB_DESTDIR)/etc/apt/apt.conf.d/
install -m 644 ignore_bugs $(DEB_DESTDIR)/usr/share/apt-listbugs/
- install -m 755 aptcleanup $(DEB_DESTDIR)/usr/share/apt-listbugs/
+ sed -e 's,#!/usr/bin/ruby -Ilib/,#!/usr/bin/ruby -I/usr/share/apt-listbugs,' \
+ < aptcleanup \
+ > $(DEB_DESTDIR)/usr/share/apt-listbugs/aptcleanup
+ chmod 755 $(DEB_DESTDIR)/usr/share/apt-listbugs/aptcleanup
install -m 644 lib/debian/*.rb $(DEB_DESTDIR)/usr/share/apt-listbugs/debian/
install -m 644 lib/apt-listbugs/*.rb $(DEB_DESTDIR)/usr/share/apt-listbugs/apt-listbugs/
for mo in $(MOFILES); do \
diff --git a/lib/debian/apt_preferences.rb b/lib/debian/apt_preferences.rb
index 0eb7877..5176306 100644
--- a/lib/debian/apt_preferences.rb
+++ b/lib/debian/apt_preferences.rb
@@ -1,6 +1,7 @@
#
# apt_preferences.rb - ruby interface for apt preferences
# Copyright (c) 2004 Masato Taruishi <taru at debian.org>
+# Copyright (c) 2009 Francesco Poli <frx at firenze.linux.it>
#
# 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
@@ -73,12 +74,12 @@ module Debian
attr_reader :pins
- def filter( pkgs = [] )
+ def filter( pkgs = [], out = $stdout )
_each_pin do |pin|
p = Pin.new(pin)
if ! p.listbugs? || pkgs.include?( p["Package"] )
- puts pin
- puts ""
+ out.puts pin
+ out.puts ""
end
end
end
--
apt-listbugs development tree
More information about the Apt-listbugs-commits
mailing list