[oe-commits] Chris Larson : oe.package: add 'files' function

git version control git at git.openembedded.org
Sun Oct 10 04:17:12 UTC 2010


Module: openembedded.git
Branch: master
Commit: 7791fdfc5ebafbd52b7921cd4a1ffc77699afb06
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=7791fdfc5ebafbd52b7921cd4a1ffc77699afb06

Author: Chris Larson <chris_larson at mentor.com>
Date:   Sat Oct  9 17:59:05 2010 -0700

oe.package: add 'files' function

This function obtains a list of files to be included in a package, using the
globs in FILES_<pkg> and the files installed in ${D}.  Currently, the only
user is package_dbg, but I can see this being useful in package.bbclass as
well.

Signed-off-by: Chris Larson <chris_larson at mentor.com>

---

 classes/package_dbg.bbclass |   27 ++-------------------------
 lib/oe/package.py           |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/classes/package_dbg.bbclass b/classes/package_dbg.bbclass
index 4f4dd2f..24040f4 100644
--- a/classes/package_dbg.bbclass
+++ b/classes/package_dbg.bbclass
@@ -12,30 +12,6 @@ PACKAGE_DBG_DESC = "Debugging files for %s"
 PACKAGE_DBG_EXCLUDE = "${PN}-locale* ${PN}-doc ${PN}-dev *-dbg"
 
 
-def __package_get_files(pkg, d):
-    """ Obtains a list of files to be included in a package.
-
-    Starting from the FILES_<pkg> variable, it expands any globs in the list,
-    which removes missing files, and traverses any directories in the list.
-
-    It does *not* remove files which are also in other packages, it's left
-    to the user's discretion whether to allow overlap. """
-
-    from glob import glob
-    from os.path import join, isdir, islink
-
-    installdir = d.getVar("D", True)
-    installdirlen = len(installdir)
-
-    files = (d.getVar("FILES_%s" % pkg, True) or "").split()
-    for globbed in (glob(join(installdir, file[1:])) for file in files):
-        for path in globbed:
-            if isdir(path) and not islink(path):
-                for file in oe.path.find(path):
-                    yield file[installdirlen:]
-            else:
-                yield path[installdirlen:]
-
 def add_dbg_packages(d):
     from fnmatch import fnmatch
 
@@ -77,6 +53,7 @@ python populate_packages_prepend () {
 python package_do_dbg() {
     """ Populate the -dbg subpackage metadata. """
 
+    import oe.package
     from os.path import join, basename, dirname
 
     def setVar(key, val):
@@ -89,7 +66,7 @@ python package_do_dbg() {
 
     done = []
     for pkgname in tuple(packages):
-        files = tuple(__package_get_files(pkgname, d))
+        files = tuple(oe.package.files(pkgname, d))
         dbg = [join(dirname(file), ".debug", basename(file))
                for file in files
                if not file in done]
diff --git a/lib/oe/package.py b/lib/oe/package.py
new file mode 100644
index 0000000..464368e
--- /dev/null
+++ b/lib/oe/package.py
@@ -0,0 +1,24 @@
+import glob
+import os.path
+import oe.path
+
+def files(pkg, d):
+    """ Obtains a list of files to be included in a package.
+
+    Starting from the FILES_<pkg> variable, it expands any glob.globs in the list,
+    which removes missing files, and traverses any directories in the list.
+
+    It does *not* remove files which are also in other packages, it's left
+    to the user's discretion whether to allow overlap. """
+
+    installdir = d.getVar("D", True)
+    installdirlen = len(installdir)
+
+    files = (d.getVar("FILES_%s" % pkg, True) or "").split()
+    for globbed in (glob.glob(os.path.join(installdir, file[1:])) for file in files):
+        for path in globbed:
+            if os.path.isdir(path) and not os.path.islink(path):
+                for file in oe.path.find(path):
+                    yield file[installdirlen:]
+            else:
+                yield path[installdirlen:]





More information about the Openembedded-commits mailing list