Commit Graph

3881 Commits

Author SHA1 Message Date
Robert Yang
d6bc389e81 bitbake: bitbake: pysh: Improve error handling for shell code
The p_error() is used for printing errors when parse shell code, but it can't
the EOF error correctly

- Add the following lines to quilt.inc
  do_configure_prepend () {
      find ${s} -name "*.in" -exec sed -i -e "1s,^#\!.*@perl@ -w$,#\! @perl@\nuse warnings;," {} \;
      if [ hello ]; then
  }

- Before the patch:
  $ rm -fr cache/ tmp/cache/; bitbake -p
  [snip]
  WARNING: /path/to/quilt/quilt-native_0.65.bb: Error during finalise of /path/to/quilt/quilt-native_0.65.bb
  [snip]
  bb.pysh.sherrors.ShellSyntaxError: None
  followed by:

  We can see that this isn't easy to debug, let p_error() check wheter it is EOF
  and print appropriate errors can improve the error message. And don't let
  codeparser.py except pyshlex.NeedMore (in fact, it never worked since p_error()
  only raise ShellSyntaxError), but make it print the last 5 lines which might be
  useful for debuging.

- After the patch
  $ rm -fr cache/ tmp/cache/; bitbake -p
  [snip]
  ERROR: /path/to/quilt/quilt_0.65.bb: Error during parse shell code, the last 5 lines are:
      find /path/to/quilt/0.65-r0/quilt-0.65 -name "*.in" -exec sed -i -e "1s,^#\!.*@PERL@ -w$,#\! @PERL@\nuse warnings;," {} \;
      if [ hello ]; then
      autotools_do_configure
      sed -e 's,^COMPAT_SYMLINKS.*:=.*,COMPAT_SYMLINKS    :=,' -i /path/to/quilt/0.65-r0/quilt-0.65/Makefile
  [snip]
    File "/path/to/bb/pysh/pyshyacc.py", line 649, in p_error(p=None):
               w('Unexpected EOF')
      >    raise sherrors.ShellSyntaxError(''.join(msg))

  bb.pysh.sherrors.ShellSyntaxError: Unexpected EOF

(Bitbake rev: 44790597951638e32eb1672de2e40bd5a603326b)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-09 11:07:48 +00:00
Robert Yang
b3f0b96a25 bitbake: pysh/pyshlex.py: Set is not importable
>>> from Set import Set
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'Set'

So remove related code.

(Bitbake rev: 118e9d8894e64d102543562314b318676006e710)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-09 11:07:48 +00:00
Robert Yang
cbc102d8fc bitbake: pysh/sherrors.py: Remove unused classes
The only two that we need are ShellSyntaxError and ShellError, others are not
used, so remove them.

(Bitbake rev: abee2ff5ee71bf8c3221cd9d3cd4243ebb4ca273)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-09 11:07:48 +00:00
Robert Yang
54de2f5089 bitbake: pysh: Remove unused modules
We don't use these modules in bitbake, so remove them.

And pysh's author declared that pysh is no longer maintained:
http://pysh.sourceforge.net/

(Bitbake rev: 9cc4f12d2aef366a593c7977d3818a3002b1d8bf)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-09 11:07:48 +00:00
Joshua Watt
66318c5831 bitbake: bitbake: persist_data: Retry database setup
The configuration of the sqlite database can timeout due to locking
under heavy load and should be subject to the same retry logic as the
other statements.

