diff options
author | Henryk Ploetz <henryk@openmoko.org> | 2007-10-07 19:32:36 +0000 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2007-10-07 19:32:36 +0000 |
commit | 8afc20e8be1f622e700f9f6a5dc3717577bc90d2 (patch) | |
tree | 150c4a91a1485134d42f82272dd6f1f689554338 | |
parent | b8bee18acb3c73f21bf8dcf46a61979402ec35ad (diff) |
mono: clean up packaging
-rw-r--r-- | classes/mono.bbclass | 58 | ||||
-rw-r--r-- | contrib/mono/.mtn2git_empty | 0 | ||||
-rw-r--r-- | contrib/mono/collect-files.py | 118 | ||||
-rw-r--r-- | packages/mono/mono_1.2.5.1.bb | 123 |
4 files changed, 146 insertions, 153 deletions
diff --git a/classes/mono.bbclass b/classes/mono.bbclass index c50274ed0c..b7c5439b86 100644 --- a/classes/mono.bbclass +++ b/classes/mono.bbclass @@ -1,61 +1,3 @@ -def mono_get_file_table(packageversion, d): - # The packageversion is currently ignored, but might be used in the future - # if more than one mono version is available and different versions - # need to use different tables - - import bb, sys, os, glob, commands - curdir = os.path.dirname( bb.data.getVar('FILE', d, 1) ) - if curdir not in sys.path: sys.path.append( curdir ) - from mono_files import debian_mono_file_table - - # mono-jay is not being built (for all platforms at least) - IGNORE = ("mono-jay", ) - file_table = [ - # Standard package - {"name": "mono-doc"}, - - # Virtual packages - {"name": "mono"}, - {"name": "mono-runtime"}, - - # Not provided by Debian: - {"name": "libnunit2.2-cil", - "patterns": [ - "/usr/lib/mono/gac/nunit.*/2.2.*", - "/usr/lib/mono/1.0/nunit.*.dll", - "/usr/lib/pkgconfig/mono-nunit.pc", - ], - "assemblies": [ - ("nunit.core", "2.2.0.0"), - ("nunit.framework", "2.2.0.0"), - ("nunit.util", "2.2.0.0"), - ("nunit.mocks", "2.2.8.0"), - ], - }, - {"name": "libmono-cecil0.5-cil", - "patterns": [ - "/usr/lib/mono/gac/Mono.Cecil/0.5.*", - ], - "assemblies": [ - ("Mono.Cecil", "0.5.*"), - ], - }, - {"name": "libmono-db2-1.0-cil", - "patterns": [ - "/usr/lib/mono/gac/IBM.Data.DB2/1.0*", - "/usr/lib/mono/1.0/IBM.Data.DB2.dll", - ], - "assemblies": [ - ("IBM.Data.DB2", "1.0*"), - ], - }, - ] + debian_mono_file_table - - file_table = [e for e in file_table - if not (e.has_key("name") and e["name"] in IGNORE)] - - return file_table - def mono_find_provides_and_requires(files, d): provides = [] requires = [] diff --git a/contrib/mono/.mtn2git_empty b/contrib/mono/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/mono/.mtn2git_empty diff --git a/contrib/mono/collect-files.py b/contrib/mono/collect-files.py new file mode 100644 index 0000000000..c353667b19 --- /dev/null +++ b/contrib/mono/collect-files.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +## This utility takes the debian directory from an unpacked debian mono source +## tree (e.g. apt-get source mono), parses the *.install files and generates a +## bitbake include file with the file and package lists. It tries to handle -dbg +## packages by creating additional glob patterns for *.mdb and */.debug/*. Most +## of these will not match, but that's fine (I think). +## -- Henryk Plötz <henryk@openmoko.org> +## +##The output looks like: +##FILES_mono-jit-dbg = "/usr/bin/mono*.mdb \ +## /usr/bin/mono*/*.mdb" +##FILES_mono-jit = "/usr/bin/mono" +##FILES_mono-gac-dbg = "/usr/bin/gacutil*.mdb \ +## /usr/bin/gacutil*/*.mdb \ +## /usr/lib/mono/1.0/gacutil.exe*.mdb \ +## /usr/lib/mono/1.0/gacutil.exe*/*.mdb" +##FILES_mono-gac = "/usr/bin/gacutil \ +## /usr/lib/mono/1.0/gacutil.exe" +## ... +##PACKAGES = "mono-jit-dbg \ +## mono-jit \ +## mono-gac-dbg \ +## mono-gac \ +## ... + +import os, sys, re + +def collect_paths(dir): + paths = {} + + os.chdir(dir) + for filename in os.listdir("."): + if filename.endswith(".install"): + fp = file(filename, "r") + lines = fp.readlines() + fp.close() + + contents = [] + for line in lines: + line = line.strip() + if line.startswith("#"): continue + if line == "": continue + + lineparts = line.split() + if lineparts[0].startswith("debian/tmp"): + pattern = lineparts[0][ len("debian/tmp"): ] + if len(lineparts) == 2: + if not pattern.startswith(lineparts[1]): + print >>sys.stderr, "Warning: Apparently I don't fully understand the format in file %s" % filename + elif len(lineparts) > 2: + print >>sys.stderr, "Warning: Apparently I don't fully understand the format in file %s" % filename + + contents.append( pattern ) + else: + print >>sys.stderr, "Note: Ignoring %s in %s" % (lineparts, filename) + + paths[ filename[ :-len(".install") ] ] = contents + + return paths + +def collect_packages(paths): + # These packages should be populated first (e.g. because their files will otherwise end up + # in other packages) + PACKAGES_FIRST = ("mono-jit", "mono-gac", "mono-mjs", "mono-gmcs", "mono-utils", "mono-doc") + # These should be populated last (because their spec is very broad) + PACKAGES_LAST = ("mono-mcs", "libmono-system1.0-cil", "libmono-system2.0-cil", "libmono1.0-cil", "libmono2.0-cil") + first = [] + last = [] + packages = paths.keys() + for packagename in PACKAGES_FIRST + PACKAGES_LAST: + if packagename in packages: + packages.remove(packagename) + if packagename in PACKAGES_FIRST: + first.append(packagename) + else: + last.append(packagename) + packagenames = first + packages + last + + return packagenames, paths + +def debugify(packagenames, paths): + pnames = [] + for pkg in packagenames: + if not pkg.endswith("-dbg"): + result = [] + for path in paths[pkg]: + if not path.endswith("*"): + result.append(path + "*.mdb") + result.append(path + "*/*.mdb") + else: + result.append(path + ".mdb") + result.append(path + "/*.mdb") + if path.endswith("/"): + result.append(path + ".debug/") + result.append(path + "../.debug/") + paths[pkg + "-dbg"] = result + pnames.append(pkg + "-dbg") + pnames.append(pkg) + return pnames, paths + +if __name__ == "__main__": + packagenames, paths = collect_packages( collect_paths(".") ) + packagenames, paths = debugify(packagenames, paths) + + print "# This is a generated file, please do not edit directly" + print "# Use collect-files.py instead. -- Henryk <henryk@openmoko.org>" + + packages = [] + for pkg in packagenames: + if not paths[pkg]: continue + + print 'FILES_%s = "%s"' % (pkg, " \\\n\t".join(paths[pkg])) + packages.append(pkg) + + print + print 'PACKAGES = "%s"' % (" \\\n\t".join(packages)) diff --git a/packages/mono/mono_1.2.5.1.bb b/packages/mono/mono_1.2.5.1.bb index c3ea1818ad..1d58c2d810 100644 --- a/packages/mono/mono_1.2.5.1.bb +++ b/packages/mono/mono_1.2.5.1.bb @@ -2,7 +2,7 @@ require mono_1.2.5.inc DEPENDS = "mono-native mono-mcs-intermediate glib-2.0 perl-native" -PR = "r2" +PR = "r3" SRC_URI += "file://configure.patch;patch=1 \ file://genmdesc-cpp.patch;patch=1" @@ -35,11 +35,16 @@ do_install_append() { } inherit mono -PACKAGES = "${@" ".join([e["name"] for e in mono_get_file_table(bb.data.getVar('PV', d, 1), d) if e.has_key("name")])}" + +# Import file definitions from Debian +require mono_1.2.5.1-files.inc + +# Add some packages +PACKAGES_append = " mono-doc mono mono-runtime" FILES_mono-doc_append = " /usr/share/libgc-mono/ " -FILES_mono = "" # Apparently this gets ignored, so I'm setting it again below +FILES_mono = "" ALLOW_EMPTY_mono = "1" RDEPENDS_mono = "mono-common mono-jit" @@ -49,98 +54,26 @@ RDEPENDS_mono-runtime = "mono-jit mono-gac" RDEPENDS_mono-jit = "mono-common" -FILES_libmono-dev = "/usr/lib/libmono.la /usr/lib/libmono-profiler-cov.la /usr/lib/libmono-profiler-aot.la \ +FILES_libmono-dev =+ " /usr/lib/libmono.la /usr/lib/libmono-profiler-cov.la /usr/lib/libmono-profiler-aot.la \ /usr/lib/libMonoPosixHelper.la /usr/lib/libMonoSupportW.la" -FILES_libmono-dbg = "/usr/lib/.debug/libmono*.so.* /usr/lib/.debug/libikvm-native.so \ +FILES_libmono-dbg =+ " /usr/lib/.debug/libmono*.so.* /usr/lib/.debug/libikvm-native.so \ /usr/lib/.debug/libMonoPosixHelper.so /usr/lib/.debug/libMonoSupportW.so" -python populate_packages_prepend () { - def fillin_packages(): - # A lot of this code can probably be replaced with less code and some - # calls to do_split_packages - import bb, sys, os, glob, commands - - PV = bb.data.getVar('PV', d, 1) - - file_table = mono_get_file_table(PV, d) - packages_to_add = [] - - D = bb.data.getVar('D', d, 1) - if not D: return - D = D + "/" - - def classify_files(files): - normal, dev, dbg, doc = [], [], [], [] - for filename in files: - if filename.endswith(".mdb"): - dbg.append(filename) - elif os.path.basename( os.path.dirname( filename ) ) == ".debug": - dbg.append(filename) - elif filename.endswith(".pc"): - dev.append(filename) - else: - normal.append(filename) - return normal, dev, dbg, doc - - def will_strip(filename): - # From package.bbclass function runstrip - pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, 1) - ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, filename)) - if "not stripped" in result: - return True - else: - return False - - def append(name, value): - oldvalue = bb.data.getVar(name, d, 1) or "" - newvalue = " ".join([oldvalue, value]) - bb.data.setVar(name, newvalue, d) - - already_covered = [] - for package in file_table: - pn = package["name"] - if package.has_key("patterns"): - files = [] - for pattern in package["patterns"]: - matching = glob.glob( D + pattern ) - for filename in matching: - if os.path.isdir(filename): - for dirpath, dirnames, filenames in os.walk(filename): - for f in filenames: - debugname = os.path.join(dirpath, ".debug", f) - fullname = os.path.join(dirpath, f) - files.append(fullname) - if will_strip(fullname): - files.append(debugname) - else: - files.append(filename) - - # Remove the D prefix - files = [ e[len(D):] for e in files ] - - # Remove files that have already been placed in other packages - files = [ e for e in files if not e in already_covered ] - already_covered.extend( files ) - - if pn.endswith("-dev") or pn.endswith("-dbg") or pn.endswith("-doc"): - normal, dev, dbg, doc = files, [], [], [] - else: - normal, dev, dbg, doc = classify_files(files) - - for extension, filelist in [ ("",normal), ("-dev", dev), ("-dbg", dbg), ("-doc", doc)]: - if len(filelist) > 0: - packagename = pn + extension - append("FILES_%s" % packagename, " ".join(filelist)) - bb.debug(2, "%s\n\t%s" %( packagename, "\n\t".join( filelist ) )) - if not packagename in packages_to_add: - packages_to_add.append(packagename) - - else: - packages_to_add.append(pn) - - # mono is just a stub package - bb.data.setVar("FILES_mono", "", d) - - bb.data.setVar("PACKAGES", " ".join(packages_to_add), d) - fillin_packages() -} +# Packages not included in Debian +PACKAGES_prepend = "libnunit2.2-cil-dbg libnunit2.2-cil-dev libnunit2.2-cil \ + libmono-cecil0.5-cil-dbg libmono-cecil0.5-cil-dev libmono-cecil0.5-cil \ + libmono-db2-1.0-cil-dbg libmono-db2-1.0-cil-dev libmono-db2-1.0-cil" + +FILES_libnunit2.2-cil = "/usr/lib/mono/gac/nunit.*/2.2.* /usr/lib/mono/1.0/nunit.*.dll" +FILES_libnunit2.2-cil-dev = "/usr/lib/pkgconfig/mono-nunit.pc" +FILES_libnunit2.2-cil-dbg = "/usr/lib/mono/gac/nunit*/2.2.*/nunit.*.dll.mdb" + +FILES_libmono-cecil0.5-cil = "/usr/lib/mono/gac/Mono.Cecil/0.5.*" +FILES_libmono-cecil0.5-cil-dbg = "/usr/lib/mono/gac/Mono.Cecil/0.5.0.1__0738eb9f132ed756/Mono.Cecil.dll.mdb" + +FILES_libmono-db2-1.0-cil = "/usr/lib/mono/gac/IBM.Data.DB2/1.0* /usr/lib/mono/1.0/IBM.Data.DB2.dll" +FILES_libmono-db2-1.0-cil-dbg = "/usr/lib/mono/gac/IBM.Data.DB2/1.0*/IBM.Data.DB2.dll.mdb" + +# Move .pc files +FILES_libmono-cairo1.0-cil-dev = "/usr/lib/pkgconfig/mono-cairo.pc" +PACKAGES =+ " libmono-cairo1.0-cil-dev " |