Mark Wielaard wrote: > On Mon, 2005-06-27 at 09:55 +0100, Gary Benson wrote: > > Nicolas Mailhot wrote: > > > Le lundi 27 juin 2005 à 09:36 +0100, Gary Benson a écrit : > > > > The graphs get very messy. I've done them separately for ant, > > > > tomcat and jonas, but never all together. > > > > > > Would be great to post them on jpackage-discuss - people often > > > do not realise what a new release means (and a new release means > > > getting at least ant and tomcat right) > > > > Ok, I'll post them next time I make a set... > > Could you post instructions on how to make such a set? It doesn't > have to be some fancy graph. Just a list of all > dependencies/packages would be nice. I assume yum/rpm actually has > them. I hope there is some easy way to get a list starting from the > jonas or eclipse-platform package. I've generally written scripts to query the rpm database and/or a directory full of rpms and emit graphviz files for printing. Generally the scripts will start with a package at the top of the tree (tomcat5-admin-webapps, for example, or lately jonas-examples) and work their way down through whatever set of dependencies I was interested in and ignoring whatever set of things I didn't want to see. I attached an example, so you can see what I mean. If I recall, it draws a graph of the runtime dependencies of the packages I maintain in FC4, with subpackages treated as separate entities. Hope that helps, Gary
import rpm import os class Package: def __init__(self, name): self.name = name class PackageSet: def __init__(self, path): self.pkgs, self.requires, self.provides = {}, {}, {} os.path.walk(path, PackageSet.__find_rpms, self) for pkg in self.pkgs.values(): requires = {} for require in self.requires[pkg.name]: if self.provides.has_key(require): if self.provides[require] == pkg.name: continue if self.provides[require] == "jpackage-utils": continue if self.provides[require] == "java-1.4.2-gcj-compat" and \ pkg.name not in ("java-1.4.2-gcj-compat-devel", "eclipse-ecj"): continue requires[self.provides[require]] = 1 else: assert is_ignorable(require) requires = requires.keys() requires.sort() pkg.requires = requires def __find_rpms(self, dir, items): for item in items: if item.endswith(".rpm") and not item.endswith(".src.rpm"): self.__add_rpm(os.path.join(dir, item)) def __add_rpm(self, path): fd = os.open(path, os.O_RDONLY) try: hdr = rpm.TransactionSet().hdrFromFdno(fd) finally: os.close(fd) assert type(hdr) == rpm.hdr name = hdr["name"] assert not self.pkgs.has_key(name) self.pkgs[name] = Package(name) assert not self.requires.has_key(name) self.requires[name] = hdr["requirename"] if name in ("tomcat5", "tomcat5-jasper"): self.requires[name].remove("jakarta-commons-daemon") if name == "tomcat5": self.requires[name].append("puretls") for provide in hdr["providename"]: if (name, provide) == ("xerces-j2", "jaxp_parser_impl"): continue assert not self.provides.has_key(provide) self.provides[provide] = name def graph(self, start): nodes, edges = {}, [] for node in start: nodes[node] = False while True: todo = [k for k, v in nodes.items() if not v] if not todo: break for name in todo: pkg = self.pkgs[name] for require in pkg.requires: edges.append((name, require)) if not nodes.has_key(require): nodes[require] = False nodes[name] = True return edges def is_ignorable(dep): if dep.startswith("/"): return True if dep.startswith("rpmlib("): return True if dep.startswith("lib") and dep.find(".so") != -1: return True if dep in ("gcc-java", "gjdoc", "httpd-mmn", "libgcj", "libgcj-src"): return True return False if __name__ == "__main__": import glob, sys [path] = glob.glob(os.path.join(os.path.split( os.path.abspath( sys.argv[0]))[0], "pkgs-*")) pkgs = PackageSet(path) print "// Runtime dependencies for FC4 Java stack" print "// dot -Tps graph.dot -o graph.ps" print print "digraph G {" print ' page="8.27, 11.69";' print ' ratio="fill";' for requirer, provider in pkgs.graph( ("tomcat5", "tomcat5-webapps", "tomcat5-admin-webapps", "avalon-logkit")): print ' "%s" -> "%s";' % (requirer, provider) print "}"
// Runtime dependencies for FC4 Java stack // dot -Tps graph.dot -o graph.ps digraph G { page="8.27, 11.69"; ratio="fill"; "avalon-logkit" -> "avalon-framework"; "avalon-logkit" -> "tomcat5-servlet-2.4-api"; "tomcat5" -> "ant"; "tomcat5" -> "classpathx-jaf"; "tomcat5" -> "classpathx-mail"; "tomcat5" -> "jakarta-commons-beanutils"; "tomcat5" -> "jakarta-commons-collections"; "tomcat5" -> "jakarta-commons-dbcp"; "tomcat5" -> "jakarta-commons-digester"; "tomcat5" -> "jakarta-commons-el"; "tomcat5" -> "jakarta-commons-fileupload"; "tomcat5" -> "jakarta-commons-launcher"; "tomcat5" -> "jakarta-commons-logging"; "tomcat5" -> "jakarta-commons-modeler"; "tomcat5" -> "jakarta-commons-pool"; "tomcat5" -> "java-1.4.2-gcj-compat-devel"; "tomcat5" -> "ldapjdk"; "tomcat5" -> "mx4j"; "tomcat5" -> "puretls"; "tomcat5" -> "regexp"; "tomcat5" -> "tomcat5-jasper"; "tomcat5" -> "tomcat5-servlet-2.4-api"; "tomcat5" -> "xerces-j2"; "tomcat5" -> "xml-commons-apis"; "tomcat5-admin-webapps" -> "struts11"; "tomcat5-admin-webapps" -> "tomcat5"; "tomcat5-webapps" -> "jakarta-taglibs-standard"; "tomcat5-webapps" -> "tomcat5"; "jakarta-commons-beanutils" -> "jakarta-commons-collections"; "jakarta-commons-beanutils" -> "jakarta-commons-logging"; "jakarta-commons-pool" -> "jakarta-commons-collections"; "ant" -> "java-1.4.2-gcj-compat-devel"; "tomcat5-jasper" -> "ant"; "tomcat5-jasper" -> "jakarta-commons-collections"; "tomcat5-jasper" -> "jakarta-commons-el"; "tomcat5-jasper" -> "jakarta-commons-logging"; "tomcat5-jasper" -> "tomcat5-servlet-2.4-api"; "tomcat5-jasper" -> "xerces-j2"; "tomcat5-jasper" -> "xml-commons-apis"; "ldapjdk" -> "gnu-crypto-sasl-jdk1.4"; "ldapjdk" -> "oro"; "xerces-j2" -> "xml-commons-apis"; "xerces-j2" -> "xml-commons-resolver"; "jakarta-taglibs-standard" -> "tomcat5-servlet-2.4-api"; "avalon-framework" -> "xalan-j2"; "avalon-framework" -> "xml-commons-apis"; "jakarta-commons-fileupload" -> "tomcat5-servlet-2.4-api"; "xml-commons-apis" -> "xml-commons"; "mx4j" -> "bcel"; "mx4j" -> "classpathx-jaf"; "mx4j" -> "classpathx-mail"; "mx4j" -> "gnu-crypto-jce-jdk1.4"; "mx4j" -> "jakarta-commons-logging"; "mx4j" -> "junit"; "mx4j" -> "log4j"; "mx4j" -> "xml-commons"; "mx4j" -> "xml-commons-apis"; "mx4j" -> "xml-commons-resolver"; "jakarta-commons-digester" -> "jakarta-commons-beanutils"; "jakarta-commons-digester" -> "jakarta-commons-collections"; "jakarta-commons-digester" -> "jakarta-commons-logging"; "jakarta-commons-dbcp" -> "jakarta-commons-collections"; "jakarta-commons-dbcp" -> "jakarta-commons-pool"; "struts11" -> "jakarta-commons-beanutils"; "struts11" -> "jakarta-commons-digester"; "struts11" -> "jakarta-commons-fileupload"; "struts11" -> "jakarta-commons-validator"; "struts11" -> "oro"; "struts11" -> "tomcat5-servlet-2.4-api"; "jakarta-commons-modeler" -> "jakarta-commons-beanutils"; "jakarta-commons-modeler" -> "jakarta-commons-collections"; "jakarta-commons-modeler" -> "jakarta-commons-digester"; "jakarta-commons-modeler" -> "jakarta-commons-logging"; "jakarta-commons-modeler" -> "mx4j"; "jakarta-commons-modeler" -> "xalan-j2"; "jakarta-commons-modeler" -> "xml-commons-apis"; "java-1.4.2-gcj-compat-devel" -> "eclipse-ecj"; "java-1.4.2-gcj-compat-devel" -> "java-1.4.2-gcj-compat"; "classpathx-mail" -> "classpathx-jaf"; "classpathx-mail" -> "gnu-crypto-jce-jdk1.4"; "classpathx-mail" -> "gnu-crypto-sasl-jdk1.4"; "puretls" -> "cryptix"; "puretls" -> "cryptix-asn1"; "java-1.4.2-gcj-compat" -> "gnu-crypto"; "java-1.4.2-gcj-compat" -> "gnu-crypto-jce-jdk1.4"; "java-1.4.2-gcj-compat" -> "gnu-crypto-sasl-jdk1.4"; "java-1.4.2-gcj-compat" -> "jessie"; "xml-commons-resolver" -> "xml-commons-apis"; "cryptix-asn1" -> "cryptix"; "bcel" -> "regexp"; "eclipse-ecj" -> "java-1.4.2-gcj-compat"; "log4j" -> "xml-commons-apis"; "jakarta-commons-validator" -> "jakarta-commons-beanutils"; "jakarta-commons-validator" -> "jakarta-commons-collections"; "jakarta-commons-validator" -> "jakarta-commons-digester"; "jakarta-commons-validator" -> "jakarta-commons-logging"; "jakarta-commons-validator" -> "oro"; "jakarta-commons-validator" -> "xml-commons-apis"; "jessie" -> "gnu-crypto"; "jessie" -> "gnu-crypto-jce-jdk1.4"; "jessie" -> "gnu-crypto-sasl-jdk1.4"; "gnu-crypto" -> "gnu-crypto-jce-jdk1.4"; "gnu-crypto" -> "gnu-crypto-sasl-jdk1.4"; }
Attachment:
graph-2.ps.gz
Description: GNU Zip compressed data