diff options
author | Ronan Le Martret <ronan@fridu.net> | 2014-08-29 18:39:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-03 16:00:28 +0100 |
commit | 2f42ef8d8fb1febf28252b98884cebabc931f720 (patch) | |
tree | 8da4dafcbcadf7aed1b90bd76a63a743e3bf792c | |
parent | 7b722c54e550a9f2500ca0e50a0baa24cdc052d8 (diff) | |
download | poky-2f42ef8d8fb1febf28252b98884cebabc931f720.tar.gz |
package_rpm: Add optional improved directory handling
During spec generation, ideally directories should not be auto
packaged under the %file section of rpm packages but take ownership of
specific directories.
* packages only empty directories or explict directory.
See:
- http://www.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html
- "The %dir Directive"
* This will prevent the overlapping of security permission.
For example, in Tizen the directory /etc have smack label 'System::Shared'
So Only one package should own and set the label of /etc to prevent
the overwriting of the smack label.
Existing behaviour is maintained if DIRFILES is not set. If it is set,
the modified behaviour is used. If can be set to an empty value by
core recipes to trigger the modified behaviour.
[RP: Modified to allow optional usage of DIRFILES]
(From OE-Core rev: 0e33d232916125ba5305ced7200cc00f8b5f7b22)
Signed-off-by: Ronan Le Martret <ronan@fridu.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/package_rpm.bbclass | 32 |
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 () { | |||
185 | if not len(depends_dict[dep]): | 185 | if not len(depends_dict[dep]): |
186 | array.append("%s: %s" % (tag, dep)) | 186 | array.append("%s: %s" % (tag, dep)) |
187 | 187 | ||
188 | def walk_files(walkpath, target, conffiles): | 188 | def walk_files(walkpath, target, conffiles, dirfiles): |
189 | # We can race against the ipk/deb backends which create CONTROL or DEBIAN directories | 189 | # We can race against the ipk/deb backends which create CONTROL or DEBIAN directories |
190 | # when packaging. We just ignore these files which are created in | 190 | # when packaging. We just ignore these files which are created in |
191 | # packages-split/ and not package/ | 191 | # packages-split/ and not package/ |
@@ -196,11 +196,24 @@ python write_specfile () { | |||
196 | path = rootpath.replace(walkpath, "") | 196 | path = rootpath.replace(walkpath, "") |
197 | if path.endswith("DEBIAN") or path.endswith("CONTROL"): | 197 | if path.endswith("DEBIAN") or path.endswith("CONTROL"): |
198 | continue | 198 | continue |
199 | for dir in dirs: | 199 | |
200 | if dir == "CONTROL" or dir == "DEBIAN": | 200 | # Directory handling can happen in two ways, either DIRFILES is not set at all |
201 | continue | 201 | # in which case we fall back to the older behaviour of packages owning all their |
202 | # All packages own the directories their files are in... | 202 | # directories |
203 | target.append('%dir "' + path + '/' + dir + '"') | 203 | if dirfiles is None: |
204 | for dir in dirs: | ||
205 | if dir == "CONTROL" or dir == "DEBIAN": | ||
206 | continue | ||
207 | # All packages own the directories their files are in... | ||
208 | target.append('%dir "' + path + '/' + dir + '"') | ||
209 | else: | ||
210 | # packages own only empty directories or explict directory. | ||
211 | # This will prevent the overlapping of security permission. | ||
212 | if path and not files and not dirs: | ||
213 | target.append('%dir "' + path + '"') | ||
214 | elif path and path in dirfiles: | ||
215 | target.append('%dir "' + path + '"') | ||
216 | |||
204 | for file in files: | 217 | for file in files: |
205 | if file == "CONTROL" or file == "DEBIAN": | 218 | if file == "CONTROL" or file == "DEBIAN": |
206 | continue | 219 | continue |
@@ -312,6 +325,9 @@ python write_specfile () { | |||
312 | bb.data.update_data(localdata) | 325 | bb.data.update_data(localdata) |
313 | 326 | ||
314 | conffiles = (localdata.getVar('CONFFILES', True) or "").split() | 327 | conffiles = (localdata.getVar('CONFFILES', True) or "").split() |
328 | dirfiles = localdata.getVar('DIRFILES', True) | ||
329 | if dirfiles is not None: | ||
330 | dirfiles = dirfiles.split() | ||
315 | 331 | ||
316 | splitname = strip_multilib(pkgname, d) | 332 | splitname = strip_multilib(pkgname, d) |
317 | 333 | ||
@@ -368,7 +384,7 @@ python write_specfile () { | |||
368 | srcrpostrm = splitrpostrm | 384 | srcrpostrm = splitrpostrm |
369 | 385 | ||
370 | file_list = [] | 386 | file_list = [] |
371 | walk_files(root, file_list, conffiles) | 387 | walk_files(root, file_list, conffiles, dirfiles) |
372 | if not file_list and localdata.getVar('ALLOW_EMPTY') != "1": | 388 | if not file_list and localdata.getVar('ALLOW_EMPTY') != "1": |
373 | bb.note("Not creating empty RPM package for %s" % splitname) | 389 | bb.note("Not creating empty RPM package for %s" % splitname) |
374 | else: | 390 | else: |
@@ -477,7 +493,7 @@ python write_specfile () { | |||
477 | 493 | ||
478 | # Now process files | 494 | # Now process files |
479 | file_list = [] | 495 | file_list = [] |
480 | walk_files(root, file_list, conffiles) | 496 | walk_files(root, file_list, conffiles, dirfiles) |
481 | if not file_list and localdata.getVar('ALLOW_EMPTY') != "1": | 497 | if not file_list and localdata.getVar('ALLOW_EMPTY') != "1": |
482 | bb.note("Not creating empty RPM package for %s" % splitname) | 498 | bb.note("Not creating empty RPM package for %s" % splitname) |
483 | else: | 499 | else: |