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.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
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