diff options
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake | 2 | ||||
-rwxr-xr-x | bitbake/bin/bitbake-worker | 7 | ||||
-rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | 21 | ||||
-rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | 75 | ||||
-rw-r--r-- | bitbake/lib/bb/__init__.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 135 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 17 |
9 files changed, 244 insertions, 30 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index c2d0ca7613..40b5d895c1 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
@@ -27,7 +27,7 @@ from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException | |||
27 | 27 | ||
28 | bb.utils.check_system_locale() | 28 | bb.utils.check_system_locale() |
29 | 29 | ||
30 | __version__ = "2.15.0" | 30 | __version__ = "2.15.1" |
31 | 31 | ||
32 | if __name__ == "__main__": | 32 | if __name__ == "__main__": |
33 | if __version__ != bb.__version__: | 33 | if __version__ != bb.__version__: |
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index 35fa1ab62b..d2b146a6a9 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker | |||
@@ -182,11 +182,8 @@ def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask): | |||
182 | elif workerdata["umask"]: | 182 | elif workerdata["umask"]: |
183 | umask = workerdata["umask"] | 183 | umask = workerdata["umask"] |
184 | if umask: | 184 | if umask: |
185 | # umask might come in as a number or text string.. | 185 | # Convert to a python numeric value as it could be a string |
186 | try: | 186 | umask = bb.utils.to_filemode(umask) |
187 | umask = int(umask, 8) | ||
188 | except TypeError: | ||
189 | pass | ||
190 | 187 | ||
191 | dry_run = cfg.dry_run or runtask['dry_run'] | 188 | dry_run = cfg.dry_run or runtask['dry_run'] |
192 | 189 | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst index eac3cbdfb5..a2c2432db1 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | |||
@@ -39,10 +39,10 @@ variable and then calls the ``download`` method to download the files. | |||
39 | 39 | ||
40 | The instantiation of the fetch class is usually followed by:: | 40 | The instantiation of the fetch class is usually followed by:: |
41 | 41 | ||
42 | rootdir = l.getVar('WORKDIR') | 42 | rootdir = l.getVar('UNPACKDIR') |
43 | fetcher.unpack(rootdir) | 43 | fetcher.unpack(rootdir) |
44 | 44 | ||
45 | This code unpacks the downloaded files to the specified by ``WORKDIR``. | 45 | This code unpacks the downloaded files to the specified by ``UNPACKDIR``. |
46 | 46 | ||
47 | .. note:: | 47 | .. note:: |
48 | 48 | ||
@@ -51,7 +51,7 @@ This code unpacks the downloaded files to the specified by ``WORKDIR``. | |||
51 | examine the OpenEmbedded class file ``base.bbclass`` | 51 | examine the OpenEmbedded class file ``base.bbclass`` |
52 | . | 52 | . |
53 | 53 | ||
54 | The :term:`SRC_URI` and ``WORKDIR`` variables are not hardcoded into the | 54 | The :term:`SRC_URI` and ``UNPACKDIR`` variables are not hardcoded into the |
55 | fetcher, since those fetcher methods can be (and are) called with | 55 | fetcher, since those fetcher methods can be (and are) called with |
56 | different variable names. In OpenEmbedded for example, the shared state | 56 | different variable names. In OpenEmbedded for example, the shared state |
57 | (sstate) code uses the fetch module to fetch the sstate files. | 57 | (sstate) code uses the fetch module to fetch the sstate files. |
@@ -463,13 +463,6 @@ Here are some example URLs:: | |||
463 | 463 | ||
464 | .. note:: | 464 | .. note:: |
465 | 465 | ||
466 | When using ``git`` as the fetcher of the main source code of your software, | ||
467 | ``S`` should be set accordingly:: | ||
468 | |||
469 | S = "${WORKDIR}/git" | ||
470 | |||
471 | .. note:: | ||
472 | |||
473 | Specifying passwords directly in ``git://`` urls is not supported. | 466 | Specifying passwords directly in ``git://`` urls is not supported. |
474 | There are several reasons: :term:`SRC_URI` is often written out to logs and | 467 | There are several reasons: :term:`SRC_URI` is often written out to logs and |
475 | other places, and that could easily leak passwords; it is also all too | 468 | other places, and that could easily leak passwords; it is also all too |
@@ -598,7 +591,7 @@ and port, username, and password, and fetches the Head Revision:: | |||
598 | SRC_URI = "p4://example-depot/main/source/..." | 591 | SRC_URI = "p4://example-depot/main/source/..." |
599 | SRCREV = "${AUTOREV}" | 592 | SRCREV = "${AUTOREV}" |
600 | PV = "p4-${SRCPV}" | 593 | PV = "p4-${SRCPV}" |
601 | S = "${WORKDIR}/p4" | 594 | S = "${UNPACKDIR}/p4" |
602 | 595 | ||
603 | Here is an example that specifies the server URL and port, username, and | 596 | Here is an example that specifies the server URL and port, username, and |
604 | password, and fetches a Revision based on a Label:: | 597 | password, and fetches a Revision based on a Label:: |
@@ -607,15 +600,15 @@ password, and fetches a Revision based on a Label:: | |||
607 | SRC_URI = "p4://user:passwd@example-depot/main/source/..." | 600 | SRC_URI = "p4://user:passwd@example-depot/main/source/..." |
608 | SRCREV = "release-1.0" | 601 | SRCREV = "release-1.0" |
609 | PV = "p4-${SRCPV}" | 602 | PV = "p4-${SRCPV}" |
610 | S = "${WORKDIR}/p4" | 603 | S = "${UNPACKDIR}/p4" |
611 | 604 | ||
612 | .. note:: | 605 | .. note:: |
613 | 606 | ||
614 | You should always set S to "${WORKDIR}/p4" in your recipe. | 607 | You should always set S to "${UNPACKDIR}/p4" in your recipe. |
615 | 608 | ||
616 | By default, the fetcher strips the depot location from the local file paths. In | 609 | By default, the fetcher strips the depot location from the local file paths. In |
617 | the above example, the content of ``example-depot/main/source/`` will be placed | 610 | the above example, the content of ``example-depot/main/source/`` will be placed |
618 | in ``${WORKDIR}/p4``. For situations where preserving parts of the remote depot | 611 | in ``${UNPACKDIR}/p4``. For situations where preserving parts of the remote depot |
619 | paths locally is desirable, the fetcher supports two parameters: | 612 | paths locally is desirable, the fetcher supports two parameters: |
620 | 613 | ||
621 | - *"module":* | 614 | - *"module":* |
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst index 477443e228..6be8dbbf63 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | |||
@@ -310,6 +310,11 @@ overview of their function and contents. | |||
310 | 310 | ||
311 | For example usage, see :term:`BB_GIT_SHALLOW`. | 311 | For example usage, see :term:`BB_GIT_SHALLOW`. |
312 | 312 | ||
313 | :term:`BB_GIT_DEFAULT_DESTSUFFIX` | ||
314 | The default destination directory where the Git fetcher unpacks the | ||
315 | source code. If this variable is not set, the source code is unpacked in a | ||
316 | directory named "git". | ||
317 | |||
313 | :term:`BB_GIT_SHALLOW` | 318 | :term:`BB_GIT_SHALLOW` |
314 | Setting this variable to "1" enables the support for fetching, using and | 319 | Setting this variable to "1" enables the support for fetching, using and |
315 | generating mirror tarballs of `shallow git repositories <https://riptutorial.com/git/example/4584/shallow-clone>`_. | 320 | generating mirror tarballs of `shallow git repositories <https://riptutorial.com/git/example/4584/shallow-clone>`_. |
@@ -533,11 +538,28 @@ overview of their function and contents. | |||
533 | version 4.20 expose under ``/proc/pressure``. The threshold represents | 538 | version 4.20 expose under ``/proc/pressure``. The threshold represents |
534 | the difference in "total" pressure from the previous second. The | 539 | the difference in "total" pressure from the previous second. The |
535 | minimum value is 1.0 (extremely slow builds) and the maximum is | 540 | minimum value is 1.0 (extremely slow builds) and the maximum is |
536 | 1000000 (a pressure value unlikely to ever be reached). | 541 | 1000000 (a pressure value unlikely to ever be reached). See |
542 | https://docs.kernel.org/accounting/psi.html for more information. | ||
543 | |||
544 | A default value to limit the CPU pressure to be set in ``conf/local.conf`` | ||
545 | could be:: | ||
546 | |||
547 | BB_PRESSURE_MAX_CPU = "15000" | ||
548 | |||
549 | Multiple values should be tested on the build host to determine what suits | ||
550 | best, depending on the need for performances versus load average during | ||
551 | the build. | ||
552 | |||
553 | .. note:: | ||
537 | 554 | ||
538 | This threshold can be set in ``conf/local.conf`` as:: | 555 | You may see numerous messages printed by BitBake in the case the |
556 | :term:`BB_PRESSURE_MAX_CPU` is too low: | ||
539 | 557 | ||
540 | BB_PRESSURE_MAX_CPU = "500" | 558 | Pressure status changed to CPU: True, IO: False, Mem: False (CPU: 1105.9/2.0, IO: 0.0/2.0, Mem: 0.0/2.0) - using 1/64 bitbake threads |
559 | |||
560 | This means that the :term:`BB_PRESSURE_MAX_CPU` should be increased to | ||
561 | a reasonable value for limiting the CPU pressure on the system. | ||
562 | Monitor the varying value after ``IO:`` above to set a sensible value. | ||
541 | 563 | ||
542 | :term:`BB_PRESSURE_MAX_IO` | 564 | :term:`BB_PRESSURE_MAX_IO` |
543 | Specifies a maximum I/O pressure threshold, above which BitBake's | 565 | Specifies a maximum I/O pressure threshold, above which BitBake's |
@@ -549,14 +571,34 @@ overview of their function and contents. | |||
549 | version 4.20 expose under ``/proc/pressure``. The threshold represents | 571 | version 4.20 expose under ``/proc/pressure``. The threshold represents |
550 | the difference in "total" pressure from the previous second. The | 572 | the difference in "total" pressure from the previous second. The |
551 | minimum value is 1.0 (extremely slow builds) and the maximum is | 573 | minimum value is 1.0 (extremely slow builds) and the maximum is |
552 | 1000000 (a pressure value unlikely to ever be reached). | 574 | 1000000 (a pressure value unlikely to ever be reached). See |
575 | https://docs.kernel.org/accounting/psi.html for more information. | ||
553 | 576 | ||
554 | At this point in time, experiments show that IO pressure tends to | 577 | At this point in time, experiments show that IO pressure tends to |
555 | be short-lived and regulating just the CPU with | 578 | be short-lived and regulating just the CPU with |
556 | :term:`BB_PRESSURE_MAX_CPU` can help to reduce it. | 579 | :term:`BB_PRESSURE_MAX_CPU` can help to reduce it. |
557 | 580 | ||
558 | :term:`BB_PRESSURE_MAX_MEMORY` | 581 | A default value to limit the IO pressure to be set in ``conf/local.conf`` |
582 | could be:: | ||
583 | |||
584 | BB_PRESSURE_MAX_IO = "15000" | ||
585 | |||
586 | Multiple values should be tested on the build host to determine what suits | ||
587 | best, depending on the need for performances versus I/O usage during the | ||
588 | build. | ||
589 | |||
590 | .. note:: | ||
559 | 591 | ||
592 | You may see numerous messages printed by BitBake in the case the | ||
593 | :term:`BB_PRESSURE_MAX_IO` is too low:: | ||
594 | |||
595 | Pressure status changed to CPU: None, IO: True, Mem: False (CPU: 2236.0/None, IO: 153.6/2.0, Mem: 0.0/2.0) - using 19/64 bitbake threads | ||
596 | |||
597 | This means that the :term:`BB_PRESSURE_MAX_IO` should be increased to | ||
598 | a reasonable value for limiting the I/O pressure on the system. | ||
599 | Monitor the varying value after ``IO:`` above to set a sensible value. | ||
600 | |||
601 | :term:`BB_PRESSURE_MAX_MEMORY` | ||
560 | Specifies a maximum memory pressure threshold, above which BitBake's | 602 | Specifies a maximum memory pressure threshold, above which BitBake's |
561 | scheduler will not start new tasks (providing there is at least | 603 | scheduler will not start new tasks (providing there is at least |
562 | one active task). If no value is set, memory pressure is not | 604 | one active task). If no value is set, memory pressure is not |
@@ -566,7 +608,8 @@ overview of their function and contents. | |||
566 | version 4.20 expose under ``/proc/pressure``. The threshold represents | 608 | version 4.20 expose under ``/proc/pressure``. The threshold represents |
567 | the difference in "total" pressure from the previous second. The | 609 | the difference in "total" pressure from the previous second. The |
568 | minimum value is 1.0 (extremely slow builds) and the maximum is | 610 | minimum value is 1.0 (extremely slow builds) and the maximum is |
569 | 1000000 (a pressure value unlikely to ever be reached). | 611 | 1000000 (a pressure value unlikely to ever be reached). See |
612 | https://docs.kernel.org/accounting/psi.html for more information. | ||
570 | 613 | ||
571 | Memory pressure is experienced when time is spent swapping, | 614 | Memory pressure is experienced when time is spent swapping, |
572 | refaulting pages from the page cache or performing direct reclaim. | 615 | refaulting pages from the page cache or performing direct reclaim. |
@@ -574,6 +617,26 @@ overview of their function and contents. | |||
574 | might be useful as a last resort to prevent OOM errors if they are | 617 | might be useful as a last resort to prevent OOM errors if they are |
575 | occurring during builds. | 618 | occurring during builds. |
576 | 619 | ||
620 | A default value to limit the memory pressure to be set in | ||
621 | ``conf/local.conf`` could be:: | ||
622 | |||
623 | BB_PRESSURE_MAX_MEMORY = "15000" | ||
624 | |||
625 | Multiple values should be tested on the build host to determine what suits | ||
626 | best, depending on the need for performances versus memory consumption | ||
627 | during the build. | ||
628 | |||
629 | .. note:: | ||
630 | |||
631 | You may see numerous messages printed by BitBake in the case the | ||
632 | :term:`BB_PRESSURE_MAX_MEMORY` is too low:: | ||
633 | |||
634 | Pressure status changed to CPU: None, IO: False, Mem: True (CPU: 29.5/None, IO: 0.0/2.0, Mem: 2553.3/2.0) - using 17/64 bitbake threads | ||
635 | |||
636 | This means that the :term:`BB_PRESSURE_MAX_MEMORY` should be increased to | ||
637 | a reasonable value for limiting the memory pressure on the system. | ||
638 | Monitor the varying value after ``Mem:`` above to set a sensible value. | ||
639 | |||
577 | :term:`BB_RUNFMT` | 640 | :term:`BB_RUNFMT` |
578 | Specifies the name of the executable script files (i.e. run files) | 641 | Specifies the name of the executable script files (i.e. run files) |
579 | saved into ``${``\ :term:`T`\ ``}``. By default, the | 642 | saved into ``${``\ :term:`T`\ ``}``. By default, the |
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 62ceaaef6e..bf4c54d829 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -9,7 +9,7 @@ | |||
9 | # SPDX-License-Identifier: GPL-2.0-only | 9 | # SPDX-License-Identifier: GPL-2.0-only |
10 | # | 10 | # |
11 | 11 | ||
12 | __version__ = "2.15.0" | 12 | __version__ = "2.15.1" |
13 | 13 | ||
14 | import sys | 14 | import sys |
15 | if sys.version_info < (3, 9, 0): | 15 | if sys.version_info < (3, 9, 0): |
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 0af8070080..14ec45a3f6 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -199,6 +199,8 @@ class Git(FetchMethod): | |||
199 | ud.shallow_skip_fast = False | 199 | ud.shallow_skip_fast = False |
200 | ud.shallow = d.getVar("BB_GIT_SHALLOW") == "1" | 200 | ud.shallow = d.getVar("BB_GIT_SHALLOW") == "1" |
201 | ud.shallow_extra_refs = (d.getVar("BB_GIT_SHALLOW_EXTRA_REFS") or "").split() | 201 | ud.shallow_extra_refs = (d.getVar("BB_GIT_SHALLOW_EXTRA_REFS") or "").split() |
202 | if 'tag' in ud.parm: | ||
203 | ud.shallow_extra_refs.append("refs/tags/" + ud.parm['tag']) | ||
202 | 204 | ||
203 | depth_default = d.getVar("BB_GIT_SHALLOW_DEPTH") | 205 | depth_default = d.getVar("BB_GIT_SHALLOW_DEPTH") |
204 | if depth_default is not None: | 206 | if depth_default is not None: |
@@ -633,8 +635,6 @@ class Git(FetchMethod): | |||
633 | for line in all_refs_remote: | 635 | for line in all_refs_remote: |
634 | all_refs.append(line.split()[-1]) | 636 | all_refs.append(line.split()[-1]) |
635 | extra_refs = [] | 637 | extra_refs = [] |
636 | if 'tag' in ud.parm: | ||
637 | extra_refs.append(ud.parm['tag']) | ||
638 | for r in ud.shallow_extra_refs: | 638 | for r in ud.shallow_extra_refs: |
639 | if not ud.bareclone: | 639 | if not ud.bareclone: |
640 | r = r.replace('refs/heads/', 'refs/remotes/origin/') | 640 | r = r.replace('refs/heads/', 'refs/remotes/origin/') |
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index 48e61dfcea..52b7bf85bf 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py | |||
@@ -692,3 +692,14 @@ class EnvironmentTests(unittest.TestCase): | |||
692 | self.assertIn("A", os.environ) | 692 | self.assertIn("A", os.environ) |
693 | self.assertEqual(os.environ["A"], "this is A") | 693 | self.assertEqual(os.environ["A"], "this is A") |
694 | self.assertNotIn("B", os.environ) | 694 | self.assertNotIn("B", os.environ) |
695 | |||
696 | class FilemodeTests(unittest.TestCase): | ||
697 | def test_filemode_convert(self): | ||
698 | self.assertEqual(0o775, bb.utils.to_filemode("0o775")) | ||
699 | self.assertEqual(0o775, bb.utils.to_filemode(0o775)) | ||
700 | self.assertEqual(0o775, bb.utils.to_filemode("775")) | ||
701 | with self.assertRaises(ValueError): | ||
702 | bb.utils.to_filemode("xyz") | ||
703 | with self.assertRaises(ValueError): | ||
704 | bb.utils.to_filemode("999") | ||
705 | |||
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index f48baeb334..e7fbcbca0a 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -14,7 +14,7 @@ import time | |||
14 | import atexit | 14 | import atexit |
15 | import re | 15 | import re |
16 | from collections import OrderedDict, defaultdict | 16 | from collections import OrderedDict, defaultdict |
17 | from functools import partial | 17 | from functools import partial, wraps |
18 | from contextlib import contextmanager | 18 | from contextlib import contextmanager |
19 | 19 | ||
20 | import bb.cache | 20 | import bb.cache |
@@ -27,6 +27,135 @@ import bb.remotedata | |||
27 | from bb.main import setup_bitbake, BitBakeConfigParameters | 27 | from bb.main import setup_bitbake, BitBakeConfigParameters |
28 | import bb.fetch2 | 28 | import bb.fetch2 |
29 | 29 | ||
30 | def wait_for(f): | ||
31 | """ | ||
32 | Wrap a function that makes an asynchronous tinfoil call using | ||
33 | self.run_command() and wait for events to say that the call has been | ||
34 | successful, or an error has occurred. | ||
35 | """ | ||
36 | @wraps(f) | ||
37 | def wrapper(self, *args, handle_events=True, extra_events=None, event_callback=None, **kwargs): | ||
38 | if handle_events: | ||
39 | # A reasonable set of default events matching up with those we handle below | ||
40 | eventmask = [ | ||
41 | 'bb.event.BuildStarted', | ||
42 | 'bb.event.BuildCompleted', | ||
43 | 'logging.LogRecord', | ||
44 | 'bb.event.NoProvider', | ||
45 | 'bb.command.CommandCompleted', | ||
46 | 'bb.command.CommandFailed', | ||
47 | 'bb.build.TaskStarted', | ||
48 | 'bb.build.TaskFailed', | ||
49 | 'bb.build.TaskSucceeded', | ||
50 | 'bb.build.TaskFailedSilent', | ||
51 | 'bb.build.TaskProgress', | ||
52 | 'bb.runqueue.runQueueTaskStarted', | ||
53 | 'bb.runqueue.sceneQueueTaskStarted', | ||
54 | 'bb.event.ProcessStarted', | ||
55 | 'bb.event.ProcessProgress', | ||
56 | 'bb.event.ProcessFinished', | ||
57 | ] | ||
58 | if extra_events: | ||
59 | eventmask.extend(extra_events) | ||
60 | ret = self.set_event_mask(eventmask) | ||
61 | |||
62 | includelogs = self.config_data.getVar('BBINCLUDELOGS') | ||
63 | loglines = self.config_data.getVar('BBINCLUDELOGS_LINES') | ||
64 | |||
65 | # Call actual function | ||
66 | ret = f(self, *args, **kwargs) | ||
67 | |||
68 | if handle_events: | ||
69 | lastevent = time.time() | ||
70 | result = False | ||
71 | # Borrowed from knotty, instead somewhat hackily we use the helper | ||
72 | # as the object to store "shutdown" on | ||
73 | helper = bb.ui.uihelper.BBUIHelper() | ||
74 | helper.shutdown = 0 | ||
75 | parseprogress = None | ||
76 | termfilter = bb.ui.knotty.TerminalFilter(helper, helper, self.logger.handlers, quiet=self.quiet) | ||
77 | try: | ||
78 | while True: | ||
79 | try: | ||
80 | event = self.wait_event(0.25) | ||
81 | if event: | ||
82 | lastevent = time.time() | ||
83 | if event_callback and event_callback(event): | ||
84 | continue | ||
85 | if helper.eventHandler(event): | ||
86 | if isinstance(event, bb.build.TaskFailedSilent): | ||
87 | self.logger.warning("Logfile for failed setscene task is %s" % event.logfile) | ||
88 | elif isinstance(event, bb.build.TaskFailed): | ||
89 | bb.ui.knotty.print_event_log(event, includelogs, loglines, termfilter) | ||
90 | continue | ||
91 | if isinstance(event, bb.event.ProcessStarted): | ||
92 | if self.quiet > 1: | ||
93 | continue | ||
94 | parseprogress = bb.ui.knotty.new_progress(event.processname, event.total) | ||
95 | parseprogress.start(False) | ||
96 | continue | ||
97 | if isinstance(event, bb.event.ProcessProgress): | ||
98 | if self.quiet > 1: | ||
99 | continue | ||
100 | if parseprogress: | ||
101 | parseprogress.update(event.progress) | ||
102 | else: | ||
103 | bb.warn("Got ProcessProgress event for something that never started?") | ||
104 | continue | ||
105 | if isinstance(event, bb.event.ProcessFinished): | ||
106 | if self.quiet > 1: | ||
107 | continue | ||
108 | if parseprogress: | ||
109 | parseprogress.finish() | ||
110 | parseprogress = None | ||
111 | continue | ||
112 | if isinstance(event, bb.command.CommandCompleted): | ||
113 | result = True | ||
114 | break | ||
115 | if isinstance(event, (bb.command.CommandFailed, bb.command.CommandExit)): | ||
116 | self.logger.error(str(event)) | ||
117 | result = False | ||
118 | break | ||
119 | if isinstance(event, logging.LogRecord): | ||
120 | if event.taskpid == 0 or event.levelno > logging.INFO: | ||
121 | self.logger.handle(event) | ||
122 | continue | ||
123 | if isinstance(event, bb.event.NoProvider): | ||
124 | self.logger.error(str(event)) | ||
125 | result = False | ||
126 | break | ||
127 | elif helper.shutdown > 1: | ||
128 | break | ||
129 | termfilter.updateFooter() | ||
130 | if time.time() > (lastevent + (3*60)): | ||
131 | if not self.run_command('ping', handle_events=False): | ||
132 | print("\nUnable to ping server and no events, closing down...\n") | ||
133 | return False | ||
134 | except KeyboardInterrupt: | ||
135 | termfilter.clearFooter() | ||
136 | if helper.shutdown == 1: | ||
137 | print("\nSecond Keyboard Interrupt, stopping...\n") | ||
138 | ret = self.run_command("stateForceShutdown") | ||
139 | if ret and ret[2]: | ||
140 | self.logger.error("Unable to cleanly stop: %s" % ret[2]) | ||
141 | elif helper.shutdown == 0: | ||
142 | print("\nKeyboard Interrupt, closing down...\n") | ||
143 | interrupted = True | ||
144 | ret = self.run_command("stateShutdown") | ||
145 | if ret and ret[2]: | ||
146 | self.logger.error("Unable to cleanly shutdown: %s" % ret[2]) | ||
147 | helper.shutdown = helper.shutdown + 1 | ||
148 | termfilter.clearFooter() | ||
149 | finally: | ||
150 | termfilter.finish() | ||
151 | if helper.failed_tasks: | ||
152 | result = False | ||
153 | return result | ||
154 | else: | ||
155 | return ret | ||
156 | |||
157 | return wrapper | ||
158 | |||
30 | 159 | ||
31 | # We need this in order to shut down the connection to the bitbake server, | 160 | # We need this in order to shut down the connection to the bitbake server, |
32 | # otherwise the process will never properly exit | 161 | # otherwise the process will never properly exit |
@@ -700,6 +829,10 @@ class Tinfoil: | |||
700 | """ | 829 | """ |
701 | return self.run_command('buildFile', buildfile, task, internal) | 830 | return self.run_command('buildFile', buildfile, task, internal) |
702 | 831 | ||
832 | @wait_for | ||
833 | def build_file_sync(self, *args): | ||
834 | self.build_file(*args) | ||
835 | |||
703 | def build_targets(self, targets, task=None, handle_events=True, extra_events=None, event_callback=None): | 836 | def build_targets(self, targets, task=None, handle_events=True, extra_events=None, event_callback=None): |
704 | """ | 837 | """ |
705 | Builds the specified targets. This is equivalent to a normal invocation | 838 | Builds the specified targets. This is equivalent to a normal invocation |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index a2806fd360..1cc74ed546 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -1211,6 +1211,23 @@ def which(path, item, direction = 0, history = False, executable=False): | |||
1211 | return "", hist | 1211 | return "", hist |
1212 | return "" | 1212 | return "" |
1213 | 1213 | ||
1214 | def to_filemode(input): | ||
1215 | """ | ||
1216 | Take a bitbake variable contents defining a file mode and return | ||
1217 | the proper python representation of the number | ||
1218 | |||
1219 | Arguments: | ||
1220 | |||
1221 | - ``input``: a string or number to convert, e.g. a bitbake variable | ||
1222 | string, assumed to be an octal representation | ||
1223 | |||
1224 | Returns the python file mode as a number | ||
1225 | """ | ||
1226 | # umask might come in as a number or text string.. | ||
1227 | if type(input) is int: | ||
1228 | return input | ||
1229 | return int(input, 8) | ||
1230 | |||
1214 | @contextmanager | 1231 | @contextmanager |
1215 | def umask(new_mask): | 1232 | def umask(new_mask): |
1216 | """ | 1233 | """ |