From 51908e5141133269edceb3b3bc26f8907ff2b3e0 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 25 Feb 2015 06:53:29 -0800 Subject: package_rpm.bbclass: support packaging of symlinks to directories os.walk() returns symlinks to directories in the "dirs" lists, but then never enters them by default. As a result, the old code applied neither the directory handling (because that is active once a directory gets entered) nor the file handling, and thus never packaged such symlinks. The fix is simple: find such special directory entries and move them to the "files" list. However, one has to be careful about the undefined behavior of modifying a list while iterating over it. This fix was required for packaging a modified base-files that created symlinks into /usr for /sbin /lib and /sbin. (From OE-Core rev: 9c4ab427b6acbc3f708860adace65393562227a7) Signed-off-by: Patrick Ohly Signed-off-by: Richard Purdie --- meta/classes/package_rpm.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'meta/classes/package_rpm.bbclass') diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index b87e634f1b..e305e8b4ab 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -197,6 +197,16 @@ python write_specfile () { if path.endswith("DEBIAN") or path.endswith("CONTROL"): continue + # Treat all symlinks to directories as normal files. + # os.walk() lists them as directories. + def move_to_files(dir): + if os.path.islink(os.path.join(rootpath, dir)): + files.append(dir) + return True + else: + return False + dirs[:] = [dir for dir in dirs if not move_to_files(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 -- cgit 1.2.3-korg