Package: apt-listbugs Version: 0.0.82 Severity: wishlist Tags: patch The feature to automaticaly pin packages is required when one needs to do a safe batch upgrade.
I use this feature when I do an upgrade using cron-apt. In this case two successive 'apt-get upgrade' will upgrade all "safe" packages. The first will pin the erroneous packages and the second will do the upgrade. In an interactive environment this can be done with an option, for example --force-pin, but apt-get, as it is called by cron-apt, does not pass options to apt-listbugs, so I had to introduce an apt.conf option in order to be able to supply to apt-listbugs the required option. I would be thankfull if you incorporated the supplied patch to the next appropriate release. George Famelis -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.22-1-686 (SMP w/1 CPU core) Locale: LANG=el_GR.UTF-8, LC_CTYPE=el_GR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages apt-listbugs depends on: ii apt 0.7.6 Advanced front-end for dpkg ii libdpkg-ruby1.8 0.3.2 modules/classes for dpkg on ruby 1 ii libhttp-access2-ruby1.8 2.0.6-3 HTTP accessing library for ruby ii libintl-gettext-ruby1.8 0.11-10 Gettext wrapper for Ruby 1.8 ii libruby1.8 [libzlib-ruby1.8] 1.8.6.36-3 Libraries necessary to run Ruby 1. ii libxml-parser-ruby1.8 0.6.8-2 Interface of expat for the scripti ii ruby 1.8.2-1 An interpreter of object-oriented apt-listbugs recommends no packages. -- no debconf information
--- apt-listbugs-0.0.82/apt-listbugs 2007-09-10 22:21:13.000000000 +0300 +++ apt-listbugs-0.0.82/apt-listbugs.new 2007-09-10 22:31:24.000000000 +0300 @@ -38,10 +38,6 @@ be invoked before each upgrade by apt in order to check whether the upgrade/installation is safe. -== USAGE - -apt-listbugs [-h] [-s <severities>] [-S <stats>] [-D] [-H <hostname>] [-p <port>] [-R] <command> [arguments] - == OPTIONS * -h | --help @@ -94,6 +90,16 @@ Specifies the apt configuration file to use. +* -F <all|none> | --force-pin <all|none> + + When 'all' it is assumed that you select to pin all packages and exit when + any bug is found. When 'none' (actually any non-'all') it does not + automaticaly decide about pinning. + If not specified in the command line, apt.conf is consulted for the value + of LISTBUGS::Force-Pin. If not found then it defaults to 'none' + Command line 'none' is used when one needs to override an 'all' value + specified in apt.conf. + * -y | --force-yes Assumes that you select yes for all questions. @@ -148,7 +154,10 @@ HTTP Proxy setting, overrides the default HTTP Proxy setting. Useful for setting HTTP proxy for apt-listbugs. +* LISTBUGS::Force-Pin + When set to 'all' it means that you select to pin any package found with a bug and exit. + This 'all' value can be overriden by a "--force-pin none" command line option == OUTPUT EXAMPLE @@ -248,10 +257,12 @@ sprintf($intl._(" -H <hostname> : Hostname of Debian Bug Tracking System [%s].\n"), @hostname), sprintf($intl._(" -p <port> : Port number of the server [%s]\n"), @port), sprintf($intl._(" --pin-priority : Specifies Pin-Priority value [%s]\n"), @pin_priority), - $intl._(" --title : Specifies the title of rss output.\n"), + $intl._(" --title <title> : Specifies the title of rss output.\n"), $intl._(" -f : Retrieve bug reports from BTS forcibly.\n"), $intl._(" -q : Don't display progress bar.\n"), $intl._(" -C <apt.conf> : Specify apt.conf.\n"), + $intl._(" --force-pin all : Assume that you select to pin any package found with a bug and exit.\n"), + $intl._(" --force-pin none : Override 'all' config value for --force-pin.\n"), $intl._(" -y : Assume that you select yes for all questions.\n"), $intl._(" -n : Assume that you select no for all questions.\n"), $intl._(" -d : Debug.\n"), @@ -285,12 +296,13 @@ @apt_conf = nil @yes = nil + @force_pin = nil end attr_accessor :severity, :stats, :quiet, :title attr_accessor :show_downgrade, :hostname, :tag - attr_accessor :frontend, :pin_priority, :yes + attr_accessor :frontend, :pin_priority, :yes, :force_pin attr_reader :command, :parser, :querybts, :ignore_bugs, :system_ignore_bugs, :browser def parse_options @@ -307,6 +319,7 @@ ['--title', '-E', GetoptLong::REQUIRED_ARGUMENT], ['--quiet', '-q', GetoptLong::NO_ARGUMENT], ['--aptconf', '-C', GetoptLong::REQUIRED_ARGUMENT], + ['--force-pin', '-F', GetoptLong::REQUIRED_ARGUMENT], ['--force-yes', '-y', GetoptLong::NO_ARGUMENT], ['--force-no', '-n', GetoptLong::NO_ARGUMENT], ['--debug', '-d', GetoptLong::NO_ARGUMENT] @@ -352,6 +365,13 @@ @yes = true when '--force-no' @yes = false + when '--force-pin' + case optargs + when "all" + @force_pin = true + else + @force_pin = false + end end } rescue GetoptLong::AmbigousOption, GetoptLong::NeedlessArgument, @@ -360,6 +380,15 @@ exit 1 end + if @force_pin.nil? + if /force_pin='(.*)'/ =~ `apt-config [EMAIL PROTECTED] shell force_pin LISTBUGS::Force-Pin` + if $1 == 'all' + @force_pin = true + end + end + end + @force_pin = false if @force_pin.nil? + if ! $stdout.isatty @quiet = true @yes = false if @yes.nil? @@ -510,22 +539,27 @@ answer = "n" hold_pkgs = [] while true - ask_str = $intl._("Are you sure you want to install/upgrade the above packages?") - if @config.querybts != nil || @config.browser != nil - if hold_pkgs.empty? - ask_str << " [Y/n/?/...] " - else - ask_str << "[N/?/...] " - end - else - ask_str << " [Y/n] " - end - if @config.yes.nil? - a = @config.frontend.ask ask_str - else - a = "y" if @config.yes - a = "n" if ! @config.yes - end + if @config.force_pin + @config.frontend.puts $intl._("Pinning all ackages at your request ...") + a = "p" + elsif @config.yes.nil? + ask_str = $intl._("Are you sure you want to install/upgrade the above packages?") + if @config.querybts != nil || @config.browser != nil + if hold_pkgs.empty? + ask_str << " [Y/n/?/...] " + else + ask_str << "[N/?/...] " + end + else + ask_str << " [Y/n] " + end + a = @config.frontend.ask ask_str + elsif @config.yes + a = "y" + else + a = "n" + end + if a == "" if hold_pkgs.empty? answer = "y" @@ -605,7 +639,9 @@ } end if pkgs.size != 0 - if @config.frontend.yes_or_no? sprintf($intl._("The following %s packages will be pinned or on hold:\n %s\nAre you sure "), pkgs.size, pkgs.keys.join(', ')) + if @config.force_pin + h = pinned(pkgs.keys, cur_pkgs, bugs) + elsif @config.frontend.yes_or_no? sprintf($intl._("The following %s packages will be pinned or on hold:\n %s\nAre you sure "), pkgs.size, pkgs.keys.join(', ')) if key == "h" h = on_hold(pkgs.keys) else @@ -613,6 +649,9 @@ end end hold_pkgs.concat(h) if h != nil + if @config.force_pin + return false; + end else @config.frontend.puts sprintf($intl._("Every packages already pinned or on hold. Ignoring %s command."), key) end