Package: update-notifier-common
Version: 0.99.3debian8
Severity: wishlist

Hi,

Please found attach a patch to add an option -s like -p but to show onlys 
packages from security

Regards,


-- System Information:
Debian Release: 6.0.6
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages update-notifier-common depends on:
ii  python                2.6.6-3+squeeze7   interactive high-level object-orie
ii  python-apt            0.7.100.1+squeeze1 Python interface to libapt-pkg

Versions of packages update-notifier-common recommends:
ii  libpam-modules        1.1.1-6.1+squeeze1 Pluggable Authentication Modules f

update-notifier-common suggests no packages.

-- no debconf information
=== modified file 'ChangeLog'
--- ChangeLog   2006-01-26 23:07:09 +0000
+++ ChangeLog   2012-10-31 12:39:08 +0000
@@ -1,3 +1,8 @@
+2012-10-31  Rodolphe Quiedeville  <rodol...@quiedeville.org>
+
+       * data/apt_check.py: add option -s, --packahe-security to print
+       only security package's name
+
 2006-01-11  Scott James Remnant  <sc...@netsplit.com>
 
        * src/reboot.c: New file containing code to deal with reboot

=== modified file 'data/apt_check.py'
--- data/apt_check.py   2011-05-26 16:02:42 +0000
+++ data/apt_check.py   2012-10-31 12:53:35 +0000
@@ -65,6 +65,34 @@
                   cache.packages)
     outstream.write("\n".join(map(lambda p: p.name, pkgs)))
 
+def write_package_security(outstream, cache, depcache):
+    " write out package names from security that change to outstream "
+    for pkg in cache.packages:
+        # skip packages that are not marked upgraded/installed
+        if not (depcache.marked_install(pkg) or depcache.marked_upgrade(pkg)):
+            continue
+        # check if this is really a upgrade or a false positive
+        # (workaround for ubuntu #7907)
+        inst_ver = pkg.current_ver
+        cand_ver = depcache.get_candidate_ver(pkg)
+        if cand_ver == inst_ver:
+            continue
+
+        # check for security upgrades
+        if isSecurityUpgrade(cand_ver):
+            outstream.write("%s\n" % pkg.name)
+            continue 
+
+        # now check for security updates that are masked by a 
+        # candidate version from another repo (-proposed or -updates)
+        for ver in pkg.version_list:
+            if (inst_ver and apt_pkg.version_compare(ver.ver_str, 
inst_ver.ver_str) <= 0):
+                #print "skipping '%s' " % ver.VerStr
+                continue
+            if isSecurityUpgrade(ver):
+                outstream.write("%s\n" % pkg.name)
+                break
+
 def write_human_readable_summary(outstream, upgrades, security_updates):
     " write out human summary summary to outstream "
     outstream.write(gettext.dngettext("update-notifier",
@@ -144,7 +172,7 @@
             continue
 
         # now check for security updates that are masked by a 
-        # canidate version from another repo (-proposed or -updates)
+        # candidate version from another repo (-proposed or -updates)
         for ver in pkg.version_list:
             if (inst_ver and apt_pkg.version_compare(ver.ver_str, 
inst_ver.ver_str) <= 0):
                 #print "skipping '%s' " % ver.VerStr
@@ -154,7 +182,9 @@
                 break
 
     # print the number of upgrades
-    if options and options.show_package_names:
+    if options and options.show_package_security:
+        write_package_security(sys.stderr, cache, depcache)
+    elif options and options.show_package_names:
         write_package_names(sys.stderr, cache, depcache)
     elif options and options.readable_output:
         write_human_readable_summary(sys.stdout, upgrades, security_updates)
@@ -185,6 +215,11 @@
                       action="store_true",
                       dest="show_package_names",
                       help=_("Show the packages that are going to be 
installed/upgraded"))
+    parser.add_option("-s",
+                      "--package-security",
+                      action="store_true",
+                      dest="show_package_security",
+                      help=_("Like -p but show only packages from security"))
     parser.add_option("",
                       "--human-readable",
                       action="store_true",

Reply via email to