aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/package_rpm.bbclass32
1 files changed, 24 insertions, 8 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 57309accf5..92ddf7a30f 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -185,7 +185,7 @@ python write_specfile () {
if not len(depends_dict[dep]):
array.append("%s: %s" % (tag, dep))
- def walk_files(walkpath, target, conffiles):
+ def walk_files(walkpath, target, conffiles, dirfiles):
# We can race against the ipk/deb backends which create CONTROL or DEBIAN directories
# when packaging. We just ignore these files which are created in
# packages-split/ and not package/
@@ -196,11 +196,24 @@ python write_specfile () {
path = rootpath.replace(walkpath, "")
if path.endswith("DEBIAN") or path.endswith("CONTROL"):
continue
- for dir in dirs:
- if dir == "CONTROL" or dir == "DEBIAN":
- continue
- # All packages own the directories their files are in...
- target.append('%dir "' + path + '/' + dir + '"')
+
+ # Directory handling can happen in two ways, either DIRFILES is not set at all
+ # in which case we fall back to the older behaviour of packages owning all their
+ # directories
+ if dirfiles is None:
+ for dir in dirs:
+ if dir == "CONTROL" or dir == "DEBIAN":
+ continue
+ # All packages own the directories their files are in...
+ target.append('%dir "' + path + '/' + dir + '"')
+ else:
+ # packages own only empty directories or explict directory.
+ # This will prevent the overlapping of security permission.
+ if path and not files and not dirs:
+ target.append('%dir "' + path + '"')
+ elif path and path in dirfiles:
+ target.append('%dir "' + path + '"')
+
for file in files:
if file == "CONTROL" or file == "DEBIAN":
continue
@@ -312,6 +325,9 @@ python write_specfile () {
bb.data.update_data(localdata)
conffiles = (localdata.getVar('CONFFILES', True) or "").split()
+ dirfiles = localdata.getVar('DIRFILES', True)
+ if dirfiles is not None:
+ dirfiles = dirfiles.split()
splitname = strip_multilib(pkgname, d)
@@ -368,7 +384,7 @@ python write_specfile () {
srcrpostrm = splitrpostrm
file_list = []
- walk_files(root, file_list, conffiles)
+ walk_files(root, file_list, conffiles, dirfiles)
if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
bb.note("Not creating empty RPM package for %s" % splitname)
else:
@@ -477,7 +493,7 @@ python write_specfile () {
# Now process files
file_list = []
- walk_files(root, file_list, conffiles)
+ walk_files(root, file_list, conffiles, dirfiles)
if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
bb.note("Not creating empty RPM package for %s" % splitname)
else: