From: Patrick Ohly <patrick.ohly@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2] package_rpm.bbclass: support packaging of symlinks to directories
Date: Wed, 25 Feb 2015 06:51:15 -0800 [thread overview]
Message-ID: <1424875875-1061-1-git-send-email-patrick.ohly@intel.com> (raw)
In-Reply-To: <1424180525-4138-1-git-send-email-patrick.ohly@intel.com>
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.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
---
meta/classes/package_rpm.bbclass | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 4f9f813..e305e8b 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -199,10 +199,13 @@ python write_specfile () {
# Treat all symlinks to directories as normal files.
# os.walk() lists them as directories.
- for i, entry in enumerate(dirs):
- if os.path.islink(os.path.join(rootpath, entry)):
- del dirs[i]
- files.append(entry)
+ 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
--
1.8.4.5
next prev parent reply other threads:[~2015-02-25 14:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 13:42 [PATCH] package_rpm.bbclass: support packaging of symlinks to directories Patrick Ohly
2015-02-17 15:55 ` Christopher Larson
2015-02-18 8:43 ` Patrick Ohly
2015-02-18 9:08 ` Patrick Ohly
2015-02-17 16:54 ` Mark Hatle
2015-02-17 16:57 ` Christopher Larson
2015-02-17 17:09 ` Mark Hatle
2015-02-18 3:40 ` Dan McGregor
2015-02-18 8:45 ` Patrick Ohly
2015-02-18 14:54 ` Mark Hatle
2015-02-25 14:51 ` Patrick Ohly [this message]
2015-02-25 15:18 ` [PATCH v2] " Patrick Ohly
2015-02-25 14:53 ` [PATCH v3] " Patrick Ohly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424875875-1061-1-git-send-email-patrick.ohly@intel.com \
--to=patrick.ohly@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox