Bug 13695 - Adding task after populate_sysroot and before package whit recipe inherits useradd breaks do_package task
Summary: Adding task after populate_sysroot and before package whit recipe inherits us...
Status: RESOLVED NOTABUG
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.6.4
Hardware: x86 Multiple
: Low normal
Target Milestone: 3.1
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-12-10 09:38 UTC by Igor Baldachini
Modified: 2019-12-12 16:09 UTC (History)
4 users (show)

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


Attachments
Test recipe to reproduce error (236 bytes, text/plain)
2019-12-10 09:38 UTC, Igor Baldachini
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Baldachini 2019-12-10 09:38:55 UTC
Created attachment 4597 [details]
Test recipe to reproduce error

Writing a recipe that inherit useradd and add a task after do_populate_sysroot and before do_package breaks do_package task

This is the errror log:

ERROR: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: '/storage/rpi/sources/poky/meta/classes/staging.bbclass', lineno: 553, function: extend_recipe_sysroot
     0549:                    dest = newmanifest[l]
     0550:                    if l.endswith("/"):
     0551:                        staging_copydir(l, targetdir, dest, seendirs)
     0552:                        continue
 *** 0553:                    staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0554:
     0555:    bb.note("Installed into sysroot: %s" % str(msg_adding))
     0556:    bb.note("Skipping as already exists in sysroot: %s" % str(msg_exists))
     0557:
File: '/storage/rpi/sources/poky/meta/classes/staging.bbclass', lineno: 151, function: staging_copyfile
     0147:        os.symlink(linkto, dest)
     0148:        #bb.warn(c)
     0149:    else:
     0150:        try:
 *** 0151:            os.link(c, dest)
     0152:        except OSError as err:
     0153:            if err.errno == errno.EXDEV:
     0154:                bb.utils.copyfile(c, dest)
     0155:            else:
Exception: FileExistsError: [Errno 17] File exists: '/storage/rpi/build/tmp/sysroots-components/aarch64/test-useradd-with-my-stuff-after-populate-sysroot-before-package/usr/bin/postinst-useradd-test-useradd-with-my-stuff-after-populate-sysroot-before-package' -> '/storage/rpi/build/tmp/work/aarch64-poky-linux/test-useradd-with-my-stuff-after-populate-sysroot-before-package/1.0-r0/recipe-sysroot/usr/bin/postinst-useradd-test-useradd-with-my-stuff-after-populate-sysroot-before-package'
Comment 1 Richard Purdie 2019-12-12 16:04:17 UTC
I'm not sure why you'd need a task which is between populate_sysroot and package. You're trying to add constraints which make the tasks effectively impossible to order so I'd advise against that. I'd suggest removing the ordering constraints, or changing to different tasks as this choice doesn't seem to make sense.
Comment 2 Ross Burton 2019-12-12 16:09:01 UTC
Some more context:

- addtask populate_sysroot after do_install
populate_sysroot takes the install files and prepare a sysroot.

- addtask package after do_install
package takes the install files and prepares the package structure.

Those tasks should be running in parallel because they're unrelated.  Your addtask is enforcing ordering that doesn't make sense and in the best case will slow the build down.

So, the fix is to change the ordering.