4
#nice apt-get -s -o Debug::NoLocking=true upgrade | grep ^Inst
9
from optparse import OptionParser
10
SYNAPTIC_PINFILE = "/var/lib/synaptic/preferences"
16
parser = OptionParser()
17
parser.add_option("-s",
21
help="show only security updates")
22
(options, args) = parser.parse_args()
23
print options.security_only
29
cache = apt_pkg.GetCache()
30
depcache = apt_pkg.GetDepCache(cache)
33
depcache.ReadPinFile()
34
# read the synaptic pins too
35
if os.path.exists(SYNAPTIC_PINFILE):
36
depcache.ReadPinFile(SYNAPTIC_PINFILE)
41
if depcache.BrokenCount > 0:
42
sys.stderr.write("E: BrokenCount > 0")
45
# do the upgrade (not dist-upgrade!)
48
# check for upgrade packages, we need to do it this way
49
# because of ubuntu #7907
52
for pkg in cache.Packages:
53
if depcache.MarkedInstall(pkg) or depcache.MarkedUpgrade(pkg):
54
# check if this is really a upgrade or a false positive
55
# (workaround for ubuntu #7907)
56
if depcache.GetCandidateVer(pkg) != pkg.CurrentVer:
57
upgrades = upgrades + 1
58
ver = depcache.GetCandidateVer(pkg)
59
for (file, index) in ver.FileList:
60
if file.Archive == "hoary-security":
63
# print the number of upgrades
64
if options.security_only:
65
sys.stderr.write("%s" % security_updates)
67
sys.stderr.write("%s" % upgrades)
4
nice apt-get -s -o Debug::NoLocking=true upgrade | grep ^Inst