+def isSecurityUpgrade(ver):
+ " check if the given version is a security update (or masks one) "
+ for (file, index) in ver.FileList:
+ if (file.Archive.endswith("-security") and
+ file.Origin == "Ubuntu"):
+ return True
+ return False
+
+
# -------------------- main ---------------------
# be nice
@@ -91,15 +100,25 @@
security_updates = 0
for pkg in cache.Packages:
if depcache.MarkedInstall(pkg) or depcache.MarkedUpgrade(pkg):
+ inst_ver = pkg.CurrentVer
+ cand_ver = depcache.GetCandidateVer(pkg)
# check if this is really a upgrade or a false positive
# (workaround for ubuntu #7907)
- if depcache.GetCandidateVer(pkg) != pkg.CurrentVer:
- upgrades = upgrades + 1
- ver = depcache.GetCandidateVer(pkg)
- for (file, index) in ver.FileList:
- if (file.Archive.endswith("-security") and
- file.Origin == "Ubuntu"):
- security_updates += 1
+ if cand_ver != inst_ver:
+ # check for security upgrades
+ upgrades = upgrades + 1
+ if isSecurityUpgrade(cand_ver):
+ security_updates += 1
+ break
+ # now check for security updates that are masked by a
+ # canidate version from another repo (-proposed or -updates)
+ for ver in pkg.VersionList:
+ if (inst_ver and apt_pkg.VersionCompare(ver.VerStr, inst_ver.VerStr) <= 0):
+ #print "skipping '%s' " % ver.VerStr
+ continue
+ if isSecurityUpgrade(ver):
+ security_updates += 1
+ break
# print the number of upgrades
if options.show_package_names:
Here is the diff:
=== modified file 'data/apt-check'
--- data/apt-check 2008-01-04 15:30:39 +0000
+++ data/apt-check 2008-06-30 15:43:20 +0000
@@ -29,6 +29,15 @@
sys.exit(-1)
+def isSecurityUpgra de(ver) : endswith( "-security" ) and ------- ------ main ------- ------- -------
+ " check if the given version is a security update (or masks one) "
+ for (file, index) in ver.FileList:
+ if (file.Archive.
+ file.Origin == "Ubuntu"):
+ return True
+ return False
+
+
# -------
# be nice MarkedInstall( pkg) or depcache. MarkedUpgrade( pkg): GetCandidateVer (pkg) GetCandidateVer (pkg) != pkg.CurrentVer: GetCandidateVer (pkg) endswith( "-security" ) and de(cand_ ver): VersionCompare( ver.VerStr, inst_ver.VerStr) <= 0): de(ver) :
@@ -91,15 +100,25 @@
security_updates = 0
for pkg in cache.Packages:
if depcache.
+ inst_ver = pkg.CurrentVer
+ cand_ver = depcache.
# check if this is really a upgrade or a false positive
# (workaround for ubuntu #7907)
- if depcache.
- upgrades = upgrades + 1
- ver = depcache.
- for (file, index) in ver.FileList:
- if (file.Archive.
- file.Origin == "Ubuntu"):
- security_updates += 1
+ if cand_ver != inst_ver:
+ # check for security upgrades
+ upgrades = upgrades + 1
+ if isSecurityUpgra
+ security_updates += 1
+ break
+ # now check for security updates that are masked by a
+ # canidate version from another repo (-proposed or -updates)
+ for ver in pkg.VersionList:
+ if (inst_ver and apt_pkg.
+ #print "skipping '%s' " % ver.VerStr
+ continue
+ if isSecurityUpgra
+ security_updates += 1
+ break
# print the number of upgrades show_package_ names:
if options.