[Apt-listbugs-commits] [SCM] apt-listbugs development tree branch, master, updated. debian/0.1.4-6-g4c98389

Francesco Poli (wintermute) invernomuto at paranoici.org
Sat Jun 25 20:37:23 UTC 2011


The following commit has been merged in the master branch:
commit db94574484dc69a3bee7a55deee2e94764d5b64b
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date:   Sat Jun 18 22:22:24 2011 +0200

    reduce use of libdpkg-ruby to improve efficiency
    
    All information on package versions needed for the 'apt-listbugs apt'
    command is provided by apt through the Pre-Install-Pkgs hook info protocol
    version 2: as a consequence, there's no real need to read each .deb file
    and the status file in order to figure out the currently installed
    versions and the new (target) versions of packages.
    
    On the other hand, the 'apt-listbugs list' and 'apt-listbugs rss'
    commands should not take the installed versions into account: they
    should simply show bugs of given packages (possibly the bugs
    affecting the version specified by the user).

diff --git a/apt-listbugs b/apt-listbugs
index cfab068..399a7fb 100755
--- a/apt-listbugs
+++ b/apt-listbugs
@@ -4,7 +4,7 @@
 #
 # Copyright (C) 2002       Masato Taruishi <taru at debian.org>
 # Copyright (C) 2006-2008  Junichi Uekawa <dancer at debian.org>
-# Copyright (C) 2008-2010  Francesco Poli <invernomuto at paranoici.org>
+# Copyright (C) 2008-2011  Francesco Poli <invernomuto at paranoici.org>
 # Copyright (C) 2009       Ryan Niebur <ryan at debian.org>
 #
 #  This program is free software; you can redistribute it and/or modify
