summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-05-12 15:01:33 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-05-12 15:01:33 +0200
commit9c767ba4bb7d2632a34e7ecbcae314ff5691f7d3 (patch)
tree3e91bd3b0fa47d546efc64fdc61f1a38eb52aa18 /utils
parenta425052eee4531248e8b63fec3a1a52197dce6d5 (diff)
downloadpython-apt-9c767ba4bb7d2632a34e7ecbcae314ff5691f7d3.tar.gz
* utils/demotions.py: added tool to calculate demotions from main
to universe
Diffstat (limited to 'utils')
-rwxr-xr-xutils/demotions.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/utils/demotions.py b/utils/demotions.py
new file mode 100755
index 00000000..a41d439c
--- /dev/null
+++ b/utils/demotions.py
@@ -0,0 +1,85 @@
+#! /usr/bin/env python
+#
+# FIXME: strip "TryExec" from the extracted menu files (and noDisplay)
+#
+# TODO:
+# - emacs21 ships it's icon in emacs-data, deal with this
+# - some stuff needs to be blacklisted (e.g. gnome-about)
+# - lots of packages have there desktop file in "-data", "-comon" (e.g. anjuta)
+# - lots of packages have multiple desktop files for the same application
+# abiword, abiword-gnome, abiword-gtk
+
+import os
+import tarfile
+import sys
+import apt
+import apt_pkg
+import apt_inst
+#import xdg.Menu
+import os.path
+import re
+import tempfile
+import subprocess
+import string
+import shutil
+import urllib
+import logging
+
+
+# pkgs in main for the given dist
+class Dist(object):
+ def __init__(self,name):
+ self.name = name
+ self.pkgs_in_comp = {}
+
+if __name__ == "__main__":
+
+ # init
+ apt_pkg.Config.Set("Dir::state","./apt/")
+ apt_pkg.Config.Set("Dir::Etc","./apt")
+ try:
+ os.makedirs("apt/lists/partial")
+ except OSError:
+ pass
+
+ breezy = Dist("breezy")
+ dapper = Dist("dapper")
+
+ # go over the dists to find main pkgs
+ for dist in [breezy, dapper]:
+
+ for comp in ["main", "restricted", "universe", "multiverse"]:
+ line = "deb http://archive.ubuntu.com/ubuntu %s %s\n" % (dist.name,comp)
+ file("apt/sources.list","w").write(line)
+ dist.pkgs_in_comp[comp] = set()
+
+ # and the archs
+ for arch in ["i386","amd64", "powerpc"]:
+ apt_pkg.Config.Set("APT::Architecture",arch)
+ cache = apt.Cache(apt.progress.OpTextProgress())
+ prog = apt.progress.TextFetchProgress()
+ cache.update(prog)
+ cache.open(apt.progress.OpTextProgress())
+ map(lambda pkg: dist.pkgs_in_comp[comp].add(pkg.name), cache)
+
+ # check what is no longer in main
+ no_longer_main = breezy.pkgs_in_comp["main"] - dapper.pkgs_in_comp["main"]
+ no_longer_main |= breezy.pkgs_in_comp["restricted"] - dapper.pkgs_in_comp["restricted"]
+
+ # check what moved to universe and what was removed (or renamed)
+ in_universe = lambda pkg: pkg in dapper.pkgs_in_comp["universe"] or pkg in dapper.pkgs_in_comp["multiverse"]
+
+ # debug
+ #not_in_universe = lambda pkg: not in_universe(pkg)
+ #print filter(not_in_universe, no_longer_main)
+
+ # this stuff was demoted and is no in universe
+ demoted = filter(in_universe, no_longer_main)
+ demoted.sort()
+
+ outfile = "demoted.cfg"
+ print "writing the demotion info to '%s'" % outfile
+ # write it out
+ out = open(outfile,"w")
+ out.write("# demoted packages in dapper\n")
+ out.write("\n".join(demoted))