[OE-core] [PATCH] package_rpm.bbclass: support packaging of symlinks to directories

Mark Hatle mark.hatle at windriver.com
Tue Feb 17 16:54:19 UTC 2015


On 2/17/15 7:42 AM, Patrick Ohly wrote:
> 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.

I'm curious, what is the problem that is being fixed with this.

Normally you don't want to walk into symlinks to directories, as either you want
to capture the symlink itself -- or the symlink is pointing to something you
don't have access to when packaging (i.e. /proc).

--Mark

> Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
> ---
>  meta/classes/package_rpm.bbclass | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
> index 92ddf7a..6483e96 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -197,6 +197,13 @@ 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.
> +            for i, entry in enumerate(dirs):
> +                if os.path.islink(os.path.join(rootpath, entry)):
> +                    del dirs[i]
> +                    files.append(entry)
> +
>              # 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
> 




More information about the Openembedded-core mailing list