path: root/lib
diff options
authorChris Larson <chris_larson@mentor.com>2010-10-09 17:59:05 -0700
committerChris Larson <chris_larson@mentor.com>2010-10-09 18:28:00 -0700
commit7791fdfc5ebafbd52b7921cd4a1ffc77699afb06 (patch)
tree05966afabb63275a56f7e47156032699519e7a15 /lib
parent7e76f8041cdc6ae588383193c320ff417be8a8b0 (diff)
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@mentor.com>
Diffstat (limited to 'lib')
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/oe/package.py b/lib/oe/package.py
new file mode 100644
index 0000000000..464368e78f
--- /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:]