From: "Jeremy A. Puhlman" <jpuhl...@mvista.com>

This seems to work around the following issue. The recipe in quesiton
places all of its content in /opt, and we turn on license collection
globally. Systemd is turned on so usrmerge is also on. I doubt this
is the correct way to deal with this as it is not clear why it is
looking for /usr//usr in the first place. Not sure if its just a
wierd edge case or what.

File:
'/build/../layers/poky/meta/classes-global/package_rpm.bbclass',
lineno: 527, function: write_specfile
     0523:            spec_scriptlets_bottom.append('')
     0524:
     0525:        # Now process files
     0526:        file_list = []
 *** 0527:        walk_files(root, file_list, conffiles, dirfiles)
     0528:        if not file_list and localdata.getVar('ALLOW_EMPTY',
False) != "1":
     0529:            bb.note("Not creating empty RPM package for %s" %
splitname)
     0530:        else:
     0531:            spec_files_bottom.append('%%files -n %s' %
splitname)
File:
'/build/../layers/poky/meta/classes-global/package_rpm.bbclass',
lineno: 249, function: walk_files
     0245:                    target.append(get_attr(dir) + '%dir "' +
escape_chars(p) + '"')
     0246:            else:
     0247:                # packages own only empty directories or
explict directory.
     0248:                # This will prevent the overlapping of
security permission.
 *** 0249:                attr = get_attr(path)
     0250:                if path and not files and not dirs:
     0251:                    target.append(attr + '%dir "' +
escape_chars(path) + '"')
     0252:                elif path and path in dirfiles:
     0253:                    target.append(attr + '%dir "' +
escape_chars(path) + '"')
File:
'/build/../layers/poky/meta/classes-global/package_rpm.bbclass',
lineno: 203, function: get_attr
     0199:        # of the walk, the isdir() test would then fail and
the walk code would assume its a file
     0200:        # hence we check for the names in files too.
     0201:        for rootpath, dirs, files in os.walk(walkpath):
     0202:            def get_attr(path):
 *** 0203:                stat_f = os.stat(rootpath + "/" + path,
follow_symlinks=False)
     0204:                mode = stat.S_IMODE(stat_f.st_mode)
     0205:                try:
     0206:                    owner =
pwd.getpwuid(stat_f.st_uid).pw_name
     0207:                except Exception as e:
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/build/tmp/work/corei7-64-montavista-linux/mvtest/2.0/packages-split/mvtest-lic/opt//opt'

Signed-off-by: Jeremy A. Puhlman <jpuhl...@mvista.com>
---
 meta/classes-global/package_rpm.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes-global/package_rpm.bbclass 
b/meta/classes-global/package_rpm.bbclass
index 2e3e4e8c79..a6885ac74e 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -200,6 +200,8 @@ python write_specfile () {
         # hence we check for the names in files too.
         for rootpath, dirs, files in os.walk(walkpath):
             def get_attr(path):
+                if not os.path.exists(rootpath + "/" + path):
+                   return "" 
                 stat_f = os.stat(rootpath + "/" + path, follow_symlinks=False)
                 mode = stat.S_IMODE(stat_f.st_mode)
                 try:
@@ -243,7 +245,7 @@ python write_specfile () {
                     p = path + '/' + dir
                     # All packages own the directories their files are in...
                     target.append(get_attr(dir) + '%dir "' + escape_chars(p) + 
'"')
-            elif path:
+            elif path and os.path.exists(path):
                 # packages own only empty directories or explict directory.
                 # This will prevent the overlapping of security permission.
                 attr = get_attr(path)
@@ -257,7 +259,7 @@ python write_specfile () {
                 p = path + '/' + file
                 if conffiles.count(p):
                     target.append(attr + '%config "' + escape_chars(p) + '"')
-                else:
+                elif attr:
                     target.append(attr + '"' + escape_chars(p) + '"')
 
     # Prevent the prerm/postrm scripts from being run during an upgrade
-- 
2.31.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196109): 
https://lists.openembedded.org/g/openembedded-core/message/196109
Mute This Topic: https://lists.openembedded.org/mt/104536226/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to