[Apt-listbugs-commits] [apt-listbugs] 01/01: ask when pinning random packages (Closes: #791877)

Francesco Poli frx-guest at moszumanska.debian.org
Fri Jul 17 17:34:05 UTC 2015


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 7ebe013a27b76a051feeeb120512c2fb7871bc7f
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date:   Fri Jul 17 19:27:56 2015 +0200

    ask when pinning random packages (Closes: #791877)
---
 debian/changelog         |  4 ++++
 lib/aptlistbugs/logic.rb | 37 ++++++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a3c0568..67005a8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,10 @@ apt-listbugs (0.1.17) UNRELEASED; urgency=medium
     RSS output
   * fixed "please increase default Pin-Priority (to meet the needs of Cupt
     users)": set the default Pin-Priority to 30000 (Closes: #765762)
+  * fixed "accepts bug number as package in "p" command": when the user
+    tells apt-listbugs to pin a package, the user is asked for confirmation
+    whenever none of the bugs that affect the user's package upgrade are
+    assigned to the package under consideration (Closes: #791877)
 
  -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sun, 04 Jan 2015 11:42:30 +0100
 
diff --git a/lib/aptlistbugs/logic.rb b/lib/aptlistbugs/logic.rb
index ac01cc5..1e42891 100644
--- a/lib/aptlistbugs/logic.rb
+++ b/lib/aptlistbugs/logic.rb
@@ -603,21 +603,28 @@ class Viewer
 
     def pinned(pkg_keys, cur_pkgs, bugs)
       holdstr = ""
+      pinned_pkg_keys = []
       pkg_keys.each { |pkg_key|
-        pin_ver = "0.no.version"
-        pin_pri = @config.pin_priority
-        if cur_pkgs[pkg_key] != nil
-          pin_ver = cur_pkgs[pkg_key]['version']
-        else
-          pin_ver = "*"
-          pin_pri = "-30000"
+        my_bugs = bugs_of_pkg( bugs, pkg_key )
+        if my_bugs.size > 0 || @config.frontend.yes_or_no?(sprintf(
+         _("None of the above bugs is assigned to package %s\nAre you sure you want to pin it?"),
+         pkg_key))
+          pin_ver = "0.no.version"
+          pin_pri = @config.pin_priority
+          if cur_pkgs[pkg_key] != nil
+            pin_ver = cur_pkgs[pkg_key]['version']
+          else
+            pin_ver = "*"
+            pin_pri = "-30000"
+          end
+          pinned_pkg_keys << pkg_key
+          holdstr << "\nExplanation: Pinned by apt-listbugs at #{Time.now}"
+          my_bugs.each { |bug|
+            holdstr << "\nExplanation:   ##{bug.bug_number}: #{bug.desc}"
+          }
+          holdstr << "\nPackage: #{pkg_key}\nPin: version #{pin_ver}"
+          holdstr << "\nPin-Priority: #{pin_pri}\n"
         end
-        holdstr << "\nExplanation: Pinned by apt-listbugs at #{Time.now}"
-        bugs_of_pkg( bugs, pkg_key ).each { |bug|
-          holdstr << "\nExplanation:   ##{bug.bug_number}: #{bug.desc}"
-        }
-        holdstr << "\nPackage: #{pkg_key}\nPin: version #{pin_ver}"
-        holdstr << "\nPin-Priority: #{pin_pri}\n"
       }
       $stderr.puts holdstr if $DEBUG
       if holdstr != ""
@@ -627,9 +634,9 @@ class Viewer
             io.puts holdstr
             # TRANSLATORS: %{packgl} is a list of packages, %{filenm} is a file name.
             @config.frontend.puts _("%{packgl} pinned by adding Pin preferences in %{filenm}. Restart APT session to enable") %
-              {:packgl => pkg_keys.join(' '),
+              {:packgl => pinned_pkg_keys.join(' '),
                :filenm => filename}
-            return pkg_keys
+            return pinned_pkg_keys
           }
         rescue Errno::EACCES
           # write-access is not possible, warn the user that the

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