summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-01 14:21:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-01 17:43:57 +0000
commit0182b2bca3df8e74eb737ce2eab511cdb3d2996f (patch)
tree887010be868ab93ab4b0beb78d5be13606f1fd6a /meta/classes/package.bbclass
parentec20f0ed5d12bab87aa35be8e2bf6c333680739b (diff)
downloadpoky-0182b2bca3df8e74eb737ce2eab511cdb3d2996f.tar.gz
package.bbclass: Fix various problems
Before this change: a) Ownership and permissions of files copied from packages to package-split could get lost during the copy process. This change ensures they are preserved. b) Ownership and permissions of directories could also get lost. Most of the complexity in this patch is addressing this problem ensuring newly created directories match the source ones being copied. c) There was no warning about directories being created but not shipped by any package. This patch fixes all of the above issues. (From OE-Core rev: 6021e309e69d823e1467648aee12a32182945569) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass33
1 files changed, 27 insertions, 6 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index a9c510d27c..0e1d8dbfc4 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -916,16 +916,37 @@ python populate_packages () {
916 if file in seen: 916 if file in seen:
917 continue 917 continue
918 seen.append(file) 918 seen.append(file)
919
920 def mkdir(src, dest, p):
921 src = os.path.join(src, p)
922 dest = os.path.join(dest, p)
923 bb.mkdirhier(dest)
924 fstat = os.stat(src)
925 os.chmod(dest, fstat.st_mode)
926 os.chown(dest, fstat.st_uid, fstat.st_gid)
927 if p not in seen:
928 seen.append(p)
929
930 def mkdir_recurse(src, dest, paths):
931 while paths.startswith("./"):
932 paths = paths[2:]
933 p = "."
934 for c in paths.split("/"):
935 p = os.path.join(p, c)
936 if not os.path.exists(os.path.join(dest, p)):
937 mkdir(src, dest, p)
938
919 if os.path.isdir(file) and not os.path.islink(file): 939 if os.path.isdir(file) and not os.path.islink(file):
920 bb.mkdirhier(os.path.join(root,file)) 940 mkdir_recurse(dvar, root, file)
921 os.chmod(os.path.join(root,file), os.stat(file).st_mode)
922 continue 941 continue
923 942
943 mkdir_recurse(dvar, root, os.path.dirname(file))
924 fpath = os.path.join(root,file) 944 fpath = os.path.join(root,file)
925 dpath = os.path.dirname(fpath)
926 bb.mkdirhier(dpath)
927 if not os.path.islink(file): 945 if not os.path.islink(file):
928 os.link(file, fpath) 946 os.link(file, fpath)
947 fstat = os.stat(file)
948 os.chmod(fpath, fstat.st_mode)
949 os.chown(fpath, fstat.st_uid, fstat.st_gid)
929 continue 950 continue
930 ret = bb.copyfile(file, fpath) 951 ret = bb.copyfile(file, fpath)
931 if ret is False or ret == 0: 952 if ret is False or ret == 0:
@@ -939,13 +960,13 @@ python populate_packages () {
939 dir = root[len(dvar):] 960 dir = root[len(dvar):]
940 if not dir: 961 if not dir:
941 dir = os.sep 962 dir = os.sep
942 for f in files: 963 for f in (files + dirs):
943 path = os.path.join(dir, f) 964 path = os.path.join(dir, f)
944 if ('.' + path) not in seen: 965 if ('.' + path) not in seen:
945 unshipped.append(path) 966 unshipped.append(path)
946 967
947 if unshipped != []: 968 if unshipped != []:
948 bb.warn("For recipe %s, the following files were installed but not shipped in any package:" % pn) 969 bb.warn("For recipe %s, the following files/directories were installed but not shipped in any package:" % pn)
949 for f in unshipped: 970 for f in unshipped:
950 bb.warn(" " + f) 971 bb.warn(" " + f)
951 972