Bug 10331 - build.py exception: FileNotFoundError: [Errno 2] No such file or directory
Summary: build.py exception: FileNotFoundError: [Errno 2] No such file or directory
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Juro Bystricky
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-09-26 20:21 UTC by Juro Bystricky
Modified: 2016-09-28 21:41 UTC (History)
2 users (show)

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


Attachments
Avoid exception when calling os.getcwd() (683 bytes, patch)
2016-09-26 20:21 UTC, Juro Bystricky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Juro Bystricky 2016-09-26 20:21:06 UTC
Created attachment 3442 [details]
Avoid exception when calling os.getcwd()

Under some rather unique conditions I encountered the following error:

ERROR: nativesdk-libgcc-initial-6.2.0-r0 do_populate_sysroot: 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:do_populate_sysroot(d)
     0003:
File: '/data/master-zephyr/poky/meta/classes/staging.bbclass', lineno: 213, function: do_populate_sysroot
     0209:            problems.add(task)
     0210:    return problems
     0211:
     0212:python do_populate_sysroot () {
 *** 0213:    bb.build.exec_func("sysroot_stage_all", d)
     0214:    bb.build.exec_func("sysroot_strip", d)
     0215:    for f in (d.getVar('SYSROOT_PREPROCESS_FUNCS', True) or '').split():
     0216:        bb.build.exec_func(f, d)
     0217:    pn = d.getVar("PN", True)
File: '/data/master-zephyr/poky/bitbake/lib/bb/build.py', lineno: 264, function: exec_func
     0260:            exec_func_python(func, d, runfile, cwd=adir, pythonexception=pythonexception)
     0261:        else:
     0262:            exec_func_shell(func, d, runfile, cwd=adir)
     0263:
 *** 0264:    if oldcwd and os.getcwd() != oldcwd:
     0265:        try:
     0266:            bb.warn("Task %s changed cwd to %s" % (func, os.getcwd()))
     0267:            os.chdir(oldcwd)
     0268:        except:
Exception: FileNotFoundError: [Errno 2] No such file or directory



The reason for the exception is we are running the command os.getcwd() from a directory that no longer exist.

(The attachment fixes this)
Comment 1 Juro Bystricky 2016-09-26 21:20:37 UTC
patch sent to the mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2016-September/126949.html