Bug 14907 - packaging debugsrc breaks for recipes with externalsrc and debug-with-srcpkg
Summary: packaging debugsrc breaks for recipes with externalsrc and debug-with-srcpkg
Status: RESOLVED WONTFIX
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: 4.0.11
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 4.0.28
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-09-01 11:34 UTC by Ola Nilsson
Modified: 2025-07-16 13:32 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ola Nilsson 2022-09-01 11:34:26 UTC
Commit c725bdb29b2669e53ea0f9d30f9683f094c9b326 (and 195b61756bae2d0066b411eea9e14da9de3992a9 on the kirkstone branch) tries to fix packaging of debugsrc for recipes that are using externalsrc. 

Unfortunately the current code does not work for recipes where S == B.  In this case the source files will be copied directy to /usr/src/debug, which will work until there is a file name collision.  For instance two recipes with a file ${S}/main.c using externalsrc at the same time. 

I did a workaround by replacing checkbuildpath with 

def checkbuildpath(file, d):
    tmpdir = d.getVar('S')  # <= Instead of TMPDIR
    with open(file) as f:
        file_content = f.read()
        if tmpdir in file_content:
            return True

    return False

It's possible that this change or similar would also solve the original problem [YOCTO #8015], but I have not tested that.

I tried to find any tests for packaging of debugsrc but had no luck.
Comment 1 Ola Nilsson 2022-10-20 11:42:36 UTC
This bug is not on current master.
I tried to update the Version and Target Milestone fields to reflect this, I hope I did not get it wrong.
Comment 2 Pavel Zhukov 2023-10-07 21:55:11 UTC
Hello,

Can you please share reproducer for this bug?

I've tried to create two recipes with main.c (simple hello world application) and externalsrc. Both recipes can be bitbake'd and installed and S == B.

Here is testcase I'm using:


    def test_externalsrc_s_equal_b(self):
        test_recipes = ["test-externalsrc1", "test-externalsrc2"]
        config = 'INHERIT += "externalsrc"\n'
        tmpdir = tempfile.mkdtemp(prefix='tmpextsrc')
        with open("{}/main.c".format(tmpdir), 'x') as main:
            main.write("""
#include <stdio.h>
int main(){
printf("Hello world!");
return 0;
};
""")
        for test_recipe in test_recipes:
            config += 'EXTERNALSRC:pn-{} = "{}"\n'.format(test_recipe, tmpdir)
            config += 'EXTERNALSRC_BUILD:pn-{} = "{}"\n'.format(test_recipe, tmpdir)
        self.write_config(config)
        for test_recipe in test_recipes:
            v = get_bb_vars(['S','B'], test_recipe)
            s = v['S']
            b = v['B']
            self.assertTrue(s == b, "$S != $B : {} != {}".format(s,b))
        res = bitbake("{}".format(" ".join(test_recipes))).status
        self.assertEqual(0, res, "Failed to build two packages with externalsrc, possible regression Yocto [#14907]")
Comment 3 Ola Nilsson 2023-10-09 06:48:02 UTC
I think this was fixed on master by Richards rewrite of package.bbclass in Poky commit 1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a.

The bug is probably still on kirkstone.

I tried to update the issue in october of 2022 to reflect that, but I'm not sure I got it right.
Comment 4 Pavel Zhukov 2023-10-12 14:52:38 UTC
(In reply to Ola Nilsson from comment #3)
> I think this was fixed on master by Richards rewrite of package.bbclass in
> Poky commit 1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a.
> 
> The bug is probably still on kirkstone.
> 
> I tried to update the issue in october of 2022 to reflect that, but I'm not
> sure I got it right.

This was clear, thank you. But the problem is I could not reproduce with kirkstone commit 195b61756bae2d0066b411eea9e14da9de3992a9 you have mentioned in the description.
Comment 5 Ola Nilsson 2023-10-13 11:07:05 UTC
You wont see any error unless you install both src-packages in the same image, like when building a debugfs.

Check the paths in .../packages-split/PN-src and you should find usr/src/debug/main.c in both.  

A better thing to test is that no source files are installed directly into usr/src/debug.  They should all be in usr/src/debug/PN.
Comment 6 Ola Nilsson 2023-10-13 11:08:28 UTC
I verified that this is still broken on 1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a using some small recipes.
Comment 7 Randy MacLeod 2024-08-08 18:26:55 UTC
Pavel,

Bumping to 4.0.21.
Do you expect (hope!) to have time to work on YP bug in the coming weeks and months?
../Randy
Comment 8 Randy MacLeod 2024-10-31 15:06:39 UTC
move to unassigned. feel free to take back if you have time.
Comment 9 Steve Sakoman 2025-07-16 13:32:05 UTC
It's been almost three years and there has been no progress on fixing this.

Closing bug as it is unlikely to get any further attention.