[Apt-listbugs-commits] [apt-listbugs] 01/02: implement the --force-pin option (Closes: #441689)

Francesco Poli frx-guest at moszumanska.debian.org
Wed Mar 19 21:21:30 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 fe33c8d84d1614beebaa44fbfa2b0af96367ed90
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date:   Sun Mar 16 19:34:17 2014 +0100

    implement the --force-pin option (Closes: #441689)
---
 apt-listbugs              |  8 +++++++-
 debian/changelog          |  4 ++++
 debian/copyright          |  1 +
 lib/apt-listbugs/logic.rb | 23 ++++++++++++++++++-----
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/apt-listbugs b/apt-listbugs
index 4030e24..faf5eaf 100755
--- a/apt-listbugs
+++ b/apt-listbugs
@@ -4,6 +4,7 @@
 #
 # Copyright (C) 2002       Masato Taruishi <taru at debian.org>
 # Copyright (C) 2006-2008  Junichi Uekawa <dancer at debian.org>
+# Copyright (C) 2007       Famelis George <famelis at otenet.gr>
 # Copyright (C) 2008-2014  Francesco Poli <invernomuto at paranoici.org>
 # Copyright (C) 2009       Ryan Niebur <ryan at debian.org>
 # Copyright (C) 2012       Justin B Rye <jbr at edlug.org.uk>
@@ -45,7 +46,7 @@ installation/upgrade is safe.
 
 == USAGE
 
-apt-listbugs [-h] [-v] [-s <severities>] [-T <tags>] [-S <states>] [-B <bug#>] [-D] [-H <hostname>] [-p <port>] [-P <priority>] [-E <title>] [-q] [-C <apt.conf>] [-y] [-n] [-d] <command> [arguments]
+apt-listbugs [-h] [-v] [-s <severities>] [-T <tags>] [-S <states>] [-B <bug#>] [-D] [-H <hostname>] [-p <port>] [-P <priority>] [-E <title>] [-q] [-C <apt.conf>] [-F] [-y] [-n] [-d] <command> [arguments]
 
 == OPTIONS
 
@@ -129,6 +130,11 @@ apt-listbugs [-h] [-v] [-s <severities>] [-T <tags>] [-S <states>] [-B <bug#>] [
 
   Specifies the APT configuration file to use.
 
+* -F, --force-pin
+
+  When in apt mode, assumes that you want to automatically pin all buggy
+  packages without any prompt.
+
 * -y, --force-yes
 
   Assumes that you select yes for all questions.  When in apt mode,
diff --git a/debian/changelog b/debian/changelog
index 6e5dee7..af85954 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,10 @@ apt-listbugs (0.1.13) UNRELEASED; urgency=medium
     to adapt to Ruby 2.0 stricter behavior; thanks a lot to Christian
     Hofstaedtler for explaining what was wrong and for pointing me to the
     appropriate documentation! (Closes: #740564)
+  * fixed "New feature to automatically pin packages (implementation patch
+    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)
 
  -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sat, 01 Feb 2014 15:43:19 +0100
 
diff --git a/debian/copyright b/debian/copyright
index 869c845..32a655c 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -7,6 +7,7 @@ The original source can always be found at:
 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) 2007       Famelis George <famelis at otenet.gr>
 Copyright (C) 2008-2014  Francesco Poli <invernomuto at paranoici.org>
 Copyright (C) 2009-2010  Ryan Niebur <ryan at debian.org>
 Copyright (C) 2012       Justin B Rye <jbr at edlug.org.uk>
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index d73051c..49f7d0c 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -4,8 +4,10 @@
 #
 # Copyright (C) 2002       Masato Taruishi <taru at debian.org>
 # Copyright (C) 2006-2008  Junichi Uekawa <dancer at debian.org>
+# Copyright (C) 2007       Famelis George <famelis at otenet.gr>
 # Copyright (C) 2008-2014  Francesco Poli <invernomuto at paranoici.org>
 # Copyright (C) 2009-2010  Ryan Niebur <ryan at debian.org>
+# Copyright (C) 2013       Google Inc
 #
 #  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
@@ -58,6 +60,7 @@ class AppConfig
       _(" -E <title>       : Title of RSS output.\n"),
       _(" -q               : Don't display progress bar.\n"),
       _(" -C <apt.conf>    : apt.conf file to use.\n"),
+      _(" -F               : Automatically pin all buggy packages.\n"),
       _(" -y               : Assume that you select yes for all questions.\n"),
       _(" -n               : Assume that you select no for all questions.\n"),
       _(" -d               : Debug.\n"),
@@ -98,6 +101,7 @@ class AppConfig
     @apt_conf = nil
 
     @yes = nil
+    @force_pin = false
 
     @arrow = "->"
     @xarrow = "->"
@@ -109,7 +113,7 @@ class AppConfig
 
   attr_accessor :severity, :stats, :quiet, :title
   attr_accessor :show_downgrade, :hostname, :tag, :fbugs
-  attr_accessor :frontend, :pin_priority, :yes, :ignore_regexp
+  attr_accessor :frontend, :pin_priority, :yes, :ignore_regexp, :force_pin
   attr_reader :command, :parser, :querybts, :ignore_bugs, :system_ignore_bugs, :browser, :arrow, :xarrow
 
   def parse_options
@@ -144,6 +148,7 @@ class AppConfig
                            ['--title', '-E', GetoptLong::REQUIRED_ARGUMENT],
                            ['--quiet', '-q', GetoptLong::NO_ARGUMENT],
                            ['--aptconf', '-C', GetoptLong::REQUIRED_ARGUMENT],
+                           ['--force-pin', '-F', GetoptLong::NO_ARGUMENT],
                            ['--force-yes', '-y', GetoptLong::NO_ARGUMENT],
                            ['--force-no', '-n', GetoptLong::NO_ARGUMENT],
                            ['--debug', '-d', GetoptLong::NO_ARGUMENT]
@@ -191,6 +196,8 @@ class AppConfig
           @yes = true
         when '--force-no'
           @yes = false
+        when '--force-pin'
+          @force_pin = true
         end
       }
     rescue getoptlong_ambiguousoption, GetoptLong::NeedlessArgument,
@@ -381,11 +388,15 @@ class Viewer
         else
           ask_str << " [Y/n]"
         end
-        if @config.yes.nil?
-          a = @config.frontend.ask ask_str
+        if @config.force_pin
+          a = "p"
         else
-          a = "y" if @config.yes
-          a = "n" if ! @config.yes
+          if @config.yes.nil?
+            a = @config.frontend.ask ask_str
+          else
+            a = "y" if @config.yes
+            a = "n" if ! @config.yes
+          end
         end
         if a == ""
           if hold_pkg_keys.empty?
@@ -474,6 +485,7 @@ class Viewer
             }
           end
           if pkgs.size != 0
+            @config.yes = true if @config.force_pin
             if @config.frontend.yes_or_no? ngettext(
              # TRANSLATORS: %{plist} is a comma-separated list of %{npkgs} packages to be pinned or put on hold.
              "The following %{npkgs} package will be pinned or on hold:\n %{plist}\nAre you sure?",
@@ -490,6 +502,7 @@ class Viewer
           else
             @config.frontend.puts sprintf(_("All selected packages are already pinned or on hold. Ignoring %s command."), cmd)
           end
+          return false if @config.force_pin
 
         else
           if hold_pkg_keys.empty?

-- 
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