@@ -123,18 +123,20 @@ apt-listbugs [-h] [-v] [-s <severities>] [-T <tags>] [-S <stats>] [-B <bug#>] [-
 
 * apt
 
-  Reads filenames from standard input (typically provided by apt).
+  Reads package actions from standard input (typically provided by apt
+  or other compatible package manager: Pre-Install-Pkgs hook info
+  protocol version 2 is expected, see apt.conf(5) for more details).
 
 * list [<package1[/version]> <package2[/version]>...]
 
   Reads package names from the arguments and simply lists bugs of
-  these packages. Package versions may be specified with a slash, for
-  example, like apt/1.0
+  these packages. Package versions may be specified with a slash, as in
+  apt/1.0 for example.
 
-* rss [<package1> <package2>...]
+* rss [<package1[/version]> <package2[/version]>...]
 
   Reads package names from the arguments and lists bugs of these packages
-  in rss format.
+  in rss format. Again, package versions may be specified with a slash.
 
 == ENVIRONMENT VARIABLES
 
@@ -183,11 +185,9 @@ notable configuration options are
   e.g.
 
 
-  Reading package fields... Done
-  Reading package status... Done
   Retrieving bug reports... Done
   Parsing Found/Fixed information... Done
-  important bugs of apt-listbugs (0.0.57 -> ) <unfixed>
+  important bugs of apt-listbugs (0.0.47 -> 0.0.49) <unfixed>
    #332442 - apt-listbugs: Apt-listbugs doesn't actually download any bug reports
    #389903 - apt-listbugs: Does not offer to exit if timeout occurs fetching reports
   Summary:
@@ -280,11 +280,14 @@ config.parse_options
 Factory.config = config
 
 # handle arguments
-pkgnames = []
+new_pkgs = {}
+cur_pkgs = {}
 holdpkgs = {}
 case config.command
 when "apt"
   # parse apt VERSION 2 input.
+  puts if $DEBUG
+  puts "Pre-Install-Pkgs hook info:" if $DEBUG
   state=1
   STDIN.each { |pkg|
     pkg=pkg.rstrip
@@ -292,6 +295,7 @@ when "apt"
     when 1
       # the version header, only one line.
       if pkg == "VERSION 2"
+        puts "#{pkg}" if $DEBUG
         state=2
       else
         $stderr.print _("E: apt Pre-Install-Pkgs is not giving me expected 'VERSION 2' string.\n")
@@ -301,15 +305,18 @@ when "apt"
       # apt configuration lines
       case pkg
       when ""
+        puts "#{pkg}" if $DEBUG
         state=3
       when /^quiet=(.*)/
         if $1.to_i > 0 
+          puts "#{pkg}" if $DEBUG
           config.quiet=true
         end
       end
     when 3
-      # package filenames
-      filename=pkg.split(" ")[4]
+      # package action lines
+      puts "#{pkg}" if $DEBUG
+      pkgname, old_ver, direction, new_ver, filename = pkg.split(" ")
       case filename
       when "**CONFIGURE**"
         # none
@@ -319,45 +326,57 @@ when "apt"
         $stderr.print _("E: apt Pre-Install-Pkgs is giving me fewer fields than expected.\n")
         exit 1
       else
-        pkgnames << filename
+        case direction
+        when "="
+          # no version change, hence no new bug can be introduced
+          # into the system by this package
+        when ">", "<"
+          # ">" means downgrade, "<" means upgrade
+          if ( config.show_downgrade or direction == "<" ) 
+            if ( pkgname != nil and new_ver != "-" ) 
+              f = {}
+              f["package"] = pkgname
+              f["version"] = new_ver
+              new_pkgs[f["package"]] = f
+              if ( old_ver != "-" )
+                f = {}
+                f["package"] = pkgname
+                f["version"] = old_ver
+                cur_pkgs[f["package"]] = f
+              end
+            end
+          end
+        else
+          $stderr.print _("E: apt Pre-Install-Pkgs is giving me an unknown direction of version change.\n")
+          exit 1
+        end
       end
     end
   }
-when "list"
-  ARGV.each { |pkg|
-    # pkg may be frozen string
-    pkgnames << "#{pkg}"
-  }
-when "rss"
+  puts if $DEBUG
+when "list", "rss"
   ARGV.each { |pkg|
-    pkgnames << "#{pkg}"
+    # parse 'apt-listbugs list pkgname/version .... ' combination
+    if ( pkg != nil )
+      f = {}
+      case pkg
+      when /^(.*)\/(.*)$/
+        f["package"] = $1
+        f["version"] = $2
+      else
+        f["package"] = pkg
+      end
+      new_pkgs[f["package"]] = f
+    end
   }
 end
 
-exit 0 if pkgnames.size == 0
-
-# creating new packages database
-begin
-  new_pkgs = Factory::PackageFactory.create(pkgnames) { |msg, val|
-    config.frontend.progress(msg, val) if config.quiet == false
-  }
-rescue
-  config.frontend.puts " ... E: #{$!}"
-  exit 1
-end
+exit 0 if new_pkgs.size == 0
 
 Factory::PackageFactory.delete_ignore_pkgs(new_pkgs) if config.command == "apt"
 # exitting if no new packages is found
 exit 0 if new_pkgs.size == 0
 
-# creating current packages database
-cur_pkgs = Factory::StatusFactory.create(new_pkgs) { |msg, val|
-  config.frontend.progress(msg, val) if config.quiet == false
-}
-if ( config.show_downgrade == false ) and ( config.command == "apt" )
-  Factory::StatusFactory.delete_downgraded(cur_pkgs, new_pkgs)
-end
-
 # reading bug reports
 begin
   bugs = Factory::BugsFactory.create(new_pkgs, cur_pkgs) { |msg, val|
diff --git a/debian/README.Debian b/debian/README.Debian
index ca870a3..3dd9397 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -130,19 +130,15 @@ Filing Bugs on apt-listbugs
 Debugging apt-listbugs
 ----------------------
 
-When there is an error, to obtain reproducible debugging information,
-please run the following command-line to invoke apt-listbugs with the
-debugging output, and attach the output along with your bug report.
+When there is an error, to obtain useful debugging information,
+please run apt-listbugs with the debug option '-d'.
 
-(echo 'VERSION 2'; echo '' ;
-    ls -1 /var/cache/apt/archives/PACKAGE_*.deb |
-    sed 's/^/x x x x /') |
-    /usr/sbin/apt-listbugs apt -d
+If the error was encountered when using 'apt-listbugs list' or
+'apt-listbugs rss', just re-run the command-line with the '-d' option
+added, and attach the output along with your bug report.
 
-where PACKAGE should be substituted with the package name.
-
-Of course, if you are feeling more like contributing to apt-listbugs,
-you could enable debug output by default by editing
+If the error was encountered when using 'apt-listbugs apt' (within
+an apt session), you may enable debug output by editing
 /etc/apt/apt.conf.d/10apt-listbugs to add the debug option '-d':
 the following line
 
@@ -152,6 +148,9 @@ should become
 
     DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt -d || exit 10";};
 
+Then please restart the apt session, and attach the output along with
+your bug report.
+
 
 Hacking apt-listbugs
 ====================
diff --git a/debian/changelog b/debian/changelog
index 4145cd6..a59cfd4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,8 +5,9 @@ apt-listbugs (0.1.5) unstable; urgency=low
   * fixed "E: private method `chomp!' called for nil:NilClass": applied the
     little patch by Jonathan Nieder (thanks a lot!) to enhance input
     validation for the "apt-listbugs apt" command (Closes: #626937)
+  * reduced the use of libdpkg-ruby1.8 to improve efficiency
 
- -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sun, 22 May 2011 19:14:55 +0200
+ -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sat, 18 Jun 2011 17:39:44 +0200
 
 apt-listbugs (0.1.4) unstable; urgency=low
 
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index 8288178..c86b43a 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -2,7 +2,7 @@
 #
 # Copyright (C) 2002  Masato Taruishi <taru at debian.org>
 # Copyright (C) 2006-2008  Junichi Uekawa <dancer at debian.org>
-# Copyright (C) 2008-2010  Francesco Poli <invernomuto at paranoici.org>
+# Copyright (C) 2008-2011  Francesco Poli <invernomuto at paranoici.org>
 # Copyright (C) 2009-2010  Ryan Niebur <ryan at debian.org>
 #
 #  This program is free software; you can redistribute it and/or modify
@@ -174,7 +174,7 @@ class AppConfig
       @yes = false if @yes.nil?
     end
 
-    @title = "Debian Bugs of #{Socket.gethostname} (#{@severity.join(', ')})" if ! @title
+    @title = "Debian Bugs (#{@severity.join(', ')})" if ! @title
 
     # http_proxy sanity check
     if ENV["HTTP_PROXY"] != nil && ENV["http_proxy"] == nil

-- 
apt-listbugs development tree



More information about the Apt-listbugs-commits mailing list