package_rpm: Fix backtrace on missing directory.
A message that is not in the archive (sent off-list or not yet received): [email protected]
It says usr//usr in the comment, but when I ran on a clean build it started complaining about opt//opt as well. Its not really clear why it is looking for those directories, and I am sure this is not likely the correct solution, but I wanted to get it out here so someone who has kicked this area of code might know what may be happening.
Quoted 104 lines · Jeremy Puhlman via lists.openembedded.org
From: "Jeremy A. Puhlman" <[email protected]>
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//usrin 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_specfile0523: spec_scriptlets_bottom.append('') 0524: 0525: # Now process files 0526: file_list = []*** 0527:
walk_files(root, file_list, conffiles, dirfiles)
0528: if notfile_listand 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, theisdir()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 inos.walk(walkpath):
0202: defget_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 <[email protected]>--- meta/classes-global/package_rpm.bbclass | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)meta/classes-global/package_rpm.bbclass +4
-3@@ -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 -=-=-=-=-=-=-=-=-=-=-=-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/2167262
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Jeremy Puhlman [email protected]
Quoted 5 lines · Jeremy Puhlman via lists.openembedded.org
It says
usr//usrin the comment, but when I ran on a clean build it started complaining about opt//opt as well. Its not really clear why it is looking for those directories, and I am sure this is not likely the correct solution, but I wanted to get it out here so someone who has kicked this area of code might know what may be happening.
Unfortunately there are layers of different pieces which could be the issue, such as pseudo in combination with the host distro libraries and uninative.
Can you create a test case which reproduces the issue? Does it always happen with this recipe? Does it happen on different host distros? Are you using uninative? What about buildtools-tarball?
Cheers,
Richard
Quoted 7 lines · Richard Purdie
Quoted 5 lines · Jeremy Puhlman via lists.openembedded.org
It says
usr//usrin the comment, but when I ran on a clean build it started complaining about opt//opt as well. Its not really clear why it is looking for those directories, and I am sure this is not likely the correct solution, but I wanted to get it out here so someone who has kicked this area of code might know what may be happening.
Quoted 5 lines
Unfortunately there are layers of different pieces which could be the issue, such as pseudo in combination with the host distro libraries and uninative.
Can you create a test case which reproduces the issue?
Yeah, I was going to try to get to it, but time got away from me. Hopefully I should be able to get some time later today.
Quoted 2 lines
Does it always
happen with this recipe?
Yes. Originally it was happening in our distro setup, minimizing it to just poky and the meta-oe/meta-python, it happens with the recipe with the default distro as well.
Quoted 1 line
Does it happen on different host distros?
I have not tried that, so far it was just rocky 8.
Quoted 2 lines
Are
you using uninative?
Yes. It happens with the default poky distro, too.
Quoted 1 line
What about buildtools-tarball?
We always use buildtools-extended-tarball, to isolate as much as possible from the host.
Quoted 4 lines
Cheers,
Richard
Signature · 2 lines
Jeremy Puhlman [email protected]
Quoted 10 lines · Jeremy Puhlman
Quoted 7 lines · Richard Purdie
Quoted 5 lines · Jeremy Puhlman via lists.openembedded.org
It says
usr//usrin the comment, but when I ran on a clean build it started complaining about opt//opt as well. Its not really clear why it is looking for those directories, and I am sure this is not likely the correct solution, but I wanted to get it out here so someone who has kicked this area of code might know what may be happening.
Quoted 7 lines
Quoted 5 lines
Unfortunately there are layers of different pieces which could be the issue, such as pseudo in combination with the host distro libraries and uninative.
Can you create a test case which reproduces the issue?
Yeah, I was going to try to get to it, but time got away from me. Hopefully I should be able to get some time later today.
Trying to reduce the recipe to bare bones, I narrowed it down the the DIRFILES setting. Deep in the top level class configuration for the layer, it sets DIRFILES="1", which looks wrong given the code. OTOH, nothing else in any of the layers we are using sets the value to anything, so what ever recent changes that were made there are untested by anything.
Turning that off should resolve my issue, but it looks like that code path may be vestigial at this point.
Quoted 21 lines
Quoted 3 lines
Does it always
happen with this recipe?Yes. Originally it was happening in our distro setup, minimizing it to just poky and the meta-oe/meta-python, it happens with the recipe with the default distro as well.
Quoted 1 line
Does it happen on different host distros?
I have not tried that, so far it was just rocky 8.
Quoted 2 lines
Are
you using uninative?Yes. It happens with the default poky distro, too.
Quoted 1 line
What about buildtools-tarball?
We always use buildtools-extended-tarball, to isolate as much as possible from the host.
Quoted 4 lines
Cheers,
Richard
Signature · 2 lines
Jeremy Puhlman [email protected]
Quoted 21 lines · Jeremy Puhlman
Quoted 10 lines · Jeremy Puhlman
Quoted 7 lines · Richard Purdie
Quoted 5 lines · Jeremy Puhlman via lists.openembedded.org
It says
usr//usrin the comment, but when I ran on a clean build it started complaining about opt//opt as well. Its not really clear why it is looking for those directories, and I am sure this is not likely the correct solution, but I wanted to get it out here so someone who has kicked this area of code might know what may be happening.Quoted 7 lines
Quoted 5 lines
Unfortunately there are layers of different pieces which could be the issue, such as pseudo in combination with the host distro libraries and uninative.
Can you create a test case which reproduces the issue?
Yeah, I was going to try to get to it, but time got away from me. Hopefully I should be able to get some time later today.
Quoted 8 lines
Trying to reduce the recipe to bare bones, I narrowed it down the the DIRFILES setting. Deep in the top level class configuration for the layer, it sets DIRFILES="1", which looks wrong given the code. OTOH, nothing else in any of the layers we are using sets the value to anything, so what ever recent changes that were made there are untested by anything.
Turning that off should resolve my issue, but it looks like that code path may be vestigial at this point.
As an aside, adding:
DIRFILES = "${bindir}"
To something like the bash recipe, reproduces the behavior.
Quoted 22 lines
Quoted 21 lines
Quoted 3 lines
Does it always
happen with this recipe?Yes. Originally it was happening in our distro setup, minimizing it to just poky and the meta-oe/meta-python, it happens with the recipe with the default distro as well.
Quoted 1 line
Does it happen on different host distros?
I have not tried that, so far it was just rocky 8.
Quoted 2 lines
Are
you using uninative?Yes. It happens with the default poky distro, too.
Quoted 1 line
What about buildtools-tarball?
We always use buildtools-extended-tarball, to isolate as much as possible from the host.
Quoted 4 lines
Cheers,
Richard
Signature · 2 lines
Jeremy Puhlman [email protected]
This was the commit that introduced the DIRFILES variable:
https://git.yoctoproject.org/poky/commit/?id=2f42ef8d8fb1febf28252b98884cebabc931f720
Given that it's undocumented, untested, rpm-specific, and currently broken, and looks like a workaround for security label conflicts elsewhere I'm inclined to remove the code paths that use it altogether.
Alex
Quoted 82 lines · Jeremy Puhlman via lists.openembedded.org
Quoted 31 lines · Jeremy Puhlman
Quoted 10 lines · Jeremy Puhlman
Quoted 7 lines · Richard Purdie
Quoted 5 lines · Jeremy Puhlman via lists.openembedded.org
It says
usr//usrin the comment, but when I ran on a clean build it started complaining about opt//opt as well. Its not really clear why it is looking for those directories, and I am sure this is not likely the correct solution, but I wanted to get it out here so someone who has kicked this area of code might know what may be happening.Quoted 8 lines
Quoted 5 lines
Unfortunately there are layers of different pieces which could be the issue, such as pseudo in combination with the host distro libraries and uninative.
Can you create a test case which reproduces the issue?
Yeah, I was going to try to get to it, but time got away from me. Hopefully I should
be able to get some time later today.Trying to reduce the recipe to bare bones, I narrowed it down the the DIRFILES setting.
Deep in the top level class configuration for the layer, it sets DIRFILES="1", which looks
wrong given the code. OTOH, nothing else in any of the layers we are using sets the value
to anything, so what ever recent changes that were made there are untested by anything.Quoted 4 lines
Turning that off should resolve my issue, but it looks like that code path may be vestigial at
this point.As an aside, adding:
DIRFILES = "${bindir}"
To something like the bash recipe, reproduces the behavior.Quoted 16 lines
Quoted 16 lines
Quoted 3 lines
Does it always
happen with this recipe?Yes. Originally it was happening in our distro setup, minimizing it to just poky and the
meta-oe/meta-python, it happens with the recipe with the default distro as well.Quoted 1 line
Does it happen on different host distros?
I have not tried that, so far it was just rocky 8.
Quoted 2 lines
Are
you using uninative?Yes. It happens with the default poky distro, too.
Quoted 1 line
What about buildtools-tarball?
Quoted 9 lines
Quoted 8 lines
We always use buildtools-extended-tarball, to isolate as much as possible from the host.
Quoted 4 lines
Cheers,
Richard
--
Jeremy Puhlman
[email protected]-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196145): https://lists.openembedded.org/g/openembedded-core/message/196145
Mute This Topic: https://lists.openembedded.org/mt/104536226/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-