[YOCTO #13069]

(Bitbake rev: 5a2a95b0396e39662968690b3065d2f88167a71c)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:37 +00:00
Richard Purdie
888d76d221 bitbake: utils: Use utils.remove() within prunedir()
We've already tweaked remove() for speed and not to error if it
races for deletion. Therefore use this for prunedir() which was
starting to show the same bug reports.

[YOCTO #13003]

(Bitbake rev: 47f359f9b017f8d99d0bb2161ac0dcefcbd915de)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:37 +00:00
Richard Purdie
e74f80433e bitbake: fetch2: Fix os.errno references
os.errno used to happen to work but is invalid. Correct to use errno.

[YOCTO #13068]

(Bitbake rev: 03aae96a8859409b1ce7e3d5c1197371fa96bd14)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:37 +00:00
Richard Purdie
3630328d05 bitbake: fetch2/wget: Fix typo in exception name
This could clearly never have worked since the python3 migration
but as its in an error path, it doesn't get tested/used much.

(Bitbake rev: 704f27dc28d50a6dc02c8b64274ee4ecb3058c4a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:37 +00:00
Richard Purdie
89e2d2835d bitbake: cooker: Add some timing debug messages to the server startup
We're seeing slow startup in bitbake, add some timeing debug messages so
the logs are more useful for debugging when its slow.

(Bitbake rev: 8d1fc115b8a176009f1f3a8ce840b422e7e0b45e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:37 +00:00
Richard Purdie
55197b853d bitbake: server/process: Increase server startup time delay
On loaded production systems we've seen bitbake server take over
40s to start up. Increase the timeout to 90s which tries to avoid
failures in selftests.

The delays come from setting up the inotify watches (31s) so can't
really be avoided.

After 5s delay we now warn the user we're waiting for 90s so the
interactive exeperience shouldn't be much changed and its very
unlikely the user would see that anyway.

(Bitbake rev: 7a4e105093c3080c1087cd06abc2883852a23e28)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:37 +00:00
Richard Purdie
e5c713acb0 bitbake: cache: Cleanup deprecated function usage
Remove a deprecated warning and stop using our own deprecated API!

(Bitbake rev: 83ece2c6f4b000e906fec9148f25bd1dff66cfb0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Joshua Watt
e089fb1ae0 bitbake: siggen: Split out stampfile hash fetch
The mechanism used to get the hash for a stamp file is split out so that
it can be overridden by derived classes

[YOCTO #13030]

(Bitbake rev: ce241534d19b2f1c51dbdb3b92419676d234e464)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Joshua Watt
86cc1a4104 bitbake: bitbake-worker: Pass taskhash as runtask parameter
Pass the task hash as a parameter to the 'runtask' message instead of
passing the entire dictionary of hashes when the worker is setup. This
is possible less efficient, but prevents the worker taskhashes from
being out of sync with the runqueue in the event that the taskhashes in
the runqueue change.

[YOCTO #13030]

(Bitbake rev: 1e86d8c1bec7ea5d016a5ad2097f999362e29033)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Joshua Watt
7509b5ee05 bitbake: persist_data: Disable enable_shared_cache
Turns off the shared cache. It isn't a significant factor in performance
(now that WAL is enabled), and is a really bad idea to have enabled in
processes that fork() (as bitbake it prone to do).

[YOCTO #13030]

(Bitbake rev: 71b427bf01374973a971c10cb64024c8ef2a11eb)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Joshua Watt
09b4de78f2 bitbake: persist_data: Enable Write Ahead Log
Enabling the write ahead log improves database reliability, speeds up
writes (since they mostly happen sequentially), and speeds up readers
(since they are no longer blocked by most write operations). The
persistent database is very read heavy, so the auto-checkpoint size is
reduced from the default (usually 1000) to 100 so that reads remain
fast.

[YOCTO #13030]

(Bitbake rev: 79100fa67539f9654af9bf6d3e6842eb5c12e989)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Joshua Watt
549eccc0db bitbake: persist_data: Add key constraints
Constructs the "key" column in the persistent database as a non-NULL
primary key. This significantly speeds up lookup operations in large
databases.

[YOCTO #13030]

(Bitbake rev: f5ba7775cfcb90401522d977cc66fe0f5aeb7a66)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Joshua Watt
7afa726bec bitbake: persist_data: Fix leaking cursors causing deadlock
The original implementation of persistent data executed all SQL
statements via sqlite3.Connection.execute(). Behind the scenes, this
function created a sqlite3 Cursor object, executed the statement, then
returned the cursor. However, the implementation did not account for
this and failed to close the cursor object when it was done. The cursor
would eventually be closed when the garbage collector got around to
destroying it. However, sqlite has a limit on the number of cursors that
can exist at any given time, and once this limit is reached it will
block a query to wait for a cursor to be destroyed. Under heavy database
queries, this can result in Python deadlocking with itself, since the
SQL query will block waiting for a free cursor, but Python can no longer
run garbage collection (as it is blocked) to free one.

This restructures the SQLTable class to use two decorators to aid in
performing actions correctly. The first decorator (@retry) wraps a
member function in the retry logic that automatically restarts the
function in the event that the database is locked.

The second decorator (@transaction) wraps the function so that it occurs
in a database transaction, which will automatically COMMIT the changes
on success and ROLLBACK on failure. This function additionally creates
an explicit cursor, passes it to the wrapped function, and cleans it up
when the function is finished.

Note that it is still possible to leak cursors when iterating. This is
much less frequent, but can still be mitigated by wrapping the iteration
in a `with` statement:

 with db.iteritems() as it:
     for (k, v) in it:
         ...

As a side effect, since most statements are wrapped in a transaction,
setting the isolation_level when the connection is created is no longer
necessary.

[YOCTO #13030]

(Bitbake rev: e8b9d3f534ef404780be23b601d5a4bb9cec928a)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07 12:38:58 +00:00
Richard Purdie
5806b4cbd8 bitbake: main: Don't use print() directly, use logger
Avoid failures like:

2018-12-04 03:30:56,033 - oe-selftest - INFO - ======================================================================
2018-12-04 03:30:56,033 - oe-selftest - INFO - FAIL: pkgdata.OePkgdataUtilTests.test_find_path (subunit.RemotedTestCase)
2018-12-04 03:30:56,033 - oe-selftest - INFO - ----------------------------------------------------------------------
2018-12-04 03:30:56,033 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
[...]
AssertionError: 'Previous bitbake instance shutting down?,[77 chars]xist' != 'ERROR: Unable to find any package produci[14 chars]xist'
- Previous bitbake instance shutting down?, waiting to retry...
  ERROR: Unable to find any package producing path /not/exist

We need to use the logger so output is correctly handled in such cases.

(Bitbake rev: b5686fc07d06e1f0a55161b5ebcec6552d74ceff)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-05 13:11:27 +00:00
Richard Purdie
afe797a277 bitbake: process: Flush key output to logs
Small tweak to ensure these items are printed into the log since there
is other logging code which looks for the header and this makes it clearer
the server did start but is slow somewhere in startup.

(Bitbake rev: 7c0b84cac892744225fa0462f918ea9a79b356cb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-05 13:11:27 +00:00
Richard Purdie
5610acda80 bitbake: server/process: Handle short reads
Its possible the read may return a smaller number of characters. Remove
the possibility by using a single character to signal the server is ready.

(Bitbake rev: 767c9596d129d21ddf5d2e00c55f0a0525c641dc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-05 13:11:27 +00:00
Richard Purdie
b9439e0255 bitbake: server/process: Make lockfile handling clearer
This simplifies the code and makes it easier to read but has the
same functionality.

(Bitbake rev: a0b9cfaf2d03fd047a79d32e668001718d02c4bf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-05 13:11:27 +00:00
Robert Yang
f7060a4399 bitbake: bitbake: BBHandler: Check tab indentation for python code
The previous check was in data.py which only can check code like "python
funcname()" in the dependency chain, but there are 3 kinds of python functions:
  - python()
  - def py_funcname()
  - python funcname()

Add the checking to BBHandler to check and warn for all of them.

The warning looks like:
WARNING: /path/to/recipes-core/busybox/busybox_1.29.2.bb: python should use 4 spaces indentation, but found tabs in busybox.inc, line 75

(Bitbake rev: 0cdc5b81fc1f5e5281a525a657e420ebc3bb9e90)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-05 13:04:54 +00:00
Ulf Magnusson
db20fe6f0a bitbake: fetch2/svn: Fix SVN repository concurrent update race
The ${DL_DIR}/svn directory is used by BitBake to keep checked-out SVN
repositories from which tarballs are generated. These repositories were
protected from concurrent update with a lock on the tarballs. However,
the tarballs are specific to the SRCREV and module checked out (many
tarballs can come from the same repository), meaning a repository could
be modified concurrently if two recipes checked out two different
SRCREVs or modules from it in parallel. This caused errors like the
following:

ERROR: Fetcher failure: Fetch command failed with exit code 1, output:
svn: E155004: Run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
svn: E155004: Working copy '/home/foo/downloads/svn/repo/trunk' locked.
svn: E155004: '/home/foo/downloads/svn/repo/trunk' is already locked.

Fix it by adding a per-repository lock that's independent of the module
and SRCREV.

(Bitbake rev: 3f1f183a17bf3580da8a4ffd6dab30b62c2654a8)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@bmw.de>
Signed-off-by: Michael Ho <Michael.Ho@bmw.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-01 11:32:08 +00:00
Richard Purdie
c5ca140d38 bitbake: runqueue: Ensure disk monitor is started when no setscene tasks are run
Currently if there are no setscene tasks, the disk monitor isn't started.

Move the startup code to somewhere to ensure it always is started. This
issue would partially explain occasional selftest failures.

(Bitbake rev: 5ba83ee25c1c9cba349edb68a22476b1d5fca6ce)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-01 11:32:08 +00:00
Richard Purdie
3be7080d82 bitbake: server/process: Fix ConnectionRefusedError tracebacks
Improve connetion refused error handling:

NOTE: Retrying server connection...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/server/process.py", line 471, in connectProcessServer
    sock.connect(os.path.basename(sockname))
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
    server_connection = bb.server.process.connectProcessServer(sockname, featureset)
  File "/home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/server/process.py", line 502, in connectProcessServer
    os.close(i)
TypeError: an integer is required (got type NoneType)
)
WARNING: /home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/main.py:481: ResourceWarning: unclosed <socket.socket fd=14, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
  logger.info("Retrying server connection... (%s)" % traceback.format_exc())

(Bitbake rev: 6998fd816ceb0034c852a8fb994901fdf1975cfd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-01 11:32:08 +00:00
Richard Purdie
41d8955262 bitbake: fetch2: Avoid warning about incorrect character escaping in regex
Fixes:

lib/bb/fetch2/__init__.py:259: DeprecationWarning: invalid escape sequence \w
  re.compile("^\w+:(?!//)").match(uri):

(Bitbake rev: 2f0b6cea2be7e89ef01181b10899b3e7f11e8f20)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-27 22:15:34 +00:00
Richard Purdie
754976a116 bitbake: server/process: Show the last 60 log lines, not the last 10
10 log lines may not capture any full traceback, increase the number of
lines to 60 which covers most tracebacks.

(Bitbake rev: b8538c2088c199157404712a60a6740c926ce312)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-27 22:15:34 +00:00
Richard Purdie
1b04525d3f bitbake: server/process: Show last 60 lines of the log if the server didn't start
We're seeing issues where the server doesn't start with no logs as to why. Allow
the server to print the last 60 log lines just in case this shows us something useful
about what is failing.

(Bitbake rev: c8c80b404e38fe96f65d6314cd95f4069319f3d6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-27 22:15:34 +00:00
Ross Burton
3786729785 bitbake: fetch: don't use shell=True when listing ar files
(Bitbake rev: 7414b3537e8adfb41a9581d70bf8296c4f7d38c0)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-23 16:10:37 +00:00
Richard Purdie
0c5e19c96d bitbake: tests/fetch: Update after recent gitsm message changes
Also use assetIn instead of assertTrue which aids debugging failures.

(Bitbake rev: 19dee675bb9ad012d28e1e57a888931355a831cb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22 12:01:59 +00:00
Christopher Larson
e3e88600ce bitbake: fetch/git: fix AttributeError in shallow extraction logic
This code checks to see if shallow is either disabled or the tarball is
missing, but the else block tries to print the tarball filename, and
this attribute doesn't exist at all when shallow is disabled. Handle the
two cases separately to give sane errors for both cases without the
exception:

    Exception: AttributeError: 'FetchData' object has no attribute 'fullshallow'

(Bitbake rev: bdbb558342ebb4e64384c9838d2485d9299d91a6)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22 10:45:14 +00:00
Alejandro Enedino Hernandez Samaniego
d9175f3748 bitbake: cooker: Fix multiconfig dependencies
When multiconfig is enabled the cooker adds providers
for all the targets to be built on all the multiconfig
variables that were set, regardless if there is a dependency
to it or not.

This causes an issue when a certain target is incompatible
with one or more of the multiconfigs, e.g. the target is not
in COMPATIBLE_MACHINE for one of the MACHINEs being built,
causing the cooker to error out since no providers can be
found for that certain target on that multiconfig.

This patch modifies the behavior to only look for PROVIDERS
for a target on the multiconfig that was selected to be built,
PROVIDERS are then looked for in other multiconfigs only when
there is a defined dependency to them.

[YOCTO #12985]

(Bitbake rev: f2106a3a767542359fdde238abcf5fe35ab3a144)

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22 10:45:14 +00:00
Parthiban Nallathambi
83b587e77b bitbake: fetch2/npm.py: Allow shrinkwrap resolved relative URL which startswith 'http' (e.g http-proxy)
shrinkwrap resolved relative URL can start with http. For example,
"resolved: http-proxy/-/http-proxy-${PV}.tgz" is still relative URL
to npm registry, but starts with http.

Current if statement compares the startswith 'resolved' to 'http',
which makes impossible to use npm download. Condtional comparison
now strictly checks for "http://" and "https://"

(Bitbake rev: f76075aa1a5159fd4d62949cb588346888b9fe60)

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-21 11:54:47 +00:00
Robert Yang
6ac5723769 bitbake: BBHandler: Fix __python_func_regexp__ for comment lines
Fixed:
- Add a comment in base.bbclass:
  def oe_import(d):
      import sys
  # Comment
      bbpath = d.getVar("BBPATH").split(":")
  [snip]

  Note, '# Comment' is started with '#', it is legal in python's syntax
  (though maybe not a good style), but bitbake reported errors:

  $ bitbake -p
  ERROR: ParseError at /path/to/base.bbclass:20: unparsed line: '    bbpath = d.getVar("BBPATH").split(":")'

  This error report would mislead people, the real problem is that '# Comment'
  is not supported, but it reports the next line, this may make it hard to debug
  the code are complicated.

We can make __python_func_regexp__ handle '^#' to fix the problem, since it
already can handle blank line "^$" in a python function, so it would be pretty
safe to handle "^#" as well.

(Bitbake rev: 79e62eef1c93f742bf71e9f25db57fdd2ffedd02)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:25 +00:00
Robert Yang
5a485dc014 bitbake: server/process: print a message when no logfile
[YOCTO #12898]

There might be no bitbake-cookerdaemon.log, print a message for debugging.

(Bitbake rev: 4adc582d2df7fdb9e51c4ebb5e66bbd21165b4dc)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:25 +00:00
Robert Yang
6b761940fe bitbake: data_smart: fix filename for compile()
Fixed:
Add the following two lines to conf/local.conf:
FOO = "${@foo = 5}"
HOSTTOOLS += "${FOO}"

* Before the patch
  $ bitbake -p
  Check the first lines of bitbake bitbake-cookerdaemon.log
  [snip]
  File "/buildarea1/lyang1/poky/bitbake/lib/bb/data_smart.py", line 125, in python_sub
    codeobj = compile(code.strip(), self.varname or "<expansion>", "eval")
  File "FOO", line 1
  [snip]

  There isn't a file named 'FOO', but a variable name.

* After the patch
  $ bitbake -p
  [snip]
  File "/buildarea1/lyang1/poky/bitbake/lib/bb/data_smart.py", line 129, in python_sub
    codeobj = compile(code.strip(), varname, "eval")
  File "Var <FOO>", line 1
    foo = 5

(Bitbake rev: 540b546be55e0f5f5d91695956da3a7732b2f90a)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:25 +00:00
Robert Yang
4a5062302b bitbake: data_smart: Add original traceback to ExpansionError
This can make it print clearer errors, for exmaple:

Add Runtime_error to 'def oe_import(d)"

 16 def oe_import(d):
 17     import sys
 18     Runtime_error
[snip]

* Before the patch:
  $ bitbake -p
  ERROR: Unable to parse /buildarea1/lyang1/poky/bitbake/lib/bb/data_smart.py
  Traceback (most recent call last):
    File "/buildarea1/lyang1/poky/bitbake/lib/bb/data_smart.py", line 430, in DataSmart.expandWithRefs(s='${@oe_import(d)}', varname='OE_IMPORTED[:=]'):
                   except Exception as exc:
      >                raise ExpansionError(varname, s, exc) from exc

  bb.data_smart.ExpansionError: Failure expanding variable OE_IMPORTED[:=], expression was ${@oe_import(d)} which triggered exception NameError: name 'Runtime_error' is not defined

  This error message has two problems:
  - "Unable to parse data_smart.py": This isn't the real cause.
  - It pionts to "raise ExpansionError(varname, s, exc) from exc" which isn't clear enough.

* After the patch:
  $ bitbake -p
  ERROR: Unable to parse OE_IMPORTED[:=]
  Traceback (most recent call last):
    File "OE_IMPORTED[:=]", line 1, in <module>
    File "/buildarea1/lyang1/poky/meta/classes/base.bbclass", line 18, in oe_import(d=<bb.data_smart.DataSmart object at 0x7f9257e7a0b8>):
           import sys
      >    Runtime_error

  bb.data_smart.ExpansionError: Failure expanding variable OE_IMPORTED[:=], expression was ${@oe_import(d)} which triggered exception NameError: name 'Runtime_error' is not defined

This one is more clearer than before.

(Bitbake rev: c0fe524c1aeccb24ddd2e1f7bf235c00fdbf79a7)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:25 +00:00
Robert Yang
c1f46c5064 bitbake: parse/ast: fix line number for anonymous function
Fixed:
- Define an error anonymous function in base.bbclass:
  15
  16 python() {
  17     Compile error
  18 }

  $ bitbake -p
  ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 18:

  The code lines resulting in this error were:
       0001:def __anon_18__buildarea1_lyang1_poky_meta_classes_base_bbclass(d):
   *** 0002:    Compile error
       0003:
  SyntaxError: invalid syntax (base.bbclass, line 18)

  The lineno should be 17, but it reported 18, this would mislead people a lot
  when there more lines.

- Now fix it to:
  ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 17:

  The code lines resulting in this error were:
       0001:def __anon_18__buildarea1_lyang1_poky_meta_classes_base_bbclass(d):
   *** 0002:    Compile error
       0003:
  SyntaxError: invalid syntax (base.bbclass, line 17)

This is because the anonymous function is constructed by:
text = "def %s(d):\n" % (funcname) + text

The len(self.body) doesn't include the "def " line, the length of the function
should be "len(self.body) + 1", so we need pass "self.lineno - (len(self.body) + 1)"
which is the same as 'self.lineno - len(self.body) - 1' to
bb.methodpool.insert_method() as we already had done to named function. Otherwise, the
lineno is wrong, and would cause other problems such as report which line is
wrong, but the line is not what we want since it reports incorrect line.

(Bitbake rev: 7466c8765fcc792e5ea3daefda3c5895e782d6c4)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:25 +00:00
Robert Yang
3de56327b2 bitbake: utils: better_compile(): Fix line number when report errors
Fixed:
- Add an error line in base.bbclass, e.g.:
  15
  16 def oe_import(d):
  17     import sys
  18     Compile error
  19     bbpath = d.getVar("BBPATH").split(":")
  [snip]

  Note the "Compile error" line, I added it for reporting errors.

  $ bitbake -p
  ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 15:

  The code lines resulting in this error were:
       0014:    import oe.data
       0015:    for toimport in oe.data.typed_value("OE_IMPORTS", d):
       0016:        imported = __import__(toimport)
       0017:        inject(toimport.split(".", 1)[0], imported)
   *** 0018:
       0019:    return ""
       0020:
  SyntaxError: invalid syntax (base.bbclass, line 18)

  There are 2 problems:
  - The "line 15" is incorrect, it is a blank line, not the error line.
  - The "*** 0018" points to incorrect position.

  These two problems would mislead people a lot sometimes.

- Now fix it to:
  $ bitbake -p
  ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 18:

  The code lines resulting in this error were:
       0001:def oe_import(d):
       0002:    import sys
   *** 0003:    Compile error
       0004:    bbpath = d.getVar("BBPATH").split(":")
                [snip]
  SyntaxError: invalid syntax (base.bbclass, line 18)

Please see comments in the code for more details on how it is fixed.

(Bitbake rev: bbb3d87d171da38fd8e9bce011d109fba28a75c0)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:24 +00:00
Peter Kjellerstedt
07e1a65f07 bitbake: siggen: Adapt colors used by bitbake-diffsigs to support light themes
The colors specified for use with bitbake-diffsigs were adapted for a
dark theme, e.g., by setting the background color to black, which made
it look very bad when used with a light theme.

To make it look good both with a dark or a light theme, it is better
to drop the background color. It is also better to leave out the color
altogether for the title and just use bold. Finally, dropping bold for
the red and green texts indicating removed/added values better matches
other colorized diff implementations as, e.g., git diff.

(Bitbake rev: f1a2c23520832ee91e85338c1ad8af1fec0d0b19)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-19 17:03:24 +00:00
Richard Purdie
490bca81c3 bitbake: utils: Avoid regex value escape warnings
Avoid warnings such as:
bitbake/lib/bb/utils.py:72: DeprecationWarning: invalid escape sequence \d
  numeric_regexp = re.compile('^(\d+)(.*)$')
bitbake/lib/bb/utils.py:1165: DeprecationWarning: invalid escape sequence \(
  var_res[var] = re.compile('^(%s%s)[ \\t]*\([ \\t]*\)[ \\t]*{' % (var[:-2].rstrip(), override_re))

(Bitbake rev: bbf3cbae775383265292a778cd522d4e2f69a3a0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-14 11:18:18 +00:00
Richard Purdie
54bbe35eab bitbake: utils: Avoid warnings about deprecated imp module
The imp module is deprecated, port the code over to use importlib.

bitbake/lib/bb/utils.py:30: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

(Bitbake rev: 3c2cb35588e91fbd7b136e5e2c78eeb77e126c84)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-14 11:18:18 +00:00
Richard Purdie
57e290371b bitbake: lib/bb/server: Avoid UnboundLocalError traceback
Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
    server_connection = bb.server.process.connectProcessServer(sockname, featureset)
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/server/process.py", line 490, in connectProcessServer
    if command_chan_recv:
UnboundLocalError: local variable 'command_chan_recv' referenced before assignment

(Bitbake rev: ad79fadd855f5c10242ed17e9e0f3eb0274f26d2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-14 11:18:18 +00:00
Richard Purdie
0814e48a08 bitbake: server/process: Fix unclosed socket warnings upon server connection refused
Extend the server error handling to avoid:

Reconnecting to bitbake server...
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
    server_connection = bb.server.process.connectProcessServer(sockname, featureset)
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/server/process.py", line 457, in connectProcessServer
    sock.connect(os.path.basename(sockname))
ConnectionRefusedError: [Errno 111] Connection refused
)
WARNING: /home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py:481: ResourceWarning: unclosed <socket.socket fd=20, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
  logger.info("Retrying server connection... (%s)" % traceback.format_exc())

NOTE: Starting bitbake server...

(Bitbake rev: afee3f594e1510051a0b18e430e92549caf72fa2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-07 23:08:55 +00:00
Mike Crowe
b8e08c6519 bitbake: siggen: Correct format argument substitution
Use % operator to ensure that the dependency is substituted into the error
message correctly.

(Bitbake rev: 8e587386b0b3a0ed11edf71dfbe9fb508f60d0b3)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-07 23:08:55 +00:00
Mike Crowe
b322b69a97 bitbake: fetch: Also export GIT_SSH environment variable
Support users who want to specify a custom ssh to Git using an environment
variable. (This lets build systems work without requiring users to
configure Git explicitly.)

(Bitbake rev: db46fb2755a4b1033ab60051ce511cc9dd7e34fb)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-07 23:08:55 +00:00
Mark Hatle
a042179a78 bitbake: fetch2/gitsm.py: Fix the references when the module and path are different
Git does not require the module and target path to be the same in the
.gitmodules file.  This incorrect assumption was being made previously
causing various unpack failures.

An example .gitmodule showing this issue:

   [submodule "plugins/WaveShaper/Libs/inih"]
        path = plugins/wolf-shaper/Libs/inih
        url = https://github.com/pdesaulniers/inih.git

The unpack function also needed to work in a loop on the overall
submodules_queue.  Before it could have missed items that were not in the
primary repository.

(Bitbake rev: 5a7009c204f4d2254e3b2d83ad9319ac23f1cf4d)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-07 23:08:55 +00:00
Mark Hatle
a28637abbc bitbake: fetch2/gitsm.py: Disable branch checking on submodules
Submodules by definition refer to a specific commit, not branch.  If we don't
ignore the branch, then any commits on a submodule on a branch different then
the original module will trigger a failure that the commit is not on the
branch.

(Bitbake rev: fdc1dbf96f153b496de52acd8263366a1ff303ad)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-07 23:08:55 +00:00
Richard Purdie
787485cda8 bitbake: bitbake: Bump version to 1.40.0
(Bitbake rev: 2820e7aab2203fc6cf7127e433a80b7d13ba75e0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-20 14:27:03 +01:00
Richard Purdie
a9dc2ac9e0 bitbake: data_smart: Fix removal handling interaction issue with overrides
If a variable has a _remove applied to it but that variable is in turn
'renamed' through OVERRIDES, the removal gets lost with the current code.

TEST = "foo"
TEST_someval = "bar"
TEST_someval_remove = "bar"
OVERRIDES = "someval"

currently gives "bar" for TEST but should give "".

This fixes the code to track the removal and adds a test case to ensure this
doesn't regress again.

(Bitbake rev: 8f55010c18057be040f073d8bcb4c5c2c311d809)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-20 14:27:03 +01:00
Richard Purdie
4ef016683d bitbake: test/data: Add new tests for task checksum changing/not changing
This adds some basic tests for task checksums to ensure that the
checksums:

* change when variables change
* change when active _remove operators are present
* don't change when the _remove operators are not active
* change when an active contains() expression is present
* dont' change a contains() expression isn't active

There is a lot of other functionality which should be added to this
test but its a start.

(Bitbake rev: 5463c16e3619d324aed137f47f93f0997a227d29)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Richard Purdie
7e92127128 bitbake: data/siggen: Extract task hash generation code into a function
By creating a standalone function, we can add better functional testing
of this code.

(Bitbake rev: 796a20d24dc18479de1975a37b9e52a5ac75c73f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Richard Purdie
f7f5e30667 bitbake: bitbake: data: Ensure task checksums account for remove data
Currently remove operations are not being accounted for in the task
checksums. This is a fairly serious oversight and needs to be fixed.

To do so, we need internal data from getVarFlag combined with the
expanded variable data so that only "active" remove operators are
accounted for in the task checksum. We can get this from the new
optional removes attribute in the returned parser object.

The code can then use the data on active remove operators to account
for the removals in task checksum but only when the removal is active.

We have to be careful here not to reference any expanded data since this
may for example contain build paths. This means we can only map back
and reference the unsplit (and hence unexpanded) remove string which may
expand to multiple removal values.

[YOCTO #12913]

(Bitbake rev: 57d2ee17ae83a139a37081eb082e6184fa883581)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Richard Purdie
9248bc1c53 bitbake: data/data_smart: Allow getVarFlag to return the variable parser object
(Bitbake rev: 136100dc932c9019737f927d826955425134010f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Richard Purdie
f5181b36d6 bitbake: data_smart: Fix expand_cache and _remove operator interaction issues
The contents of the expand_cache is meant to match the return value of
getVarFlag() but the implementation was mostly in expandWithRefs(). If
an incorrect key was passed to expandWithRefs(), or a variable was only
partially expanded with no remove processing, the cache could become
corrupted.

Move the code to getVarFlag making the data lifecycle very clear, meaning
other calls to expandWithRefs() cannot corrupt the cache.

The expand_cache reset code needs to be moved ahead of any remote data
connectors too, since the expand_cache is now on the local side of the
connection.

(Bitbake rev: a039052f9b680eae53f3f12b7381b945f1d69253)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Richard Purdie
58e3f45d4b bitbake: data_smart: Micro optimise _remove handling
This brings _remove handling into line with _append/_prepend with regard
to the parsing flag to getVarFlag.

This is an internal flag and the only times this is used is through getVar
during renameVar operations and when processing ?= operations to see if
a variable is set. In either case we don't need to process remove operations.

Therefore take the minor speedup and skip processing for parsing=True.

[YOCTO #10945]

(Bitbake rev: 6d19eb3226b59922c0f888e33b28443635151501)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Richard Purdie
24139e27c6 bitbake: fetch2: Avoid incorrect getVarFlag call
Calling getVarFlag with flag=None makes no sense, don't do it. Bitbake
used to silently ignore this, it now warns so avoid the warning.

(Bitbake rev: a68de8ace62eaba23856bfb301efbbe1824322aa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Urs Fässler
a8a077cafb bitbake: fetch2/git: provide information about missing sources
Provide more information in the case the sources are not found in the
unpack step.

(Bitbake rev: 27a2214bf6f2e7c61bfc422a20959a55f7e0d25d)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:27 +01:00
Urs Fässler
8553b2c111 bitbake: fetch2/git: explicitly show the decision logic to select the source in code
(Bitbake rev: 78d8fb3a7899e1404a513be1c2b2b4440da8b12d)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Urs Fässler
0d4fe0602e bitbake: fetch2/git: prevent access to non-existing clonedir
A user friendly error is throw when neither the clonedir nor
fullshallow exist. Without the check, a difficult to interpret error
is throw from within the fetch command.

(Bitbake rev: 30cf2506007d25162f0805051212f54c39034ff3)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Urs Fässler
49f25eceeb bitbake: fetch2: extract the function which ensures that a valid symlink exists
For better readability and future use, we extract the function which
ensures that a given symlink exists.

(Bitbake rev: 5e69ca56533666a097bb23d09ab673e5c862051c)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Urs Fässler
9a058e4421 bitbake: fetch2/git: use intention revealing names for premirror tests
(Bitbake rev: 3434e64e7c077c1ecff7b36f02b6c6b59a7d1fe9)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Urs Fässler
36fcd5eda9 bitbake: fetch2/git: add tests to capture existing behavior wrt. naming of git shallow tarball
The mapping of the URLs to the local shallow tarballs is not obvious. For
easier understanding, we add this tests to explicitly showing the mapping.

(Bitbake rev: 05f2ac8e19a027d103921b5ae0070db609a83042)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Urs Fässler
b6a972922b bitbake: fetch2/git: add tests to capture existing behavior wrt. naming of mirror tarball
The mapping of the URLs to the local tarballs is not obvious. For easier
understanding, we add this tests to explicitly showing the mapping.

(Bitbake rev: c604d9402b4c9ad7eb5c794ab24f2f348d9719a9)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Urs Fässler
ffac9c20f5 bitbake: fetch2/git: add tests to capture existing behavior wrt. naming of clone directories
The mapping of the URLs to the local directory is not obvious. For easier
understanding, we add this tests to explicitly showing the mapping.

(Bitbake rev: 5f92682389fee437d6df2ff7718c571b7444e179)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Peter Marko
212cbc0382 bitbake: fetch2: avoid circular recursion with SRCPV in PR
Some recent changes broke SRCPV and workaround was introduced
to avoid circular dependency if SRCPV is in PV.
However there is still the same error if SRCPV is in PR.

(Bitbake rev: 05ee4845f925b8528a7ce9cffb4bae425b8fa1e9)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Tobias Olausson
f2a6f6e80e bitbake: taskexp: add focused search bar
Searching in the task explorer requires one to focus the task list. A
readily visible and focused search bar makes searching intuitive.

(Bitbake rev: 43f8a23d56995f552f98a666e86b6cc124e235a4)

Signed-off-by: Tobias Olausson <tol@hms.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Richard Purdie
a9aa1d24c7 bitbake: data: Fix whitespace on _remove operations
We have some slightly odd behaviours with the current implementation of
_remove operations. For example:

TEST = " A B"
TEST_remove = "C"

would trigger TEST to become "A B" even thought it doesn't contain "C".

In particular, this means that an inactive remove operator added in a
bbappend could change the task checksum which is not desireable.

Fix the operation to preserve whitespace, adding new tests to make this
explict and test further corner cases. Also update the manual to match.

(Bitbake rev: c0a23dd9155c50a6b7df796980bc7b612cac7994)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Richard Purdie
58530c6e48 bitbake: data_smart: Preserve history when renaming variables
Currently when a variable is renamed, all the variable history is lost.
This makes it hard for users to understand/debug where values came from.

Improve the code so that history is preserved across renamed variables.

(Expanded variable key names are a special case of variable renaming)

(Bitbake rev: 11722c989077a8751a5d0653c523760bf91e6efa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18 10:59:26 +01:00
Richard Purdie
4806d53304 bitbake: main: Fix environment handling for UI module imports
The environment was being cleared before the UI imports occurred which
caused problems for graphical UIs like taskexp. The full environment was
intended to be available to UI clients and it was only meant to be cleared
for the server/cooker, so tweak the code order so this is the case.

This fixes problems reported for taskexp.

[YOCTO #12670]

(Bitbake rev: ac15028391fdcc3fec2dd0e64a4f763ce63e5449)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-10 12:47:48 +01:00
Mark Hatle
8c3db8cb9e bitbake: gitsm: Allow relative URIs when fetching
Some repositories may specify a relative submodule path.  If this happens,
it is our responsibility to use the parents URL (ud) and handle any relative
processing ourselves.

(Bitbake rev: fd9893c338df7828b2c01f1d548aa86dfcf7c50a)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Laurent Bonnans
41e6a3efac bitbake: fetch2/gitsm: checkout submodules recursively
The new fetcher did not run 'git submodule update' recursively.

(Bitbake rev: 377ed943357b6d47d41d84edbf971741f44affa9)

Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Laurent Bonnans
c888446d12 bitbake: fetch2/gitsm: handle submodules nested inside subdirs
The new gitsm fetcher assumed that submodules were living directly in
the 'modules' directory, whereas they can be arbitrarily nested inside
subdirectories.

Solve it by first creating the parent of the destination directory for
the symlink and copy steps.

(Bitbake rev: 3dbc84e9c572f43209b79f3656d7dc35a6d982ba)

Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
David Reyna
50432746fe bitbake: toaster: error logs missing for cli builds
The method 'store_log_event' in 'buildinfohelper.py' always puts log
messages from CLI builds into the backlog but never takes them out.
The "close" method now forces all backlogged CLI events to be registered.

[YOCTO #12813]

(Bitbake rev: 6458cc4234337f551dfe189b6f8800d8da886c24)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Laurent Bonnans
ccfb160ed6 bitbake: fetch2/gitsm: fix a typo
'qbareclone' in place of 'bareclone'

(Bitbake rev: 90a3181f1397ae05862f4e89a9bbac606e74504e)

Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Urs Fässler
82f32d99f7 bitbake: fetch2/git: use correct check to decide if the shallow tarball should be unpacked
The shallow_tarball check is never true due a check on the caller side.
The tarball check is not related to the code on the caller side.

(Bitbake rev: 086eddcf8c7520ff5c52ce2a11ca9bf5b5fe5d7e)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Urs Fässler
b907303b92 bitbake: fetch2/git: prevent access to non-existing fullshallow tarball
(Bitbake rev: b7f00a8c11672a2ee0408e210fb174cda3384e3f)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Urs Fässler
073c62cb56 bitbake: fetch2/git: improve readability of method need_update
To improve the readability we extract the different scenarios of why
the clonedir needs an update.

(Bitbake rev: 9038e029f4f0ab413727de76c74248cbb3cdc9ea)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 23:00:24 +01:00
Ross Burton
9a47c067a6 bitbake: test/fetch: use canonical GitLab URLs
GitLab returns a redirect from /foo to /foo.git which older releases of Git
don't handle when cloning.  These tests don't clone so the redirect works, but
let's be consistant with the structure of these URLs and add the .git suffix.

(Bitbake rev: d47febbae4ff24be259037f12bafbc14b9e2d6a8)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 14:22:00 +01:00
Mark Hatle
5cd00e3e53 bitbake: fetch2/gitsm.py: Rework the git submodule fetcher
The prior fetcher did not know how to work with MIRRORS, and did not
honor BB_NO_NETWORK and similar.

The new fetcher approach recursively calls 'gitsm' download on each
submodule detected.  This ensures that it will go throug the
standard download process.

Each downloaded submodule is then 'attached' to the original download in
the 'modules' directory.  This mimics the behavior of:

    git submodule init

but there is no chance it will contact the network without permission.

It then corrects upstream reference URIs.

The unpack steps simply copies the items from the downloads to the destdir.
Once copied the submodules are connected and we then run:

    git submodule update

According to the git documentation, git submodule init can and will modify
the project configuration and may connect to the network.  Doing the
work manually prevents this.  (This manual process is allowed based
on my reading of the documentation.)

See: https://git-scm.com/book/en/v2/Git-Tools-Submodules

The small change to the existing test is due to this new code always assuming
the code is from a remote system, and not a 'local' repository.  If this
assumption proves to be incorrect -- code will need to be added to deal
with local repositories without an upstream URI.

(Bitbake rev: 9c6b39adf9781fa6745f48913a97c859fa37eb5b)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-26 15:14:33 +01:00
Mark Hatle
5fae3cb56e bitbake: lib/bb/tests/parse.py: Test case was changing chdir
The test case was changing the current directory, but was never restoring it
to the original location.  This causes occasional failures in later test cases.

(Bitbake rev: 8c222c45148d1f21c2390d66ddd9d3e33b397f05)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-26 15:14:33 +01:00
Ioan-Adrian Ratiu
9d0cad1ae1 bitbake: utils: lockfile: Fix infinite loop
A nasty corner case leads to a hang when utils.lockfile is called from
oe-core's package-manager:deploy_dir_lock (in turn called from
rootfs:_create further up the call stack) with "name" owned by root
and the user running bitbake has no write access.

Because this code runs under pseudo, the UID and EUID of the bitbake
worker process are 0, so the os.access(dirname, os.W_OK) returns True
i.e. it thinks the path is writable when in fact it's not writable.

Only later when trying to open the file an Exception it thrown because
the OS prohibits writing, but the Exception is ignored and the open is
retried leading to an infinite loop.

So this fix is to not ignore the "Permission Denied" exception.

An alternative fix would be to replace the os.access() call with an
try: open() except() at the beginning of the function.

(Bitbake rev: 0cb64d0f85b41b2fa764baf6ff7ea1b13f95004e)

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-25 23:16:21 +01:00
Richard Purdie
c942230eee bitbake: daemonize/build: Clean up /dev/null fd handling
At the end of bitbake selftest we see:

sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='r+' encoding='UTF-8'>

Clean up the /dev/null handling to drop the unused entry in build.by and
ensure the other open() calls are cleaned up.

NULL was unused since http://git.yoctoproject.org/cgit.cgi/poky/commit/bitbake/lib/bb/build.py?id=4a081b5a52e3d27da8d4b062f3fda292e8d8fb0a
back in 2012.

(Bitbake rev: e72be96cfa9f05fda5f420c7cfa8bcfa9304b884)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-22 15:52:12 -07:00
Richard Purdie
7be6abc98d bitbake: COW: Fix StopIteration warning
Fix the warning:

WARNING: lib/bb/data_smart.py:235: DeprecationWarning: generator 'COWDictMeta.iter' raised StopIteration
  for k, v in self.variables.iteritems():

by using return from the generator, not raising StopIteration.

(Bitbake rev: 407d6e07b09123c12c382b4a92107f002c314b05)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-22 15:52:12 -07:00
Richard Purdie
530aceebc1 bitbake: runqueue: Ensure setscene tasks that aren't covered get built
Running "bitbake gconf-native -c cleansstate; bitbake core-image-sato:do_populate_sdk"

results in a build where it fails to find gconf-native and fails to build it,
merrily trying to build the SDK without gconf being present.

The issue is the missing setscene tasks are effectively ignored as the later
code in runqueue thinks that since other sstate tasks are present, these
'cover' the missing one. In reality we need to call BB_SETSCENE_DEPVALID
to make that decision. To do that we need a "reduced" setscene dependency
graph which we don't have in main task graph context.

Since that was already done in setscene, we should just assume anything
in the non-covered list needs to be built.

(Bitbake rev: 464d0339add15bc8b4344ddd1e4c49706e3c0a02)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-10 12:13:38 +01:00
Richard Purdie
479a059c96 bitbake: cooker/runqueue: Turn universe warnings into verbnotes
If the user puts universe on the commandline, they don't really want warnings
so use the new verbnote level instead.

(Bitbake rev: 0c87ade5678e503899e3a6cdda5329f6fc212b63)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-10 12:13:38 +01:00
Richard Purdie
78d517e410 bitbake: msg: Add explicit verbnote log level
It has become apparant we need a log level which reaches the console but
isn't a warning/error. Add "verbnote" as a way of doing this, behaves as
a note but with a higher priority.

(Bitbake rev: 2076f12cc2f809345108b1606bd6201f41287505)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-10 12:13:38 +01:00
Richard Purdie
74feaddda3 bitbake: server/process: Various server startup logging fixes
There were various problems in the server startup loggin:

a) stdout/stderr were not being flushed before forking which could potentially
   duplicate output

b) there were separate buffers for stdout/stderr leading to confusing logs
   where the entries could be reordered. This was particularly confusing
   due to the separator the logs use to idendify new messages

c) an fd wasn't being closed during server startup meaning if the
   server failed to start, the closed fd wasn't detected as it was held
   open by the other reference

d) If the pipe was detected as being closed, the code incorrectly retried
   server startup

e) The event code would remap stdout/stderr without flushing them, leading
   to lose log messages

(Bitbake rev: 0594faa0b52ce5dbd948d836d88617d38d9862d1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-05 18:01:37 +01:00
Mark Hatle
b7e26bedc2 bitbake: cooker.py: Fix incorrect bb files matched warning
In the case of a sublayer of an existing layer, where the sublayer and
main layer share a path, the system may not match the paths properly resulting
in:

    No bb files matched BBFILE_PATTERN_sublayer '^/path/main/sublayer'

because it has already matched the main layer.

Fix this issue by sorting the collection items based on the pattern, using
longest to shortest.  Obviously regex wildcards could still be an issue
but these are typically not used, so this simply fix should work in the
existing cases.

(Bitbake rev: 1787cef7221b88f6920ea70fadaffc117d84c7aa)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-05 18:01:37 +01:00
Richard Purdie
4434777705 bitbake: tests/fetch: Update gnome.org urls after upstream changes
(Bitbake rev: 43ff74d675baed13fc17e1d12c0e013b16ba249b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-29 10:43:23 +01:00
Paulo Neves
a8368651ff bitbake: fetcher: Fixed remote removal not throwing exception.
Before this fix it is assumed that the removal of the
remote can only fail because there is not remote to remove. This
is a false assumption. Example error which would be ignored:

git -c core.fsyncobjectfiles=0 remote rm origin failed with exit code 1, output:
Note: A branch outside the refs/remotes/ hierarchy was not removed;
to delete it, use:
  git branch -d master
error: could not lock config file config
error: Could not remove config section 'remote.origin'

Due to the masking of this error a stranger error will be
presented to the user, because this time we do not mask the
exception:

git -c core.fsyncobjectfiles=0 remote add --mirror=fetch origin https://github.com/ptsneves/tl-wn722.git failed with exit code 128, output:
fatal: remote origin already exists.

The most likely reason that the remote cannot be removed nor
modified is that the DL_DIR/git2 does not have permissions
compatible with the user running bitbake.

This commit fixes:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12728

(Bitbake rev: 9c86c582a10c9b23abad7d34b6cbf12f7086294d)

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-28 10:32:08 +01:00
Paul Eggleton
87d3a9685d bitbake: parse/ast: ensure saved event handlers really do get restored
In finalize() we save event handlers, register the ones relevant to the
recipe being finalised, trigger events, and then restore the handlers so
that one recipe's custom handlers (actually implemented within a class
inherited by the recipe) do not affect other recipes. However, if an
exception occurs during parsing, the saved handlers were not being
restored. Use a try...finally block to ensure that the handlers are
always restored.

This issue became apparent since in OpenEmbedded-Core we have recently
introduced a find_intercepts() handler for the
bb.event.RecipePreFinalise event in image-postinst-intercepts.bbclass
that images and old-style SDK recipes will end up inheriting. So far it
doesn't seem that the the error has manifested itself in normal builds,
but when parsing OE-Core recipes in the OE layer index it has:
core-image-rt-* image recipes were parsed which in the default
configuration raise SkipRecipe. The next non-image recipe that is parsed
will trigger a real exception, because the find_intercepts() handler is
still registered and gets fired, but in the context of the new recipe
the POSTINST_INTERCEPTS_PATHS variable is not set, and the code in
find_intercepts() is written with the reasonable assumption that that
isn't possible given that the class itself sets a default, and thus it
fails.

(Bitbake rev: e5f1f8fa201774e0c3c554d59b277baa2128708f)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-24 07:53:14 +01:00
Richard Purdie
d2ef693c9a bitbake: bitbake: Bump version 1.39.0 -> 1.39.1
(Bitbake rev: 49c3fd2489867c09dec6919a25b53d935a8204bb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23 09:02:54 +01:00
Joshua Watt
cbe2d3cb0a bitbake: daemonize: Flush stdio on exit
In spite of a comment suggesting otherwise, os._exit() does not flush
buffered output from file descriptors before exiting the process like
os.exit() does. This means that any un-flushed output is lost in the
daemon process, in particular the traceback from any thrown exceptions,
making debugging exceptions in the daemon quite difficult.

The solution is to flush stdout and stderr before exiting.

(Bitbake rev: fcc8e1ff53696f78dd64b4ee32f3c433b7a47df0)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23 08:50:23 +01:00
Rasmus Villemoes
d4011ce0a3 bitbake: bb/utils.py: add break_hardlinks helper
bb.utils.copyfile is called in a few places with identical src and dst
in order to create an st_nlinks==1 version of the file. That that even
works relies on an implementation detail of copyfile (namely, that it
creates a temporary file and then does a rename). Moreover, it's a waste
of time if the file already has st_nlinks==1.

So create a helper that optimizes away the copy in the st_nlinks==1
case. Of course, this helper relies on the same implementation detail,
but that's now contained within bb.utils itself.

To test that we do at least sometimes hit the no-copy path, I tested
locally with

     if sstat[stat.ST_NLINK] == 1:
+        bb.note("Woohoo, 2*%d bytes I/O avoided" % sstat[stat.ST_SIZE])
         return True

(and the obvious places in oe-core patched), and the do_package log files
are indeed filled with woohoo notes.

(Bitbake rev: 7ae93cf40ab91965147055100432961436bce46c)

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-16 09:50:42 +01:00
Andreas Müller
331463011f bitbake: runqueue: Move decision if a task can be started to one common place
(Bitbake rev: 99d9e4389e1f1d78d17a23ee078fe3f4a12cb31d)

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 21:45:58 +01:00
Ross Burton
beb93fff65 bitbake: utils/md5_file: don't iterate line-by-line
Opening a file in binary mode and iterating it seems like the simple solution
but will still break on newlines, which for binary files isn't really useful as
the size of the chunks could be huge or tiny.

Instead, let's be a bit more clever: we'll be MD5ing lots of files, but we don't
want to fill up memory: use mmap() to open the file and read the file in 8k
blocks.

(Bitbake rev: a0ac8d67f1471a0c611d691b856fede67efb53f6)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 09:45:02 +01:00
Ross Burton
63a4ff7cf5 bitbake: checksum: sanity check path when recursively checksumming
In case something goes tragically wrong, catch a request to checksum / and
refuse.

(Bitbake rev: e7cd4c86ef8a2c2bbf068e84c83fdc9e052b6e3d)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-14 16:32:48 +01:00
Kai Kang
5581b374b9 bitbake: event.py: fix typo
(Bitbake rev: d49483eb733ee27325349246fa37a84140c0941d)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-14 16:32:48 +01:00
Richard Purdie
dbda297fd9 bitbake: runqueue: Allow the hash validate function to have an idea of build completion
There is an oversight in the current hash validation API in that the
function can't know how many setscene tasks already completed. Rather
than trying to add additional parameters to the function, causing
incompatibilities, store the value in the datastore.

This is useful to allow build status reporting to the user for
figures on sstate reusage and build completion.

(Bitbake rev: ec037d3e49264037b81212f498d98e292ae7c334)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-08 10:52:00 +01:00
Alejandro Enedino Hernandez Samaniego
b8730f68d2 bitbake: bitbake: Add support for multiconfig dependencies
This patch adds the capability for tasks from different
multiconfigs to depend on one another.

These dependencies can be enabled using the following format:

task[mcdepends] = "multiconfig:FROM-MC:TO-MC:PN:task-to-depend-on"

For the sake of simplicity consider the following example:

Assuming we have set up multiconfig builds, one for qemux86 and one for
qemuarm, named x86 and arm respectively.

Adding the following line to an image recipe (core-image-sato):
do_image[mcdepends] = "multiconfig:x86:arm:core-image-minimal:do_rootfs"

Would state that core-image-sato:do_image from x86 will depend on
core-image-minimal:do_rootfs from arm so it can be executed.

This patch makes modifications to:
- cooker: To glue both multiconfigs in one place and make sure
  the dependencies can be provided.
- taskdata: To parse and add a new kind of dependency (mcdepends) to
  the taskdata object.
- runqueue: To differentiate tasks from different multiconfigs,
  add the specified dependencies to the corresponding tasks, and
  create a working runqueue that contains tasks from both multiconfigs.
- siggen: To avoid looking for tasks from different multiconfigs on
  objects where they dont belong.

The taskdata objects are still not aware of the concept of multiconfig,
so each object doesnt know which multiconfig its building, hence why
the mcdepends are added to all taskdata objects equally (we really
dont expect many of these), but the actual dependencies are added only
to the required tasks by the runqueue.

(Bitbake rev: da8cb8633504bdc815bdcefc538340b9bce5065d)

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-01 10:07:22 +01:00
Martin Jansa
9c419271b5 bitbake: codeparser: Track oe.utils.conditional usage
* base_conditional was already removed from oe-core:
  http://git.openembedded.org/openembedded-core/commit/?id=0391fcad9103abca0796a068f957d0df63ab4776
  after the usage was migrated to oe.utils.conditional:
  http://git.openembedded.org/openembedded-core/commit/?id=c97acbd034532895ce57c6717ed1b3ccc7900b0d
  so we can handle just ".conditional" version

* add 1st parameter to variable dependencies, that way when you use
  FOO = "${@oe.utils.conditional('VAR', 'VALUE', 'true', 'false')"
  FOO variable will have dependency on VAR variable and you don't need
  to add FOO[vardeps] += "VAR" manually every time you use
  oe.utils.conditional

* this is similar to contains tracking from:
  https://bugzilla.yoctoproject.org/show_bug.cgi?id=3890
  http://git.openembedded.org/bitbake/commit/?id=ed2d0a22a80299de0cfd377999950cf4b26c512e
  http://git.openembedded.org/bitbake/commit/?id=0b9d117631ce909312d53b93289e61defc6be01c
  but conditional is simpler, we don't need to handle the first
  parameter as a set

(Bitbake rev: 5156b4bb6876dac636be9726df22c8ee792714dd)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-30 12:45:15 +01:00
Paul Eggleton
6ed781e071 bitbake: utils: add optional callback to edit_bblayers_conf()
Add a callback that lets you modify or remove items in addition to the
current scheme where you can only add or remove. This enables you to for
example replace a layer with a temporary copy (which is what we will use
this for first in OE's oe-selftest).

(Bitbake rev: bfedb4e85a84e817dbe5d8694b8f8fcdd6f2f22a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-30 12:45:15 +01:00
Richard Purdie
d854f1b6dc bitbake: server/process: Always place the server logfile in the build directory
Currently the bitbake-cookerdaemon.log is placed into cwd. This seems like a
bad idea, we can place it in the build directory alongside the lockfile that
represents the server instead.

(Bitbake rev: 1620dbc48ffb2a882371cf9174a7b12648befc8a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-25 16:48:27 +01:00
Joshua Watt
9b034e9a83 bitbake: runqueue: Stop on first unsatisfied dependency
(Bitbake rev: 9876b5da1c65bf09a790542cb4057f2d93868cf7)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Joshua Watt
53d1027625 bitbake: runqueue: Remove unused variable
(Bitbake rev: 91e5540f53aca93e3489255cfd95feaa0afd0498)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Joshua Watt
6b66f22686 bitbake: siggen: Delete trailing whitespace
(Bitbake rev: b2fd783fa23403e8f08d998951b05bcabb458af1)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Joshua Watt
714f2f5bae bitbake: runqueue: Remove trailing whitespace
(Bitbake rev: 9b9aecbbb1a3fa67f7d3b1669186c9f4ced3a590)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 11:26:56 +01:00
Ming Liu
7cb125d7ee bitbake: runqueue.py: Fix a virtual class extension stamps issue
The file_name parameter passed to bb.parse.siggen.invalidate_task
should be a virtual file name instead of a real file name, or else you
will encounter a following error, for instance, when you run:

$ bitbake nativesdk-lzip -c unpack -f

the error arise:
| ERROR: An uncaught exception occurred in runqueue
| if file_name:
|    > taintfn = d.stamp[file_name] + '.' + task + '.taint'
| else:
| KeyError: 'virtual:nativesdk:/opt/poky/meta/recipes-extended/lzip/lzip_1.19.bb'

when multilib builds are used on OE.

(Bitbake rev: da37bdad46e11e7ce93ba7a59d58757b769dc16b)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-02 21:38:06 +01:00
Nikolai Merinov
070a06ec53 bitbake: fetch2: Use correct check in parameter handling in uri_replace()
If uri_find contain parameters then original URI parameters should
be checked against parameters from uri_find instead of parameters
from uri_replace.

(Bitbake rev: 8efa7826a61501589afa33eb698c0ab3a622bf2e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-21 09:34:40 +01:00
Mark Hatle
a0cb1021c0 bitbake: runqueue.py: Initial implementation of per task process limits
On high core machines, in do_fetch, it is possible to DDoS your own machine.
A method to limit any arbitrary task type to a certain number of simultaneous
threads is needed.  (Similar to how BB_NUMBER_THREADS works in the general
case.)  The format of this new limitation is:

    do_fetch[number_threads] = "2"

This should be set globally.  If it is set in individual recipes it could
result in unpredictable behavior.

Note: a value for number_threads > BB_NUMBER_THREADS will have no effect.

(Bitbake rev: 055865047c63b9c3b213b47a1884924ce0adeda0)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-15 17:57:30 +01:00
Mark Hatle
27101e647f bitbake: runqueue.py: Minor cleanup for RunQueueStats and users
The RunQueueStats:taskCompleted and RunQueueStats:taskSkipped can take
multiple arguments.  However, nowehere in bitbake are multiple arguments used.
Change this to match the behavior of the other APIs where it needs to be
called once for each task.

Additionally, these two functions were usually called in tandem, however in
the wrong order.  It really doesn't matter as there is no specific preemption
point between the calls.  But the taskSkipped should be called first to
increment the 'active' count, and then taskCompleted called to decrement it.

(Bitbake rev: 26d5ea9bb892bd6a2e1fd29a9023e0b0644edc16)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-15 17:57:30 +01:00
Andre McCurdy
7838294271 bitbake: fetch2: unify the way fetchers determine DL_DIR and FETCHCMD
Currently there is quite some variation between the fetchers in terms
of how they determine the subdirectory within DL_DIR and the base
fetch command to run. Some rely on variables being set externally
(e.g. from bitbake.conf in oe-core), some respect these external
variables but provide fallback defaults and some use only hardcoded
internal values. Try to unify the approach used across the various
fetchers.

(Bitbake rev: efd5e35af4b08501c67e8b30f30d9457f6fdf610)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-15 17:57:30 +01:00
Matt Hoosier
8ed0441be0 bitbake: fetch/gitsm: avoid live submodule fetching during unpack()
Although the submodules' histories have been fetched during the
do_fetch() phase, the mechanics used to clone the workdir copy
of the repo haven't been transferring the actual .git/modules
directory from the repo fetched into downloads/ during the
fetch task.

Fix that, and for good measure also explicitly tell Git to avoid
hitting the network during do_unpack() of the submodules.

[YOCTO #12739]

(Bitbake rev: 11b6a5d5c1b1bb0ce0c5bb3983610d13a3e8f84a)

Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-07 08:53:19 +01:00
Richard Purdie
1c7ad49bfd bitbake: bitbake: Update version to post release 1.39
(Bitbake rev: a6a4dd35e3fd112b9fac6fcefe61253a61b8aa2c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-06 13:35:15 +01:00
Tzu Hsiang Lin
719d068bde bitbake: fetch2: fix import error for Python 3.6.5
When running bitbake command with Python 3.6.5 always result in
import error causing by the change of distutils module.
This patch replaces the method to search executable in PATH by
"/usr/bin/env <command>".

(Bitbake rev: bd9a1b063633af2936ba1dd87b19202424900151)

Signed-off-by: Tzu Hsiang Lin <t9360341@ntut.org.tw>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-29 21:07:46 +01:00
Jakub Dębski
ef7222c6d1 bitbake: fetch2/__init__.py: Fixed handling of uris with empty path
For mirrors or premirrors defined like: "http://.*/.* http://somewhere.org"
fetching ends with errors because function fetch2/__init__.py:encodeurl()
creates url like "http://somewhere.orgsomefile.tar.gz".

It happens because function fetch2/__init__.py:decodeurl()
for url "http://somewhere.org" returns
['http', 'somewhere.org', '', '', '', {}]
and then in function fetch2/__init__.py:uri_replace()
variable result_decode will be
['http', 'somewhere.org', 'somefile.tar.gz', '', '', {}]
(because of line: result_decoded[loc] = os.path.join(result_decoded[loc], basename))
for which encodeurl returns "http://somewhere.orgsomefile.tar.gz".

In addition for mirror "http://.*/.* http://somewhere.org/"
everything works fine.

(Bitbake rev: d822ae24ef5485e550804cbd9130ebd73b2aa48e)

Signed-off-by: Jakub Dębski <jdebski@enigma.com.pl>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-22 13:13:19 +01:00
Andre McCurdy
b68ed05be6 bitbake: fetch/git: make fewer calls to _contains_ref() from download()
Updating a local git repo clone currently results in multiple calls
to self._contains_ref(), some of which appear to be redundant and can
be eliminated by minor tweaks to the logic in download().

Also drop redundant calls to os.path.exists(ud.clonedir) before
self.need_update(), since need_update() includes its own built-in
check for the existance of ud.clonedir.

(Bitbake rev: 61b0df5523afc8f805043f3adc9c106690e6f133)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-22 13:13:19 +01:00
Mattias Hansson
c4338a9420 bitbake: lib/bb/utils: prevent movefile from changing dest dir permissions
Prevent movefile from falsely setting the source file's owner and
permissions on the destination directory instead of the destination
file when moving between devices.

This bug caused the last file moved into a directory to dictate the
directory's owner and permissions.

(Bitbake rev: 82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40)

Signed-off-by: Mattias Hansson <mattias.hansson@axis.com>
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-23 17:26:05 +01:00
Richard Purdie
a0f22fd971 bitbake: cookerdata: Issue warning if layer doesn't set LAYERSERIES_COMPAT_x
We'd like layers to set this variable so that we know which layers are compatible
with which others, even if the branch is a generic un-updated "master" branch.

Start printing a warning to highlight this issue.

(Bitbake rev: cca81e33b58c390dcf5cc3a31555a43b79177166)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-06 11:39:49 +01:00
Paul Eggleton
ba54521c67 lib/bb/shell.py: drop
This was removed in the bitbake repository back in 2010 (bitbake
revision 24857e2ceb405916b0b0b3e75c6c2375a909b9ba) - it's not clear
to me what happened, but for some reason the file remained in the poky
repository. However it does not appear that it has been used since then
and the reasons for removing even more valid now than they were then -
the code has moved on even further, we have memory resident bitbake
server, and if we were to re-implement this we would do it in a
different way. Drop the file and bring us back in sync with the bitbake
repo.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-28 12:59:37 +01:00
Ross Burton
f500504b81 bitbake: fetch2/git: log exception if ls-remote fails
(Bitbake rev: 8212446de11c0e370c55f88cde86334b760cd939)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-28 12:51:52 +01:00
Ross Burton
d04792b2ed bitbake: tests/fetch: state which upstream failed
(Bitbake rev: 21098de09ee2f7a9f0b3f895bf2ffbdeb8c9ded5)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-28 12:51:52 +01:00
Amanda Brindle
58b5f8a221 bitbake: utils.py: Add option for explode_dep_versions2 to return unsorted
Before, explode_dep_versions2 would sort the OrderedDict before
returning. This function will still sort the OrderedDict by default, but
will now have the option to return the OrderedDict unsorted. This option will
allow us to check if the order of the package list has changed.

(Bitbake rev: 39d6a30a28f66c599e18beddbd847f40dcff623c)

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-15 03:39:42 -07:00
Richard Purdie
4e884c8723 bitbake: cooker: Fix environment double key expansion issue
The base configuration needs key expansion and anon python execution,
the parsed configurations do not. Fix this consistently, its been
broken and causing double key expansion for a while, only relised
when we started double anonymous python exeution too.

(Bitbake rev: 6138897de5ac6becf3bff56ce7a78f3ec208fcdf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:35:42 +00:00
Richard Purdie
c2381e3a69 bitbake: cooker: Run registered anonymous python before displaying environment
The output of bitbake -e can differ from what actually is used due
to anonymous python making changes to the data store. Execute any
anonymous python added in the base configuration to make things
more consistent.

(Bitbake rev: bcdc2f73e3b4a10b1e479c2891f251d9507a9e30)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:35:42 +00:00
Richard Purdie
20a93757a3 bitbake: parse/ast: Abstract anonymous function execution into a function
This allows us to call this code from other contexts without
duplicating it.

(Bitbake rev: c6be487f9bd5d95915f2495d555b9f539adb1d44)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:35:42 +00:00
Richard Purdie
4bc71faf76 bitbake: runqueue: Ensure only recursive task dependencies are pruned
If a standalone tasks adds a dependency on X:do_build, the code in runqueue would
currently remove it if that do_build was part of an image recipe which uses
recrdeptask on do_build.

Such individual tasks shouldn't do this, therefore tweak the recursive reference code
to only process recurseive tasks, not all tasks.

(Bitbake rev: 4cfca360891e1ed876a9c19487b4f6210686af26)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:14:12 +00:00
Nathan Rossi
f2d5967982 bitbake: fetch2: Handle missing donestamp file when content is valid
In order to allow users to manually populate the download directory with
valid content change the assumption that missing the donestamp file
means unfetched content.

This allows users to populate the download dir without needing to create
dummy .done files such that a user does not need a PREMIRROR when using
BB_NO_NETWORK to provide valid content files in the download directory.

To ensure the correct result this change also fails first if the
localpath does not exist. This prevents further parts of the function
attempting to calculating the checksum on non-existent files. This also
fixes some edge conditions around where if the donestamp exists but the
localpath does not it returns, and did not remove the donestamp.

Also added test cases to cover this use case and additional use cases
where for example the fetcher does not support checksums.

(Bitbake rev: a335dbbb65d5b56e71d98cf3e4fa9bfbec1dcde6)

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Böszörményi Zoltán
bb3a634226 bitbake: fetch2/npm.py: Fix inverted condition to prevent infinite loop
At least the cli-color node module has dependencies that have
cyclic dependency among themselves. npm.py is prepared to deal
with such a case but the condition is handled only for downloading
or not a dependency again, but then it goes checking the its
dependency which causes an infinite loop in _getdependencies().
Make this function simply return when a dependency is already
downloaded and only download and check its dependencies when not.

(Bitbake rev: 545540420112992e53f4a83104af10452df168d0)

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Robert Yang
85fa5ee825 bitbake: bitbake: parse: fixes for resolve_file()
The resolve_file() calls mark_dependency(), so the one which calls
resolve_file() doesn't need call mark_dependency() again.

(Bitbake rev: 4682571107323a39b42cd9ec8ee67419e7f15acc)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Robert Yang
f72a121233 bitbake: bitbake: cache: improve debug message
* Print message when cachefile is found/not can help debug.
* Update "Using cache in" to "Cache dir:" since it was the same as the debug
  message of "codeparser & file checksum caches", which caused confusion. And
  whether the cache file will be used or not is still unknown at that time, so
  just print the cache dir.

(Bitbake rev: c8d3a2016f432e8ed9e99d9c28850149ab6fd6d8)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Robert Yang
afbc3f4427 bitbake: bitbake: cooker: don't stop file notifier when cooker is shutdown
It should be live/exited with server rather than cooker, fixed:
$ bitbake --server-only -T -1
Set MACHINE = "qemux86" in conf/local.conf
$ bitbake quilt
Set MACHINE = "qemuppc" in conf/local.conf
$ bitbake quilt
[snip]
ERROR: When reparsing /workspace1/lyang1/poky/meta/recipes-connectivity/openssl/openssl_1.0.2m.bb.do_package, the basehash value changed from c216f7f4fdd3cf4a0b10b975a636426c to d5a8e9431ab261381752d7a64c7b2fa9. The metadata is not deterministic and this needs to be fixed.
[snip]

This is because the server doesn't know local.conf is changed since the
notifiers are stopped, so it doesn't reparse, and then we would get the errors,
let the notifiers live/exited with server can fix the problem.

(Bitbake rev: a6a641cb9c5f3abe901b150da915372e295383d7)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Robert Yang
8abf7d89a5 bitbake: bitbake: cooker: fix for BBFILE_PATTERN matches bbappend
The old code couldn't handle nestled layers correctly, e.g.:
parent_layer/sub_layer/foo.bb

Note there are two layers, parent_layer and sub_layer.
And in parent_layer/conf/layer.conf:
BBFILE_PATTERN_parent_layer = ""^${LAYERDIR}/"

This setting is incorrect since it also matches parent_layer/sub_layer/foo.bb,
so it warns that no files matched sub_layer, this is the expected behavior, but
it doesn't warn when there is a parent_layer/sub_layer/bar.bbappend, this was
incorrect since the bbappend is also matched by BBFILE_PATTERN_parent_layer, it
should warn and let the user fix the problem. Check the bbappend in already
"matched set" before return it as matched by "unmatched set" can fix the problem.

(Bitbake rev: ec90245d28e52ea718d2ce084eb304cdc4355c9c)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Robert Yang
fe70fd1a03 bitbake: bitbake: cooker: skip when BBFILE_PATTERN is empty
There is nothing to do when BBFILE_PATTERN is empty.

(Bitbake rev: b7da31641c24c53d47ea45a7119d1bd353011b39)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Nathan Rossi
9c44aee83d bitbake: fetch/git: Use 'git-make-shallow' from bin directory
Move the code that existed in tests/fetch.py for determining the path to
'git-make-shallow' into the git module and reference it.

This ensures that 'git-make-shallow' is always available and the desired
version regardless of the path variable or whether git exposes the
command.

(Bitbake rev: 6b508ab8fd5aa796c1c00c970e81e5e93f84d35d)

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Richard Purdie
c75985f40a bitbake: main/runqueue: Rework runall task and add runonly option
The runall commandline option was confusing people. There are in fact two
different behaviours people may want.

a) For a given target (or set of targets) look through the task graph and
run task X only if its present and would have been built.

b) For a given target (or set of targets) look through the task graph and
run task X if any recipe in the taskgraph has such a target even if it wasn't
in the original task graph.

I've decided to interpret the existing "runall" option as b), even if right
now if behaves like a). For a), which is a valid use case, this patch adds
a "runonly" option.

With both behaviours present, I'm hoping we can then kill off the "fetchall",
"checkuriall" and other tasks from OE metadata and replace them with this
option. This would significantly speed up task graph processing.

(Deleting the checkuriall and fetchall tasks takes "bitbake core-image-sato -g"
from 22s to 8s).

(Bitbake rev: 546a662c877b2d3af35e3996950582ed2df41fe4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:26:03 +00:00
Richard Purdie
dafa1ac864 bitbake: runqueue: Rewrite and optimize recrdepends handling
This is a performance sensitive piece of code and the shear number
of recursive loops is causing a significant and unscalable performance
pain point.

This change moves to a two step approach, firstly generating a list of recursive
dependencies for any task, then applying this to the recursive tasks, iterating
over things until no further dependencies are added.

It was noticed an optimisation is possible and the list of recursive tasks need not
contain the taskname, only the base task id. This allows a significant performance
improvement and limits the size of the resursive task lists, improving speed.

(Bitbake rev: eba738ac5672556eaab4f3374c8025c322761c4a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
2ae62f0d2b bitbake: runqueue: Optimize recrdepends handling
We can optimise the loops slightly so we only process given substrings
once rather than many times. This means expanding out add_resolved_dependencies.

Also add a function which allows replacement of the task element of a
task id, reducing the amount of string handling we're doing in a performance
critical loop.

Its also clear that later code adds to the tasks depends so we don't need
to add .depends() to extradeps at the start.

(Bitbake rev: 4ad281224e92b5f94e3a9c17e8898ec8f1086cdc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
38fd8bbb7f bitbake: runqueue: Remove unused variables
(Bitbake rev: 7e56c285f5ebae9b4b367514e60e3a6ba8cd5693)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
0899c332f7 bitbake: runqueue: Fix recidepends handling
Currently we only run through the recidepends/recrdepends code once. This
means that we can miss some expansions of dependency trees where one
rec{r,i}depends tasks depends on another rec{r,i}depends task.

In reality we need to iterate over the data until we stop adding
dependencies.

In doing this we can't show quite so granular progress information since
we don't know how many times we'll need to do this.

This does slow down the runqueue prepare phase however some optimisations
are possible and can be handled in subsequent patches.

This fix means some missing dependencies, such as:

<image>:do_fetchall -> <image>:do_rootfs -> <pkgs>:do_package_write_X
  -> <ca-certs>:do_package_write_X -> debianutils-native
(via PAKAGE_WRITE_DEPS)

are now found/added.

[YOCTO #12510]

(Bitbake rev: aec2f07d56a19b97b6515897532b113cdead8338)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:30 +00:00
Richard Purdie
cf8425e247 bitbake: fetch/git: Add pack-refs command to mirror handling code
We've noticed issues on our infrastucture iterating over the many
tag/branch/head reference files that some git repositories may contain.

By issuing the pack-refs command, we move these all to a single file
which speeds up operations with the mirror repos in the downloads
directory in general.

(Bitbake rev: f8126aaf774186a6eaf0bd4067b89c074594886c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-29 08:50:08 +00:00
Richard Purdie
3f947dffe7 bitbake: cooker: Sort task graph (dot) file output
This means two different graph files can easily be compared, currently
you'd have to sort them as the output is randomized.

(Bitbake rev: 5f7c6ec785f70beb1a4a1bbc0eb83cfa6cd7740d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-29 08:50:08 +00:00
Peter Kjellerstedt
205cfd7021 bitbake: fetch2/__init__: Disable pseudo in runfetchcmd()
If a fetcher, e.g., git, is run when pseudo is active it will think it
is running as root. If it in turn uses ssh (as git does), ssh too will
think it is running as root. This will cause it to try to read root's
ssh configuration from /root/.ssh which will fail. If ssh then needs to
ask for credentials it will hang indefinitely as there is nowhere for it
to ask the user for them (and even if there was it would not access the
correct private keys).

The solution to the above is to temporarily disable pseudo while
executing any fetcher commands. There should be no reason for them to be
executed under pseudo anyway so this should not be a problem.

RP Ammendum:

We finally did get more information about how to reproduce this problem,
something needs to trigger bb.fetch2.get_srcrev() in a pseudo context,
for example when AUTOREV is in use or the recipe doesn't have a defined
SRCREV. That SRC_URI needs to be using protocol=ssh. This would trigger
an ls-remote of the remote repo and if that happens under pseudo, the
wrong ssh credentials may be attempted which can hang.

[YOCTO #12464]

(Bitbake rev: ceaca281cafa662aa2385b95641bce309dce843d)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-08 08:48:54 +00:00
Richard Purdie
869ae2ce2a bitbake: events: Drop unused cfg property
The cfg property on events doesn't add much, all code appears to access
"data" at this point. Remove it to clean up the interface.

(Bitbake rev: bd4b9e4460b60f142c3bf346fb04e360e512eaee)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-08 08:48:54 +00:00
Richard Purdie
1103a03742 bitbake: tests/fetch: Allow bit/bitbake-selftest to function correctly
Without this the paths to git-make-shallow are incorrect and cause test
failures if bitbake isn't executed from cwd or PATH.

(Bitbake rev: 643eacb162b8710330ef292bfda21cfeab97f95c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-07 12:14:34 +00:00
Jair Gonzalez
e95ce3fe3b bitbake: tests/event: tests: Add event classes test class
This change adds EventClassesTest class to bb/tests/event.py,
including 47 new test cases for the public interfaces of the
bitbake event and related helper classes.

[YOCTO #10773]

(Bitbake rev: ee5fe4431713b8a29bdb424a29460965374b3234)

Signed-off-by: Jair Gonzalez <jair.de.jesus.gonzalez.plascencia@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-07 12:14:34 +00:00
Jair Gonzalez
35226b3307 bitbake: tests/event: Remove empty assignments from event tests
Remove assignments from non-returning calls.

(Bitbake rev: a8cac827dd15227a3940ea25c673d91b5e2c2a75)

Signed-off-by: Jair Gonzalez <jair.de.jesus.gonzalez.plascencia@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-07 12:14:34 +00:00
Jair Gonzalez
fda60b31ec bitbake: tests/event: Add test for bb.event.worker_fire
Test the triggering of bb.event.worker_fire callback.

(Bitbake rev: daa59a2057c811b20d75235526ac6c2079ac6e10)

Signed-off-by: Jair Gonzalez <jair.de.jesus.gonzalez.plascencia@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-07 12:14:34 +00:00
Jair Gonzalez
61f409baff bitbake: tests/event: Include tests for event filtering features
This change includes unit tests for the following functions,
helper class and methods in bitbake.event:

- set_eventfilter(func)
- set_UIHmask(handlerNum, level, debug_domains, mask)
- getName(e)
- class UIEventFilter(object)
    def __init__(self, level, debug_domains)
    def update(self, eventmask, level, debug_domains)
    def filter(self, event)

[YOCTO #10773]

(Bitbake rev: 4a19dde704fd0bf262ea991ef530f991a4897d31)

Signed-off-by: Jair Gonzalez <jair.de.jesus.gonzalez.plascencia@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-07 12:14:34 +00:00