summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-01 14:21:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-30 16:38:08 +0000
commita7e5ad126885ac54ab441a1a60b201a9f16ef375 (patch)
tree606ddb004224d991d7cec131dc75386c85a3e839 /meta
parent8223a46ca06d10ed0f999b2a5b860d5f16ad5a3d (diff)
downloadpoky-a7e5ad126885ac54ab441a1a60b201a9f16ef375.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) (From OE-Core rev: 5f9228b32c243ae499398763ce7c90b776dc9d24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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