Commit Graph

7673 Commits

Author SHA1 Message Date
Ross Burton
d016d18a9f bitbake: fetch2/gitsm: use configparser to parse .gitmodules
.gitmodules is basically ini-style, so use configparser instead of manually
parsing by hand.

(Bitbake rev: a4f42e396e2942fde94b8b4944487c1c45f7a295)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-12 16:17:20 +01:00
Christian Lindeberg
87c29b5a94 bitbake: fetch2: Add gomodgit fetcher
Add a go module fetcher for downloading module dependencies to the
module cache directly from a git repository. The fetcher can be used
with the go-mod class in OE-Core.

A module dependency can be specified with:

  SRC_URI += "gomodgit://golang.org/x/net;version=v0.9.0;srcrev=..."

(Bitbake rev: 29ff38ccf0d5389a5bee81e252a78548361a9d7c)

Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-10 13:05:00 +01:00
Christian Lindeberg
dd7631426c bitbake: fetch2: Add gomod fetcher
Add a go module fetcher for downloading module dependencies to the
module cache from a module proxy. The fetcher can be used with the
go-mod class in OE-Core.

A module dependency can be specified with:

  SRC_URI += "gomod://golang.org/x/net;version=v0.9.0;sha256sum=..."

(Bitbake rev: 5ff4694bf305e266ebf0abab5d9745c6b6d07d67)

Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-10 13:05:00 +01:00
Richard Purdie
c6b883106b bitbake: siggen: Fix rare file-checksum hash issue
There is a subtle issue with full pathnames being included in the
file checksums since the sorting might be different depending upon
how layers are being setup causing hash mismatches for recipes appeneded
from other layers with differing directory layouts.

Avoid this by filtering out to the path basename which is what is written
into the sig data anyway later in the code.

(Bitbake rev: 83acc21cdfdb410082c0871ac7693d29a7c5627d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-05 21:49:17 +01:00
Richard Purdie
9a25a38ffe bitbake: codeparser: Allow code visitor expressions to be declared in metadata
Allow the metadata to define code visitor expressions which mean that
custom dependencies can be handled in function libraries.

An example is the qa.handle_error function in OE which can set something
like:

"""
def handle_error_visitorcode(name, args):
    execs = set()
    contains = {}
    warn = None
    if isinstance(args[0], ast.Constant) and isinstance(args[0].value, str):
        for i in ["ERROR_QA", "WARN_QA"]:
            if i not in contains:
                contains[i] = set()
        contains[i].add(args[0].value)
    else:
        warn = args[0]
        execs.add(name)
    return contains, execs, warn

handle_error.visitorcode = handle_error_visitorcode
"""

Meaning that it can have contains optimisations on ERROR and WARN_QA
instead of hard dependencies.

One drawback to this solution is the parsing order. Functions with
visitorcode need to be defined before anything else references them
or the visitor code will not function for the earlier references.

(Bitbake rev: 5bd0c65c217394cde4c8e382eba6cf7f4b909c97)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-29 21:58:19 +01:00
Leonard Göhrs
ee6bf285d7 bitbake: fetch2/npm: allow the '@' character in package names
The '@types/ramda' [1] npm package has recently gained a dependency on
the 'types-ramda' [2] npm package. Both have the same version number.

The name mangling results in the tarballs of both packages sharing the same
name, but different contents.

Fix that by accepting '@' as valid character in the package name,
resulting in one package named @types-ramda and one called types-ramda.

[1]: https://www.npmjs.com/package/@types/ramda
[2]: https://www.npmjs.com/package/types-ramda

(Bitbake rev: 7c9573cb6ea2081bc585eb65267f3124fd4d7e43)

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-25 15:37:02 +01:00
Etienne Cordonnier
58414305b2 bitbake: gcp.py: remove slow calls to gsutil stat
The changes of 1ab1d36c0af6fc58a974106b61ff4d37da6cb229 added calls to "gsutil stat" to avoid unhandled exceptions, however:
- in the case of checkstatus() this is redundant with the call to self.gcp_client.bucket(ud.host).blob(path).exists() which already returns True/False
 and does not throw an exception in case the file does not exist.
- Also the call to gsutil stat is much slower than using the python client to call exists() so we should not replace the call to exists() with a call to gsutil stat.
- I think the intent of calling check_network_access in checkstatus() was to error-out in case the error is disabled. We can rather change the string "gsutil stat" to something else to make the code more readable.
- add a try/except block in download() instead of the extra call to gsutil

[RP: Tweak to avoid import until needed so google module isn't required for everyone]
(Bitbake rev: dd120f630e9ddadad95fe83728418335a14d3c3b)

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-25 15:37:02 +01:00
Enguerrand de Ribaucourt
ec86853a26 bitbake: fetch2/npmsw: allow packages not declaring a registry version
We fetch npm dependencies from the npm-shrinkwrap.json file. They can
point to a package on the NPM registry with a version field, or to a
git/http/file URL with the resolved field. Such packages are allowed not
to declare a registry version field because they may not have been
published to the NPM registry. The previous implementation refuses to
fetch such packages and throws an error.

The resolved field contains the exact source, including the revision,
wich we can use to pass as SRC_URI to the git/http/file fetcher. The
integrity field is also mandatory for HTTP tarballs which will ensure
reproducibility. So even if the version field is not present, we are
still fetching a precise revision of the package.

Another commit published along this stack is also required in the npm
class to support these packages.

v5:
 - improve commit message
v3:
 - Split bitbake npmsw.py modification in another commit

Co-authored-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
(Bitbake rev: 209982b5a3efc8081e65b4326bf9b64eef7f0ba0)

Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-23 09:48:48 +01:00
Enguerrand de Ribaucourt
524e6b65a6 bitbake: fetch2/npmsw: fix fetching git revisions not on master
The NPM package.json documentation[1] states that git URLs may contain
a commit-ish suffix to specify a specific revision. When running
`npm install`, this revision will be looked for on any branch of the
repository.

The bitbake implementation however translates the URL stored in
package.json into a git URL to be fetch by the bitbake git fetcher. The
bitbake fetcher git.py, enforces the branch to be master by default. If
the revision specified in the package.json is not on the master branch,
the fetch will fail while the package.json is valid.

To fix this, append the ";nobranch=1" suffix to the revision in the git
URL to be fetched. This will make the bitbake git fetcher ignore the
branch and respect the behavior of `npm install``.

This can be tested with the following command:
 $ devtool add --npm-dev https://github.com/seapath/cockpit-cluster-dashboard.git -B version
Which points to a project which has a package.json with a git URL:
```json
  "devDependencies": {
    "cockpit-repo": "git+https://github.com/cockpit-project/cockpit.git#d34cabacb8e5e1e028c7eea3d6e3b606d862b8ac"
  }
```
In this repo, the specified revision is on the "main" branch, which
would fail without this fix.

[1] https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies

Co-authored-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
(Bitbake rev: 37a35adf7882f231c13643dbf9168497c6a242a1)

Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-23 09:48:48 +01:00
Chris Laplante
18b37cc518 bitbake: ui/knotty: respect NO_COLOR & check for tty; rename print_hyperlink => format_hyperlink
(Bitbake rev: 3f6de25a8a4d73dfba864aa6a543c5eafa9b7c7c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-23 09:48:48 +01:00
Chris Laplante
ad2365a3df bitbake: ui/knotty: print log paths for failed tasks in summary
When tasks fail, it's very frustrating to have to scroll up to find the
log path(s). Many of us have the muscle memory to navigate to the 'temp'
directories under tmp/work/, but new users do not.

This change enhances the final summary to include log paths (reported
via bb.build.TaskFailed events). Here's an example:

NOTE: Tasks Summary: Attempted 856 tasks of which 853 didn't need to be rerun and 3 failed.

Summary: 3 tasks failed:
  virtual:native:/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
    log: /home/chris/repos/poky/build/tmp/work/x86_64-linux/ncurses-native/6.5/temp/log.do_fetch.1253462
  /home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
    log: /home/chris/repos/poky/build/tmp/work/core2-64-poky-linux/ncurses/6.5/temp/log.do_fetch.1253466
  virtual:nativesdk:/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
    log: /home/chris/repos/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/6.5/temp/log.do_fetch.1253467
Summary: There were 3 WARNING messages.
Summary: There were 6 ERROR messages, returning a non-zero exit code.

Each log is rendered as a clickable hyperlink in the terminal. See
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

(Bitbake rev: 2852a478ab03a482989c3a7e247860ab4f0e9f3e)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-23 09:48:48 +01:00
Troels Dalsgaard Hoffmeyer
67efcf3102 bitbake: build/exec_task: Log str() instead of repr() for exceptions in build
When getting errors during build, they would be printed using repr(), which
doesnt have a lot of context in some cases.
For example FileNotFoundError(2, "file or directory not found"), would be
printed, without the path of the file not found.
This changes the build logging to use str() instead, which according to
the spec is fore human readable strings, whereas repr() is for string
representations that can be be used as valid python.

(Bitbake rev: 2a97024b8b9245ec47deace011a7560a25491207)

Signed-off-by: Troels Dalsgaard Hoffmeyer <tdah@bang-olufsen.dk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-15 15:15:10 +01:00
Richard Purdie
997b11a5a1 bitbake: build: Ensure addtask before/after tasknames have prefix applied
"addtask do_XXX before YYY after ZZZ "

where YYY or ZZZ is missing the "do_" prefix don't work as expected. Ajust the
code so that it doesn't just silently do the wrong thing but works as expected.

Expand a test case to cover this.

(Bitbake rev: 21670b9bb8936ec44aedff26163948bbc2ceb44a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-13 15:47:55 +01:00
Richard Purdie
5226f46342 bitbake: BBHandler/ast: Improve addtask handling
The recent addtask improvement to handle comments complicated the regex significantly
and there are already a number of corner cases in that code which aren't handled well.

Instead of trying to complicate the regex further, switch to code logic instead. This
means the following cases are now handled:

* addtask with multiple task names
* addtask with multiple before constraints
* addtask with multiple after constraints

The testcase is updated to match the improvements.

(Bitbake rev: 417016b83c21fca7616b2ee768d5d08e1edd1e06)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-13 15:47:55 +01:00
Richard Purdie
36f98fc1f2 bitbake: cookerdata: Separate out data_hash and hook to tinfoil
Within tinfoil, the user can write to the configuration data but it won't
cause the data_hash checksum to be re-written, meaning cached parsing
data can be reused when it would now be incorrect.

Abstract out the data_hash code and add it to the invalidateCaches
command, called by tinfoil.modified_files() meaning that tinfoil can
instruct bitbake to update the caches and re-parse if necessary.

Also move the data_hash entirely into databuilder and drop the copy
in cooker as obsolete and not needed.

(Bitbake rev: d9ee77829f693ce75348fa64f406fcecfe4989aa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-13 15:47:55 +01:00
Richard Purdie
4eedb58a28 bitbake: cache: Drop unused function
I can't spot any users of this function and it is poking at variables
inside cooker that could and are about to change so drop it.

(Bitbake rev: 52491808706e9e58b5e6b59d2d792353d77c8b66)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-13 15:47:55 +01:00
Richard Purdie
60cba6a073 bitbake: BBHandler: Handle comments in addtask/deltask
Technically our syntax would allow for comments after an addtask/deltask.
Currently these get silently processed in various ways by the code which
is bad.

Tweak the regex to drop any comments and add test cases to ensure this
continues to work in the future.

[YOCTO #15250]

(Bitbake rev: 64f8796e55a8826ffec0d76b993c8256713f67a3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-13 15:47:55 +01:00
Quentin Schulz
29a40232a3 bitbake: doc: releases: add scarthgap
We missed on adding Scarthgap to the list of user manuals, so let's fix
this oversight.

(Bitbake rev: 2f12db7b7b03c18de6257a9886c493535f0cb5a2)

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-04 17:42:43 +01:00
Quentin Schulz
efe3d419ab bitbake: doc: releases: add nanbield to the outdated manuals
We missed on adding nanbield to the release manuals. It's now EOL so
let's add it directly to the oudated release manuals section.

(Bitbake rev: b891878a7f08b15ee5d6d037d99fbc769cc905e4)

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-04 17:42:43 +01:00
Quentin Schulz
6c46eb9819 bitbake: doc: releases: mark mickledore as outdated
Mickledore isn't maintained anymore, so let's move it to the outdated
release manuals section.

(Bitbake rev: 4cdea8a71641b0e0281001546f9dda3e2cd1f075)

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-04 17:42:43 +01:00
Robert Yang
6568b7aac5 bitbake: data_smart: Improve performance for VariableHistory
Fixed:
- BBMULTICONFIG = "qemux86-64 qemuarm64" and more than 70 layers in BBLAYERS
$ bitbake -p -P
Check profile.log.processed, the record() cost more than 20 seconds, it is less
than 1 second when multiconfig is not enabled, and there would be the following
error when more muticonfigs are enabled:

Timeout while waiting for a reply from the bitbake server

Don't change the type of loginfo['detail'] or re-assign it can make record()
back to less than 1 second, this won't affect COW since loginfo is a mutable
type.

The time mainly affected by two factors:
1) The number of enabled layers, nearly 1 second added per layer when the
   number is larger than 50.

2) The global var such as USER_CLASSES, about 1 ~ 2 seconds added per layer
   when the layers number is larger than 50.

(Bitbake rev: 0596aa0d5b0e4ed3db11b5bd560f1d3439963a41)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-03 11:37:47 +01:00
Yuri D'Elia
b698371255 bitbake: fetch2/git: Enforce default remote name to "origin"
Enforce the default remote name to "origin", as assumed in numerous
places.

This prevents build failures in case the system/user configuration sets
this to a different value.

(Bitbake rev: 1d7360031164f04887c792fb0b2dd86c6ccfcc23)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-13 23:30:07 +01:00
Robert Yang
7bc521ed34 bitbake: bitbake: tests/fetch: Update GitShallowTest for clone_shallow_local()
Update the test cases since the implementation is changed:

* test_shallow_multi_one_uri()
  The a_branch and v0.0 had the same revision, and it required fetch a_branch
  and remove histories of v0.0 which were conflicted, and bitbake reported:
  fatal: no commits selected for shallow requests

  Make a_branch and v0.0 have different revs to fix the problem.

  And now the 'rev^' is not needed, so update self.assertRevCount() as well.

* test_shallow_multi_one_uri_depths()
  Update self.assertRevCount(), now git only fetches the required revs.

* test_shallow_fetch_missing_revs()
  The command is:
  $ git fetch --shallow-exclude=v0.0 master

  But master and v0.0 uses the same revision, so there is no commit to fetch.

* test_shallow_fetch_missing_revs_fails()
  Two unneeded committs are not fetched now:
  - rev^
  - One not specified or required tag.

  So update self.assertRevCount()

(Bitbake rev: 48eff9d9a660ad6b9bd8b53a7dcec600ef42b1d1)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-13 23:30:07 +01:00
Robert Yang
e2527cf58f bitbake: fetch2/git: Use git shallow fetch to implement clone_shallow_local()
This patch can make the following settings much more faster:
BB_GIT_SHALLOW = "1"
BB_GENERATE_MIRROR_TARBALLS = "1"

* The previous implementation was:
  - Make a full clone for the repo from local ud.clonedir
  - Use git-make-shallow to remove unneeded revs

  It was very slow for recipes which have a lot of SRC_URIs, for example
  vulkan-samples and docker-compose, the docker-compose can't be done after 5
  hours.

  $ bitbake vulkan-samples -cfetch
  Before: 12 minutes
  Now: 2 minutes

  $ bitbake docker-compose -cfetch
  Before: More than 300 minutes
  Now: 15 minutes

* The patch uses git shallow fetch to fetch the repo from local
  ud.clonedir:
  - For BB_GIT_SHALLOW_DEPTH: git fetch --depth <depth> rev
  - For BB_GIT_SHALLOW_REVS: git fetch --shallow-exclude=<revs> rev

  Then the git repo will be shallow, and git-make-shallow is not needed any
  more.

  And git shallow fetch will download less commits than before since it doesn't
  need "rev^" to parse the dependencies, the previous code always need 'rev^'.

(Bitbake rev: a5a569c075224fe41707cfa9123c442d1fda2fbf)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-13 23:30:07 +01:00
y75zhang
4172c3bdd5 bitbake: fetch/wget: checkstatus: drop shared connecton when catch Timeout error
* to avoid wrong http response in checkstatus function:
   in wget checkstatus() we are using 'HTTPConnectionCache' to share connections
   1. state_file1(exists on http server) use shared connection <shared1> to send request
   2. http_server recieved request of state_file1, but delayed by some reason to sent respone
   3. state_file1 checkstatus() failed by timeout and drop shared connection <shared1>
   4. state_file2(not exists on http server) get shared connection <shared1> and send request
   5. http_server finally send 200 response for state_file1
   6. state_file2 recived 200 response and thought it was exists on http_server

(Bitbake rev: bf6d0282ab88b4edc4b9e58184cd76cce965abbd)

Signed-off-by: y75zhang <yang-mark.zhang@nokia-sbell.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-04 22:56:41 +01:00
Peter Marko
742e96ad38 bitbake: fetch/clearcase: remove True option to getVar calls in clearcase module
Layer cleanup similar to
https://git.openembedded.org/openembedded-core/commit/?id=26c74fd10614582e177437608908eb43688ab510

It was probably not found before beacause of the extra "d" parameter.
That seem to be a bug as getVar does not support that.

(Bitbake rev: 720189b810995c5737853458b7eb3779ca0df37e)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-02 22:37:13 +01:00
Enrico Jörns
287e2ede38 bitbake: bitbake-diffsigs: fix handling when finding only a single sigfile
This fixes the following error when calling 'bitbake-dumpsig' or
'bitbake-diffsigs' when having only a single sigfile available:

| Traceback (most recent call last):
|   File "[..]/poky/bitbake/bin/bitbake-dumpsig", line 171, in <module>
|     files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
|             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|   File "[..]/poky/bitbake/bin/bitbake-dumpsig", line 83, in find_siginfo_task
|     sig2 = latestsigs[1]
|            ~~~~~~~~~~^^^
| IndexError: list index out of range

Handle this by adding (and returning) the path for the second sigfile
only if one is found. This way it will work for both diffsigs and
dumpsig use case.

The calling argparse code already deals with find_siginfo_task()
returning only a single file.
For 'bitbake-dumpsig' it will just dump the single sigfile, for
'bitbake-diffsigs' it will emit a proper error message again:

| ERROR: Only one matching sigdata file found for the specified task (systemd configure)

(Bitbake rev: 25057d33e9131f3214a06bbb316c916c744f8f03)

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-02 22:29:27 +01:00
Richard Purdie
6be592d2a7 bitbake: codeparser: Skip non-local functions for module dependencies
If modules do something like "from glob import glob" then we end up
checksumming the glob code. That leads to bugs as the code can change
between different python versions for example, leading to checksum
instability.

We should ignore functions not from the current file as implemented
by this change.

(Bitbake rev: 1e6f862864539d6f6a0bea3e4479e0dd40ff3091)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-01 13:53:23 +01:00
Richard Purdie
0d49931755 bitbake: codeparser/data: Ensure module function contents changing is accounted for
Currently, if a pylib function changes contents, the taskhash remains
unchanged since we assume the functions have stable output. This is
probably a poor assumption so take the code of the function into account
in the taskhashes. This avoids certain frustrating build failures we've
been seeing in automated testing.

To make this work we have to add an extra entry to the python code parsing
cache so that we can store the hashed function contents for efficiency as
in the python module case, that isn't used as the key to the cache.

The cache version changes since we're adding data to the cache.

(Bitbake rev: b2c3438ebe62793ebabe2c282534893908d520b4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-01 13:53:23 +01:00
Robert Yang
ac40cb5ee2 bitbake: cache: Remove invalid symlink for bb_cache.dat
The bb_cache.dat might be an invalid symlink when error happens, then
os.path.exists(symlink) would return False for it, the invalid symlink
wouldn't be removed and os.symlink can't update it any more.

Use os.path.islink(symlink) can fix the problem.

(Bitbake rev: 1387d7b9ee3f270488f89b29f36f9f240e44accc)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-25 11:51:45 +01:00
Martin Jansa
5d88faa0f3 bitbake: siggen: catch FileNotFoundError everywhere and ConnectionError also in get_unihashes
* avoids long trace when BB_HASHSERVE points to non-existent socket
  file, e.g.:
  BB_HASHSERVE = "unix:///OE/no-socket.sock"
  or when running the build before starting the bin/bitbake-hashserv.

* now it shows just warnings like it did in kirkstone
  many of them, e.g. 6 just for rebuilding zlib-native, but better than long trace

  for nonexistent socket file:
  WARNING: zlib-native-1.3.1-r0 do_create_spdx: Error contacting Hash Equivalence Server unix:///OE/no-socket.sock: [Errno 2] No such file or directory
  for existing file, but before starting bin/bitbake-hashserv:
  WARNING: zlib-native-1.3.1-r0 do_create_spdx: Error contacting Hash Equivalence Server unix:///OE/hashserv.sock: [Errno 111] Connection refused

ERROR: An uncaught exception occurred in runqueue###############################################################                                                                                                               | ETA:  0:00:00
Traceback (most recent call last):
  File "/OE/build/oe-core/bitbake/lib/hashserv/__init__.py", line 80, in create_client(addr='unix:///OE/no-socket.sock', username=None, password=None):
             if typ == ADDR_TYPE_UNIX:
    >            c.connect_unix(*a)
             elif typ == ADDR_TYPE_WS:
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 241, in Client.connect_unix(path='/OE/no-socket.sock'):
             self.loop.run_until_complete(self.client.connect_unix(path))
    >        self.loop.run_until_complete(self.client.connect())

  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in _UnixSelectorEventLoop.run_until_complete(future=<Task finished name='Task-6' coro=<AsyncClient.connect() done, defined at /OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.
py:150> exception=FileNotFoundError(2, 'No such file or directory')>):

    >        return future.result()

  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 152, in AsyncClient.connect():
             if self.socket is None:
    >            self.socket = await self._connect_sock()
                 await self.setup_connection()
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 85, in connect_sock:
                     sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
    >                sock.connect(os.path.basename(path))
                 finally:
FileNotFoundError: [Errno 2] No such file or directory

ERROR: Running idle function
Traceback (most recent call last):
  File "/OE/build/oe-core/bitbake/lib/hashserv/__init__.py", line 80, in create_client(addr='unix:///OE/no-socket.sock', username=None, password=None):
             if typ == ADDR_TYPE_UNIX:
    >            c.connect_unix(*a)
             elif typ == ADDR_TYPE_WS:
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 241, in Client.connect_unix(path='/OE/no-socket.sock'):
             self.loop.run_until_complete(self.client.connect_unix(path))
    >        self.loop.run_until_complete(self.client.connect())

  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in _UnixSelectorEventLoop.run_until_complete(future=<Task finished name='Task-6' coro=<AsyncClient.connect() done, defined at /OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.
py:150> exception=FileNotFoundError(2, 'No such file or directory')>):

    >        return future.result()

  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 152, in AsyncClient.connect():
             if self.socket is None:
    >            self.socket = await self._connect_sock()
                 await self.setup_connection()
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 85, in connect_sock:
                     sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
    >                sock.connect(os.path.basename(path))
                 finally:
FileNotFoundError: [Errno 2] No such file or directory

Summary: There were 2 ERROR messages, returning a non-zero exit code.

1605616 09:29:05.369352 Parse cache valid
1605616 09:30:14.500863 Registering idle function <function BBCooker.buildTargets.<locals>.buildTargetsIdle at 0x7f43988c09a0>
1605616 09:30:14.500927 Removing idle function <bound method Command.runAsyncCommand of <bb.command.Command object at 0x7f43a961c350>>
1605616 09:30:14.573274 Exception Traceback (most recent call last):
  File "/OE/build/oe-core/bitbake/lib/bb/server/process.py", line 435, in idle_thread_internal
    retval = function(self, data, False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/cooker.py", line 1487, in buildTargetsIdle
    retval = rq.execute_runqueue()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/runqueue.py", line 1651, in execute_runqueue
    return self._execute_runqueue()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/runqueue.py", line 1567, in _execute_runqueue
    if self.rqdata.prepare() == 0:
       ^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/runqueue.py", line 1290, in prepare
    unihashes = bb.parse.siggen.get_unihashes(ready)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/siggen.py", line 713, in get_unihashes
    with self.client() as client:
  File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/siggen.py", line 595, in client
    self._client = hashserv.create_client(self.server, **self.get_hashserv_creds())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/hashserv/__init__.py", line 88, in create_client
    raise e
  File "/OE/build/oe-core/bitbake/lib/hashserv/__init__.py", line 80, in create_client
    c.connect_unix(*a)
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 241, in connect_unix
    self.loop.run_until_complete(self.client.connect())
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 152, in connect
    self.socket = await self._connect_sock()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/OE/build/oe-core/bitbake/lib/bb/asyncrpc/client.py", line 85, in connect_sock
    sock.connect(os.path.basename(path))
FileNotFoundError: [Errno 2] No such file or directory
 broke the idle_thread, exiting
1605616 09:30:14.673756 Exiting (socket: True)
1605616 09:30:14.683153 Exiting as we could obtain the lock
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/OE/build/oe-core/bitbake-cookerdaemon.log' mode='a+' encoding='UTF-8'>
sys:1: ResourceWarning: unclosed <socket.socket fd=17, family=1, type=1, proto=0>
ResourceWarning: Enable tracemalloc to get the object allocation traceback

(Bitbake rev: 550c86969e5a137ffef61b08a520a4855232fb1c)

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-18 08:45:22 +01:00
Tim Orling
ddc86a93da bitbake: test_project_page: fix failing test_single_layer_page
The test_single_layer_page test case consistently fails. It is not obvious why
but if we change the argument in the following from 8 to 7 it passes.

  url = reverse("layerdetails", args=(TestProjectPage.project_id, 8))

E       selenium.common.exceptions.TimeoutException: Message: An element matching "#change-notification" should be visible
=========================== short test summary info ============================
FAILED ../bitbake/lib/toaster/tests/functional/test_project_page.py::TestProjectPage::test_single_layer_page

(Bitbake rev: c7e12145d8ea641925e3c06ba4f11c2dae66288a)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-12 21:15:50 +01:00
Tim Orling
82596bb8a0 bitbake: toaster test_cerate_new_project: add scarthgap
In line with changes in gen_fixtures.py:

* Add projectscarthgap
  - Add Scarthgap to slot 1.
* Move Kirkstone down to slot 4
* Drop projectdunfell
  - Drop EOL Dunfell from slot 5

(Bitbake rev: a4ae788f95d8e54713528374a9171c636aa747c5)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-12 21:15:50 +01:00
Tim Orling
761a03a7b2 bitbake: taoster: update fixtures for scarthgap, current
gen_fixtures.py:
* Add Scarthgap to slot #1
* Drop EOL Mickledore
* Move Kirkstone to lower slot
* Drop optional slot for EOL Dunfell

Refresh oe-core.xml and poky.xml

(Bitbake rev: 11c7214a292cd296eed5490b6726e672f9179131)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-12 21:15:50 +01:00
Rudolf J Streif
d0b02cf801 bitbake: fetch2/wget: Canonicalize DL_DIR paths for wget2 compatibility
Some distributions (namely Fedora Core 40) have started replacing
wget with wget2. There are some changes to wget2 that make it
incompatible with wget:

1. ftp/ftps is not supported anymore
2. progress 'dot' is not yet supported
3. Relative paths in -P and -O are not correctly dealt with

Item 1: Is already dealt with since Scarthgap by only adding the
option --passive-ftp when the URL specifies ftp/sftp. While that
won't help if ftp/sftp is actually required it at least does
not break http/https downloads.

Item 2: While not supported it at least does not break the operation.

Item 3: If there are relative path components in -P or -O then wget2
only deals with them correctly if there is one, and only one, relative
path component at the beginning of the path:

-P ./downloads     works
-P ../downloads    works
-P ../../downloads does not work
-P ./../downloads  does not work
-P /home/user/downloads/../downloads does not work

In cases where there are more than one relative path component at
the beginning of the path and/or one or more reltaive path
component somewhere in the middle or end of the path, wget2 aborts
with the message Internal error: Unexpected relative path: '<path>')

Such can happen if DL_DIR includes relative path components e.g.
DL_DIR = "${TOPDIR}/../../downloads".

This patch canonicalizes DL_DIR before it is passed to wget.

(Bitbake rev: 3e4208952b086adc510e78c1c5f9cf4550d79dc9)

Signed-off-by: Rudolf J Streif <rudolf.streif@ibeeto.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-07 13:45:43 +01:00
Richard Purdie
fd250d236a bitbake: runqueue: Avoid save_unitaskhashes
The save comes with an IO overhead which can slow down the rehash loop in bitbake
a lot. We only needed to do this when recipes were doing unihash cache copying. Now
they aren't doing that, drop this IO pain point.

(Bitbake rev: dfc15ef99302dea22a051c9eb8398ffd5cf1fc20)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-07 13:45:43 +01:00
Richard Purdie
6208d986bc bitbake: siggen: Drop copy_unihashes function
The code in OE-Core using this has been replaced with something more fit
for purpose. Drop these function calls as they were never a great idea in the
first place and cause IO slowdown for runqueue needing to sync the cache.

(Bitbake rev: 2c8fa57778c4bd2a5c48a60b701ac57de4289cb2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-07 13:45:43 +01:00
Richard Purdie
b6b66ca07b bitbake: tests/fetch: Tweak test to match upstream repo url change
Upstream changed their urls, update our test to match.

(Bitbake rev: dc391b86540ec5e0a0f1d811c776a22d443b1c06)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-05 18:33:42 +01:00
Joshua Watt
c88bee1a5e bitbake: asyncrpc: Use client timeout for websocket open timeout
The default connection timeout for websockets is 10 seconds, so use the
provided client timeout instead (which defaults to 30 seconds).

(Bitbake rev: 23681775e5941e54ebead469addf708fca1e6beb)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-04 12:05:20 +01:00
Richard Purdie
f24ffc087b bitbake: tests/fetch: Tweak to work on Fedora40
On Fedora40, "localhost" sometimes resolves to ::1 and sometimes to 127.0.0.1
and python only binds to one of the addresses, leading to test failures.

Use 127.0.0.1 explicitly to avoid problems of the name resolution, we're trying
to test things other than the host networking.

(Bitbake rev: 9adc6da42618f41bf0d6b558d62b2f3c13bedd61)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Richard Purdie
f81127b619 bitbake: fetch2/wget: Fix failure path for files that are empty or don't exist
When we intercepted the file download to a temp file, we broke the
exist/size checks which need to happen before the rename. Correct
the ordering.

For some reason, python 3.12 exposes this problem in the selftests
differently to previous versions.

(Bitbake rev: c56bd9a9280378bc64c6a7fe6d7b70847e0b9e6d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Joshua Watt
c2d2ae7b1d bitbake: hashserv: client: Fix changing stream modes
When switching from normal mode to stream mode, skip calling
self._set_mode() again because this will cause a recursion into the
_set_mode() function and causes problems.

Also cleanup some of the error checking during this process

This bug affected when a client would attempt to switch from one stream
mode to another, and meant that the server would get an invalid message
from the client. This would cause the server to disconnect the client,
and the client would then reconnect in normal mode which was the mode it
wanted anyway and thus it would carry on without any errors. This made
the bug not visible on the client side, but resulting in a lot of
backtrace JSON decoding exceptions in the server logs.

(Bitbake rev: 1826bc41ab3369ac40034c5eaf698748b769b881)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Joshua Watt
5a308474c2 bitbake: siggen: Batch unihash_exists checks
Similar to looking up unihashes, use the batch API when checking if a
unihash exists to speed up lookups

(Bitbake rev: 0ac521ff37b578f7487bca0eccc7dc9e5974991b)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Joshua Watt
247d08ae07 bitbake: asyncrpc: Remove ClientPool
Batching support on the client side has proven to be a much more
effective way of dealing with server latency than multiple client
connections and is also much nicer on the server, so drop the client
pool support from asyncrpc and the hash server

(Bitbake rev: 6f80560f1c7010d09fe5448fdde616aef8468102)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Joshua Watt
f618d1dfd7 bitbake: siggen: Drop client pool support
Drops support for client pools, since batching support in the client
code has proven to be much more effective

(Bitbake rev: 85dafaf8e070459f7de7bfb37300d8b60a27002e)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Richard Purdie
2ff7af74bc bitbake: bitbake: Drop older python version compatibility code
cooker: We can call multiprocessing close() unconditionally and tweak a
comment give 3.8 is now the minimum version.

lib/bb: We can drop the logger addition code only needed before 3.6

asyncrpc/hashserv: Since the minimum version is 3.8, we can drop the
conditional code.

(Bitbake rev: 16f4386400f88ba50605307961c248bef09895c1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Richard Purdie
277e07d1cc bitbake: cooker: Improve handling errors during parsing when profiling
We've seeing profiling tracebacks when parse errors occur during
profiling. Try and avoid these but not processing invalid profiles.

(Bitbake rev: 171bd9dd575307fbd61b5179ad86131d76add067)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 16:56:25 +01:00
Richard Purdie
eacebfc169 bitbake: lib/bs4: Avoid soupsieve warning
(Bitbake rev: 8e444cd9913d1ee0672b5583e263e5927c3221df)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 13:09:54 +01:00
Richard Purdie
12fa81e8d6 bs4: Update to 4.12.3 from 4.4.1
It makes sense to switch to a more recent version and keep up to date
with upstream changes and things like new python version support.

(Bitbake rev: f5462156036e71911c66d07dbf3303cde862785b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-31 12:43:18 +01:00
Joshua Watt
e16d690e77 bitbake: hashserv: server: Add support for SO_REUSEPORT
SO_REUSEPORT is a socket option that allows multiple servers to listen
on the same TCP port, and the kernel will automatically load balance the
connections between them. This is particularly helpful for the hash
server since it runs in a single thread. To take advantage of a
multi-core server, multiple servers can be started in parallel with this
option (up to 1 per CPU) and the kernel will load balance between them.

(Bitbake rev: d72d5a7decb489e2af0ebc43cfea0ca3e4353e9b)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-30 07:38:10 +01:00
Joshua Watt
76a63bd031 bitbake: siggen: Enable batching of unihash queries
Uses the batching API of the client to reduce the effect of latency when
making multiple queries to the server

(Bitbake rev: a54734b4ac2ddb3bce004e576cf74d6ad6caf62a)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-30 07:38:10 +01:00
Joshua Watt
29c2cd4d54 bitbake: hashserv: client: Add batch stream API
Changes the stream mode to do "batch" processing. This means that the
sending and reciving of messages is done simultaneously so that messages
can be sent as fast as possible without having to wait for each reply.
This allows multiple messages to be in flight at once, reducing the
effect of the round trip latency from the server.

(Bitbake rev: e768d0f17bdb97f6ff013ec3a41f182fecd47a55)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-30 07:38:10 +01:00
Joshua Watt
d31c64296d bitbake: bb: Use namedtuple for Task data
Task dependency data is becoming unwieldy with the number of indices it
contains. Convert it to use a named tuple instead, which allows members
to be indexed by a named property or an index (which allows it to retain
backward compatibility).

(Bitbake rev: 26446cca4d22734c3f1b328a205c169dadb7e494)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 23:46:21 +01:00
Joshua Watt
e598b2d135 bitbake: bitbake-hashclient: Improve ping command line options
Adds a --quiet option to suppress the message for each ping, and report
the median ping time.

(Bitbake rev: 3c85b5e2d9b9c39507ed362aaa115b7f6f155966)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 23:46:21 +01:00
Richard Purdie
e9400f091c bitbake: runqueue: Improve rehash get_unihash parallelism
Improve the rehash code to query unihashes in parallel since this is more
efficient on slower links.

(Bitbake rev: c1949d5350342eaaf6ab988d7bfba99496d55523)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 23:46:21 +01:00
Richard Purdie
6a0a2c4618 bitbake: runqueue: Process unihashes in parallel at init
Improve the runqueue init code to call unihash queries in parallel since
this is faster and more efficient, particularly on slower links with longer
round trip times.

The call to the function from cooker is unneeded since that function calls
prepare() and hence this functionality will already have run, so drop
that obsolete call.

(Bitbake rev: 721c97a115a7a4bf21955be79391bd6e0099f40e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 23:46:21 +01:00
Richard Purdie
d89b436835 bitbake: runqueue: Allow rehash loop to exit in case of interrupts
The initial hash serve loop exits in the case where interrupts are present
but probably checks a bit too often. Tweak that and also allow the slow
rehash loop to break on interrupt, improving bitbake Ctrl+C response.

(Bitbake rev: 4534365591fd17bcc2b684900863b67bc69519ae)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 23:46:21 +01:00
Richard Purdie
2824b5e667 bitbake: runqueue: Add timing warnings around slow loops
With hashserve enabled, there are two slow paths/loops, one at initial runqueue
generation and also during the rehash process when new outhashes are found.

Add timing information at the hashserve log level for when these loops
take longer than 30s or 60s overall. This will leave evidence in the logs when
things are running particularly slowly.

(Bitbake rev: 6c357ede08e0b2a93bdaad2c1d631994faf2b784)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 23:46:21 +01:00
Marlon Rodriguez Garcia
1d86845c41 bitbake: ui/buildinfohelper: Add exception treatment to fix missing target_file
Based on the discution on  https://lists.yoctoproject.org/g/toaster/message/6157
in some cases the value for Target_file could be missing and is needed to bypass
it to finish build.

(Bitbake rev: c60f6d20911632b41473f7c8577949be2f99ad80)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 09:43:51 +01:00
Joshua Watt
5f602c1bd5 bitbake: bitbake-hashclient: Improve stress statistics reporting
Improves the way statistics are reported for the stress test. This makes
it easier to compare them to the ping test

(Bitbake rev: ce166ae25793c11b0a190c531bef0c296fd74497)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-23 11:27:08 +01:00
Joshua Watt
76421d5742 bitbake: bitbake-hashclient: Add ping command
Adds a ping subcommand to bitbake-hashclient which can be useful to
measure connection latency

(Bitbake rev: 337487fdffae92091fc33b2346d46c39db5a130f)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-23 11:27:08 +01:00
Richard Purdie
7812f104db bitbake: fetch/npmsw: The fetcher shouldn't have any knowledge of S
I don't know why there is hardcoded knowledge of S in the fetcher but there
shouldn't be and the OE unpack changes highlight this doing things it
shouldn't.

Drop the S reference and use rootdir which is the only place it should
be touching.

(Bitbake rev: 84f102954e10a3390fca9c26d5c3c639e952a2c9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-23 11:27:08 +01:00
Michael Opdenacker
fa9689923f bitbake: prserv: add bitbake selftests
Run them with "bitbake-selftest prserv.tests"

(Bitbake rev: 34287fbf3d6be813aa5b767f540e4662f0d8d18d)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
ae0725577d bitbake: prserv: import simplification
Simplify the importone() hook:
- to make it independent from the "history" mode which is
  client specific.
- remove the "history" parameter
- we want all values to be imported for binary
  reproducibility purposes.
- using the store_value() function (which warrants
  you don't save the same value twice and doesn't write
  when you're using a read-only server) is enough.

(Bitbake rev: 000704a53470ab1ead840403b5531f22ebf1fd49)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
3be2201de5 bitbake: prserv: store_value() improvements
Add a test_checksum_value() to test whether
a (version, pkgarch, checksum, value) entry already
exists in the database.

This is used to protect the store_value() function from
an error when trying to store a duplicate entry in the database.

Also check whether the current database is open in read-only mode.

(Bitbake rev: b7f6c085a7cf8ac83695242a0299e2d5f7abc69a)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
0d6dd343de bitbake: prserv: avoid possible race condition in database code
Remove a possible race condition by allowing a read-only
server to create the PR table anyway. This avoids a failure
if both a read-only and read-write server try to access
an empty database at the same time.

(Bitbake rev: b171caec5ebbe579bf4b8b2005930240ae5c8ce2)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Suggested-by: Joshua Watt <jpewhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
65757c9e20 bitbake: prserv: enable database sharing
sqlite3 can allow multiple processes to access the database
simultaneously, but it must be opened correctly. The key change is that
the database is no longer opened in "exclusive" mode (defaulting to
shared mode). In addition, the journal is set to "WAL" mode, as this is
the most efficient for dealing with simultaneous access between
different processes. In order to keep the database performance,
synchronous mode is set to "off". The WAL journal will protect against
incomplete transactions in any given client, however the database will
not be protected against unexpected power loss from the OS (which is a
fine trade off for performance, and also the same as the previous
implementation).

The use of a database cursor enabled to remove the _execute() wrapper.
The cursor automatically makes sure that the query happens in an atomic
transaction and commits when finished.

This also removes the need for a "dirty" flag for the database and
for explicit database syncing, which simplifies the code.

(Bitbake rev: 385833243c495dc68ec26a963136c1ced3f272d0)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
4cbce9cdf7 bitbake: prserv: add "upstream" server support
Introduce a PRSERVER_UPSTREAM variable that makes the
local PR server connect to an "upstream" one.

This makes it possible to implement local fixes to an
upstream package (revision "x", in a way that gives the local
update priority (revision "x.y").

Update the calculation of the new revisions to support the
case when prior revisions are not integers, but have
an "x.y..." format."

Set the comments in the handle_get_pr() function in serv.py
for details about the calculation of the local revision.

This is done by going on supporting the "history" mode that
wasn't used so far (revisions can return to a previous historical value),
in addition to the default "no history" mode (revisions can never decrease).

Rather than storing the history mode in the database table
itself (i.e. "PRMAIN_hist" and "PRMAIN_nohist"), the history mode
is now passed through the client requests. As a consequence, the
table name is now "PRMAIN", which is incompatible with what
was generated before, but avoids confusion if we kept the "PRMAIN_nohist"
name for both "history" and "no history" modes.

Update the server version to "2.0.0".

(Bitbake rev: 48857ec3e075791bd73d92747c609a0a4fda0e0c)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
5f99010e41 bitbake: prserv: move code from __init__ to bitbake-prserv
This script was the only user of this code.

(Bitbake rev: 19a5595e3f70d61fd6fa414f9fd5b413a02de37b)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Michael Opdenacker
48d38aef22 bitbake: prserv: declare "max_package_pr" client hook
Add missing declaration for the max_package_pr client hook

(Bitbake rev: 0d4443359ec38ff98b7fbae0b0948d14f74523ce)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:23:43 +01:00
Antonin Godard
1aa8276c64 bitbake: tests.codeparser: add tests for shell expansions
Tests quotes around `` and $() expansions, nested and multiple
expansions, and that escaped quotes are treated as characters by the
parser.

(Bitbake rev: d98130cb4d500c495bc692c56dde3e019f36320a)

Signed-off-by: Antonin Godard <antoningodard@pm.me>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:14:41 +01:00
Antonin Godard
dd98d156ca bitbake: codeparser: remove redundant list conversion
(Bitbake rev: 89712949de9476e4674864a8dcd6862fefe92eae)

Signed-off-by: Antonin Godard <antoningodard@pm.me>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:14:41 +01:00
Antonin Godard
03742d7cb3 bitbake: codeparser: support shell substitutions in quotes
The current shell substitution mechanism only works without quotes. For
example:

  var1=$(cmd1 ...)

Will work and add `cmd1` to the correspondind `run.do_*` file.

However, although quite common, this syntax is not supported:

  var1="$(cmd1 ...)"

This commit adds this feature by adding a step to process_words() to
check whether we are dealing with quotes first, and by iterating on
what's between them to detect new shell substitution candidates. These
candidates are tested and parsed like before in the next step. The
original `part` being part of the candidates means the syntax
var1=$(cmd1 ...) is still valid.

(Bitbake rev: f56e1a37b2ba1773ed308043d7eb073cc2e6c06e)

Signed-off-by: Antonin Godard <antoningodard@pm.me>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-21 14:14:41 +01:00
Richard Purdie
4758e1c43a bitbake: cooker: Ensure generateTaskDepTreeData fails for NoProvider
If an invalid provider is requested, error out early rather than trying
to build partial runqueue data structures as the taskdep UI will have
exited after seeing the bad provider.

(Bitbake rev: a478087998cb794cc4e31189b3ce07973d3949bc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-17 11:56:40 +01:00
Richard Purdie
92d8c7c553 bitbake: parse: Improve/fix cache invalidation via mtime
We have been seeing obscure failures in devtool, particularly on newer
autobuilder workers where it appears the cache is assumed to be valid
when it shouldn't be.

We're using the 'seconds' granulation mtime field which is not really
a good way of telling if a file has changed. We can switch to the "ns"
version which is better however also add in inode number and size as
precautions. We already have all this data and tuples are fast so there
isn't really any cost to do so.

This hopefully fixes [YOCTO #15318].

(Bitbake rev: d9e5d313c79500e3c70ab9c3239b6b2180194f67)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-16 23:25:55 +01:00
Richard Purdie
229951e1da bitbake: asyncrpc/client: Fix websockets minimum version for python 3.10
python 3.10 support is only available in websockets 10.0 and later:

08d8011132

Update the version for this case. This avoids failures on Ubuntu 22.04.

(Bitbake rev: 0e4767c4a880408750e1a6855270c5a4eef8383d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-16 10:52:43 +01:00
Richard Purdie
f4885e97a6 bitbake: bitbake: update to version 2.9.1
This allow the use of new siggen API

(Bitbake rev: e53503546990adeab67b6d044fcce59dc5a3f455)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:53:01 +01:00
joshua Watt
23c5058707 bitbake: asyncrpc: Check websockets version
Checks that the minimum version of the websockets module is present, and
if not raises an ImportError. This allows the user to get earlier
feedback if using websockets is going to succeed

(Bitbake rev: 330ea6914aad65dc8b34c986c44779820c392f03)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:44 +01:00
joshua Watt
aff8b07334 bitbake: cooker: Handle ImportError for websockets
Handles ImportError when creating a hash equivalence to ping the server.
This notifies user earlier with a more precise error if websockets can't
be used, and also prevents passing a known bad upstream value to the
local server

(Bitbake rev: aa80b3cfc5d16dfba13ca7fb9b78bae179ce3b74)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:44 +01:00
joshua Watt
8364aa5baa bitbake: siggen/runqueue: Report which dependencies affect the taskhash
Report which task dependencies in BB_TASKDEPDATA are included in the
taskhash. This allows tasks to identify which tasks dependencies may
change without the task re-running. Knowing this information is
important for tasks that want to transfer information from dependencies
(such as SPDX)

(Bitbake rev: a313b4f07727e8187526157ba039911c3f73dd46)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:43 +01:00
Kari Sivonen
9925db0c4f bitbake: fetch2/svn: Fix mirroring issue with svn
Add return false to supports_checksum for svn fetcher which fhis
fixes MIRROR usage for svn uris. Also add a testcase.

[YOCTO #15473]

(Bitbake rev: 21cfc7ae9a19f39ac8904e1c3466e7e499ac523f)

Signed-off-by: Kari Sivonen <kari.sivonen@live.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:43 +01:00
Richard Purdie
ead0ff2210 bitbake: build: Handle conflict between cwd and cleandirs
If the cwd of the task is also a cleandirs, you would see warnings from bitbake
about being unable to obtain cwd during the task execution. Tweak the code
to detect this and avoid the warnings.

(Bitbake rev: 6c7fd60c10955b0f23f64b25b5b4e154eb22a8f8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:43 +01:00
Alexander Kanavin
551fdabc54 bitbake: fetch2/crate: add upstream latest version check function
This is actually rather easy: crate web API provides a json
with all the versions, for example:
https://crates.io/api/v1/crates/cargo-c/versions

(Bitbake rev: f6c2755db9a1f88c8534193b420fa31d135945e6)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:43 +01:00
Simone Weiß
f6de2b033d bitbake: bitbake-layers: adapt force option to not use tinfoil
Fixes [YOCTO #15417]

When a layer adds a new dependency after it was added to a conf, it can not be
removed w/o this dependency in the setup. Even the dependent layer can not be
added, as the tinfoil setup will fail.
Adapt --force to not perform the tinfoil at all, the use will be at own risk,
i.e. the added layers might not parse properly afterwards.
This is not merged into the force option with -F as it even changes the loading of
plugins from other layers and is hence even more invasive as force. Instead
force can now be speciefied multiple times and is counted.

(Bitbake rev: 541fa7f582133949563e65f2d43c4b16e873e5c1)

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-08 14:51:43 +01:00
joshua Watt
e4ddff1399 bitbake: cooker: Use hash client to ping upstream server
The cooker attempts to connect to the upstream hash equivalent server to
warn the user early if it is misconfigured. However, this was making the
assumption that it was a raw TCP connection and failed when attempting
to use a websocket upstream server. Fix this by creating an hash client
and using the ping API to check the server instead of using a raw
socket.

(Bitbake rev: 5e84c13a6c594ed34c341849806657ddda206714)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-02 16:07:21 +01:00
Sven Schwermer
25dcc55b74 bitbake: fetch2/gcp: Add missing runfetchcmd import
This adds the missing import. This bug was introduced with 1ab1d36c.

(Bitbake rev: 97ffe14311407f6e705ec24b70870ab32f0637b9)

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-20 07:30:29 +01:00
Richard Purdie
ae3bca8492 bitbake: bitbake: Bump to version 2.9.0 development version postrelease
(Bitbake rev: 67a1aa8dbb3cb3a30fa7d697431ebb30323e4f28)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-16 08:12:27 +01:00
Richard Purdie
3bbe0a45b4 bitbake: bitbake: Bump to version 2.8.0
(Bitbake rev: c86466d51e8ff14e57a734c1eec5bb651fdc73ef)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-16 07:38:22 +01:00
Joshua Watt
e0f79072dc bitbake: hashserv: client: Fix mode state errors
Careful reading of the code can contrive cases where poorly timed
ConnectionError's will result in the client mode being incorrectly reset
to MODE_NORMAL when it should actual be a stream mode for the current
command. Fix this by no longer attempting to restore the mode when the
connection is setup. Instead, attempt to set the stream mode inside the
send wrapper for the stream data, which means that it should always end
up in the correct mode before continuing.

Also, factor out the transition to normal mode into a invoke() override
so it doesn't need to be specified over and over again.

(Bitbake rev: 0cd276fd98eeca463518d4a42675fffb18d6b3de)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-16 07:33:19 +01:00
Joshua Watt
2ecd97fa59 bitbake: siggen: Capture SSL environment for hashserver
Now that the bitbake hash server supports SSL connections, we need to
capture a few environment variables which can affect the ability to
connect via SSL. Note that the variables are only put in place to affect
the environment while actually invoking the server

[RP: Tweak to use BB_ORIGENV as well]
[RP: Tweak to handle os.environ restore correctly]
(Bitbake rev: 0bacf6551821beb8915513b120ae672ae8eb1612)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-16 07:33:19 +01:00
Richard Purdie
6bd8367aa9 bitbake: BBHandler: Handle unclosed functions correctly
A function accidentally defined as:

somefunction() {
	:
 }

which is unclosed due to the space at the end, would currently silently
cause breakage. Have the parser throw and error for this.

[YOCTO #15470]

(Bitbake rev: a7dce72da6be626734486808f1b731247697e638)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
9889a0ff1a bitbake: prserv: remove unnecessary code
In db.py, the ifnull() statement guarantees that the SQL request will
return a value. It's therefore unnecessary to test the case when no
value is found.

(Bitbake rev: e4ae5177861c9a27e93e5a2d3a6c393baecd6416)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
f2a83b50b3 bitbake: prserv: correct error message
according to db.py, prserv.NotFoundError is returned here when
adding a new value to the database failed

(Bitbake rev: 4cc4069987edd14f51715dfaf0c6e1a3aa307106)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
d19e32dcd7 bitbake: prserv: remove redundant exception handler
This exception handler is already present in db.py's get_value() code.

(Bitbake rev: 2fd38b1bb685ec441f0eb0f28f3d84ba252ba90b)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
112a37e6a9 bitbake: prserv: add extra requests
Useful for connecting a PR server to an upstream one

- "test-package" checks whether the specified package
  version and arch is known in the database.

- "test-pr" checks a specified output hash is found in the database.
  Otherwise it returns 'None' instead of a new value.

- "max-package-pr" returns the highest PR number for
  (version, arch) entries in the database, and None if not found

Add new DB functions supporting the above, plus test_value()
which tells whether a given value is available for the specified
package and architecture.

(Bitbake rev: 0f1474a30f741b760ca81c19dd1d8f3bd5647251)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
62a3a7172a bitbake: prserv: capitalization and spacing improvements
Choosing only one style of capitalization
Add extra space after some commas too
Remove idle spaces

(Bitbake rev: daad17bccec8cb98ef2fca4262641167500bd46e)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
d133dc7e77 bitbake: asyncrpc: include parse_address from hashserv
Moving the code and related definitions from
hashserv/__init__.py to asyncrpc/client.py,
allowing this function to be used in other asyncrpc clients.

(Bitbake rev: b67bb05e431414866b8e8c6a4c88d20b9cdb44a3)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Suggested-by: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
9a2d08995e bitbake: prserv: use self.logger instead of logger directly
In both the PRServerClient and PRClient objects.

This aligns with what is done in hashserv/server.py and makes it
possible to benefit from possible specializations of the logger
in the corresponding super classes, instead of using
always the global logger.

(Bitbake rev: 5fc6d2b1a5db617e16c1eb9fbd25e821237611d8)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
d57e17425e bitbake: bitbake-prserv: replace deprecated optparse by argparse
optparse is deprecated since Python 2.7

Note that this is neither supposed to change the options
supported by bitbake-prserv nor the way they are interpreted.

Note that in the "--help" output, long options are now reported
for example as "--host HOST" instead of "--host=HOST" but
both are equivalent anyway, as they already were with optparse.

(Bitbake rev: 434cd00a9e5a8ef32088f1a587005adf910a92eb)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
4b1ef692a9 bitbake: prserv: use double quotes by default
To aligh with the hashserv code

(Bitbake rev: 7a6999750791659eaffe49aabfbfba9f37f51913)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Michael Opdenacker
8d78b5f9c5 bitbake: prserv: simplify the PRServerClient() interface
serv.py: simplify the PRServerClient() interface by passing the
server object instead of multiple arguments, and then retrieving
the data through this object.

This replicates what is done for ServerClient() in hashserv/server.py

(Bitbake rev: d3be073218feb4d6e68a751832da4936da485dbc)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-14 06:31:45 +01:00
Richard Purdie
e1365064be bitbake: doc/user-manual: Add BB_LOADFACTOR_MAX
Document BB_LOADFACTOR_MAX which was recently added.

(Bitbake rev: 833b76e9333e317cab5f17d6f7daaecc89c69547)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-12 17:23:27 +01:00
Simone Weiß
793b31dbf4 bitbake: doc: Add section for variable context
This is inspired by the same section in the yocto-docs. It aims to provide
information in what contexts(recipes, .conf, bbclass,...) a variable is usually
used. For that I tried to group similar variables, so that a short overview is
given. This was inspired by [YOCTO #14072], but of course does not implement a
warning if a variable is used in an unintended context.

(Bitbake rev: 5ced476685376b1a32b7fdd9546f9b61c5962aa0)

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-11 14:53:15 +01:00
Rob Woolley
c0cd7a6d3b bitbake: wget: Make wget --passive-ftp option conditional on ftp/ftps
Fedora 40 introduces wget2 as a drop-in replacement for wget.  This
rewrite does not currently have support for FTP.  This causes
the wget fetcher to fail complaining about an unrecognized option.

Making --passive-ftp conditional based on the protocol used in
the SRC_URI limits the scope of the problem.  It also gives us
an opportunity to build the older wget as a host tool.

(Bitbake rev: f10e630fd7561746d835a4378e8777e78f56e44a)

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-11 08:47:07 +01:00
Joshua Watt
f2ff622a4c bitbake: bitbake-hashclient: Warn on bad .netrc
If there is an error parsing .netrc, warn the user on stderr

(Bitbake rev: 6366ea8d9c284d10bb8f4129004b55239d9022c0)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-26 17:11:15 +00:00
Joshua Watt
978206fed4 bitbake: siggen: Add support for hashserve credentials
Adds support for hashserver credentials to be specified in the
SignatureGenerator

(Bitbake rev: 741bef3755fde7bae1386aad575ea704d9fe0969)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-23 10:19:00 +00:00
Derek Erdmann
825055e83e bitbake: fetch2/git: Install Git LFS in local repository config
Git uses a lock file to prevent concurrent modifications to the global
config, so if unpack tasks for different recipes try to run "git lfs
install" simultaneously the operation can fail:

    error: could not lock config file /home/build/.gitconfig: File exists exit status 255
    Run `git lfs install --force` to reset Git configuration.

Adding "--local" sets the smudge and clean filters in the local
repository's config instead of modifying the user's global config.

(Bitbake rev: 328ca4de8422be514fa0d0c9e3cfd36bb9d3e9a7)

Signed-off-by: Derek Erdmann <derek.erdmann@sonos.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:46 +00:00
Yang Xu
64057e6b15 bitbake: bitbake-worker: Fix silent hang issue caused by unexpected stdout content
This patch addresses an issue in bitbake-worker where stdout,
reserved for status reporting, is improperly accessed by child processes.

The problem occurs during the execution of parseRecipe,
which calls anonymous functions. If these functions use print-like operations,
they can inadvertently output data to stdout. This unexpected data can cause
the runqueue to hang silently, if the stdout buffer is flushed
before exec_task is executed.

To prevent this, the patch redirects stdout to /dev/null and ensures it is
flushed prior to the execution of exec_task.

(Bitbake rev: 08f3e677d6af27a41a918aaa9da9c1c9b20a0b95)

Signed-off-by: Yang Xu <yang.xu@mediatek.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:46 +00:00
Felix Moessbauer
9504df41f9 bitbake: utils: better estimate number of available cpus
When running in a cgroup which is limited to a subset of cpus (via
cpuset.cpus), cpu_count() should return the number of cpus that can be
used instead of the number of cpus the system has.

This also aligns the semantics with nproc.

(Bitbake rev: a029bfe96c6542f178720c72a772b7ede9898118)

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Viswanath Kraleti
3a97792820 bitbake: fetch2: Fix misleading "no output" msg
When a command is run with a non-null log, errors are only output to the
log and are not returned in the exception. In that case direct users to
that logfile instead of telling the command had no output.

(Bitbake rev: 944fe0a77932a5559e01ae6035c4bffa5185ea6a)

Signed-off-by: Viswanath Kraleti <quic_vkraleti@quicinc.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Ross Burton
e20ee877ed bitbake: fetch2: handle URIs with single-valued query parameters
Whilst typically the URI query is a list of key-value pairs, that's not
actually required by the URI specification.

For example:  http://example.com/foo?bar is a valid query, but this will
result in the fetcher raising an exception:

  File "bitbake/lib/bb/fetch2/__init__.py", line 265, in __init__
    self.query = self._param_str_split(urlp.query, "&")
  File "bitbake/lib/bb/fetch2/__init__.py", line 293, in _param_str_split
    for k, v in [x.split(kvdelim, 1) for x in string.split(elmdelim) if x]:
ValueError: not enough values to unpack (expected 2, got 1)

In this case the query is just "bar", but the fetcher is trying to split
it into a key-value pair.

The URI object exposes the parsed query explicitly as a dictionary of
key-value pairs, so we have to be a little creative here: if a value is
None then it isn't a key-value pair, but a bare key.

Fix this by handling elements without the deliminator in _param_str_split()
(by assigning the value to None), and handle a None value when formatting
the query in _param_str_join().

(Bitbake rev: eac583bd4c46f3bb9661852cb6a1448f16147ff1)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Peter A. Bigot
adb0ea98d1 bitbake: lib/bb: support NO_COLOR
Red text on a black background can make it difficult for people with
visual impairments to read the text of error messages.  Respect the
presence of a non-empty NO_COLOR environment variable as an indication
the user doesn't want colorization to be automatically enabled.

See: https://no-color.org/
(Bitbake rev: d9986c54cd3d67ed1f7cb636b17696c8d0d4db85)

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Philippe Rivest
2eeef2800b bitbake: bitbake: fetch2/git: Escape parentheses in git src name
FIXES [YOCTO #15404]

When using git fetcher on a repo with parentheses in its URL, the
invocation of the git clone command will fail. The clone directory
is not quoted thus the shell will return an error and won't execute
the command.

(Bitbake rev: b5624ee564)

Cc: Philippe Rivest <privest@genetec.com>

(Bitbake rev: 12f9738577934ad7c99f0770f1392a9d6050e7d6)

Signed-off-by: Philippe Rivest <technophil98@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
david d zuhn
ecb1248914 bitbake: bitbake-worker: allow '=' in environment variable values
Limit the split to key & value (2 items) instead of the n items one
can get if there are '=' characters in the value.

Fixes [YOCTO #15447]

(Bitbake rev: 86315961829ab1d137a0265cc246c44d3929e1fb)

Signed-off-by: david d zuhn <david.zuhn@sonos.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Sava Jakovljev
0acdb81ca6 bitbake: bitbake-worker: Fix bug where umask 0 was not being applied to a task
* In the current implementation, "umask" variable is initially set to
  None and overwritten with user-specified value. However, in the worker
  implementation, a faulty if clause would only check whether the
  variable contains a value that evaluates to True, and not whether
  the variable is defined, so the value of 0 would lead to umask not
  being changed.
  This bug makes it impossible to have a task set its umask to value 0,
  for any possible reason it may want to.
  Fix this bug by extending the condition checked in the worker
  implementation.

(Bitbake rev: 19f9df6c750c592316a0fa18165b68636281fe3e)

Signed-off-by: Sava Jakovljev <sjakovljev@outlook.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Alexander Kanavin
98d09d41fa bitbake: bitbake: improve descriptions of '-S printdiff'
(Bitbake rev: becf88c2250a47102c8d36ad8b40839e0bfa9137)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Michael Opdenacker
be10de3423 bitbake: utils: remove BB_ENV_PASSTHROUGH from preserved_envvars()
preserved_envvars() is used when the BB_ENV_PASSTHROUGH
environment variable is not set. Therefore, its code shouldn't
return this variable.

(Bitbake rev: 0a33b560233b983456178541603ab96fea22238b)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-05 12:25:08 +00:00
Yoann Congal
ef88dee4f7 bitbake: prserv/serv: Fix a PID file removal race on prserv stop
A race condition has happened where the exiting server removed the PID
file between the existence check and the removal, resulting in a
FileNotFoundError exception.

The fix is to ignore the FileNotFoundError exception, the existence
check is now redundant so remove it to simplify.

Fixes [YOCTO #14341]

(Bitbake rev: 40d00bf9308e0bf73a00134a99a012a292daa1c5)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-03 16:26:17 +00:00
Richard Purdie
2689d8cf22 bitbake: fetch/git: Avoid clean upon failure
Currently when git fetches fail, it destroys all the existing local clone data.
For large repositories this can introduce long build delays when for example,
you just typo'd the git revision hash.

The git fetcher should be able to recover most directories so when the fetch is
for a git repo, avoid removing things unless clean is explicitly called
(e.g. a -c cleanall task).

(Bitbake rev: 1b3cd039fe19b24bd4be9a0202a98cdcbb0e9443)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-03 16:26:17 +00:00
Ulrich Ölmann
a32b45289b bitbake: taskexp_ncurses: fix execution example in introductory comment
Drop the ".py" file extension from the "-u" option's argument that has been
overlooked while applying the original patch (see [1]) to make the example work.
While at it sort the recipes' names consistently with respect to what is found
in the self-test examples below.

[1] https://lore.kernel.org/bitbake-devel/6f2645a7c4db2ae149d387544d2b94209cfed3f4.camel@linuxfoundation.org/

(Bitbake rev: 1f4d517b7a0389f78d1f791135f8dc9120e9912b)

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-28 09:21:48 +00:00
Joshua Watt
be57fda542 bitbake: asyncrpc: Add support for server headers
Adds support for asyncrpc servers to send connection headers to clients
on connection. Since this is a breaking protocol change, clients must
opt-in to expect headers from the server, corresponding to a version
bump in the client protocol.

(Bitbake rev: 1cb2b8be6cc5269553f549285592e47b7d29db03)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-27 11:36:38 +00:00
Tim Orling
2841449527 bitbake: layerindexlib: fix missing layer branch backtrace
When a LayerBranch (a specific layer at a specific release) does not
exist in the layerindex database ("Layerindex Metadata"), the dependency
would throw a backtrace. Instead fail early and provide an error message.

Since layerindexlib will also check the local layers, inform the user that
a local checkout might resolve the situation. Recommend that they reach
out to the layer maintainers and layer index admins to properly fix it for
everyone.

While we are here, remove some trailing whitespace.

[YOCTO #15365]
[YOCTO #13954]

(Bitbake rev: 96cbe8f87209a927c157ebcf469f8b9d54fcf92e)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-27 11:36:38 +00:00
Philip Lorenz
0e3bcc5103 bitbake: fetch2: Ensure that git LFS objects are available
The current implementation only performs a git lfs fetch alongside of a
regular git fetch. This causes issues when the downloaded revision is
already part of the fetched repository (e.g. because of moving back in
history or the updated revision already being part of the repository at
the time of the initial clone).

Fix this by explicitly checking whether the required LFS objects are
available in the downloade directory before confirming that a downloaded
repository is up-to-date.

This issue previously went unnoticed as git lfs would silently fetch the
missing objects during the `unpack` task. With network isolation turned
on, this no longer works, and unpacking fails.

(Bitbake rev: cfae1556bf671acec119a6c8bbc4b667a856b9ae)

Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-23 14:34:05 +00:00
Enguerrand de Ribaucourt
fff242b5d2 bitbake: bitbake: progressbar: accept value over initial maxval
There is a very rare case where the maxval is improperly computed
initially for cache loading progress, and the value will go over.

Explanation from bitbake/lib/bb/cache.py:736 in MulticonfigCache:__init__:progress()
    # we might have calculated incorrect total size because a file
    # might've been written out just after we checked its size

In that case, progressbar will receive a value over the initial maxval.
This results in a ValueError stack trace as well as bitbake returning 1.
    Traceback (most recent call last):
    File ".../poky/bitbake/lib/bb/ui/knotty.py", line 736, in main
        cacheprogress.update(event.current)
    File ".../poky/bitbake/lib/progressbar/progressbar.py", line 256, in update
        raise ValueError('Value out of range')
    ValueError: Value out of range

This fix mirrors the behavior of MulticonfigCache and accepts the new
value as the new maxval. This is also what the percentage printout
is doing in bitbake/lib/progressbar/progressbar.py:191 in ProgressBar:percentage()

I encountered this issue randomly while working on a project with
VSCode saving files while commands where fired.

Note: This file is a fork from python-progressbar. It hasn't been
refreshed in 8 years. We did only two commits, 5 years ago with minor
modifications. This new change is also not how the upstream project is
behaving.

(Bitbake rev: 7cea7f7a87da041fc1ad370c5c3d15aabad3a0d4)

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-23 14:34:05 +00:00
Richard Purdie
08aa69a1fd bitbake: runqueue: Add support for BB_LOADFACTOR_MAX
Some ditros don't enable /proc/pressure and it tends to be those which we
see bitbake timeout issues on, seemingly as load gets too high and the bitbake
processes don't get scheduled in for minutes at a time.

Add support for stopping running extra tasks if the system load average goes
above a certain threshold by setting BB_LOADFACTOR_MAX.

The value used is scaled by CPU number, so a value of 1 would be when
the load average equals the number of cpu cores of the system, under one
only starts tasks when the load average is below the number of cores.

This means you can centrally set a value such as 1.5 which will then
scale correctly to different sized machines with differing numbers
of CPUs.

The pressure regulation is probably more accurate and responsive, however
our graphs do show singificant load spikes on some workers and this
patch is aimed at trying to avoid those.

Pressure regulation is used where available in preference to this load
factor regulation when both are set.

(Bitbake rev: 14a27306f6dceb4999c2804ccae5a09cc3d8dd49)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-23 14:34:05 +00:00
Tobias Hagelborn
42242fb9ef bitbake: hashserv: Re-enable connection pooling with psycopg 3 driver
Re-enable connection pooling in case `postgresql+psygopg` driver
is used. Async connection pooling is supported in psycopg 3 [psycopg]
driver in SQLAlchemy. Allow the connection pool to grow to
arbitrary size.

(Bitbake rev: 4fe05513b5314c201725e3f8ad54f58d70c56258)

Signed-off-by: Tobias Hagelborn <tobiasha@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-23 14:34:05 +00:00
Alexander Kanavin
730bd999d6 bitbake: Revert "bitbake: wget.py: always use the custom user agent"
This reverts commit 987ab2a446.

There's been a report that this breaks downloads from Jfrog Artifactory
as self.user_agent is set to 'Mozilla Firefox', and when Artifactory
sees that, it sends a response tailored for showing in an interactive browser
(which in my opinion it has every right to).

If we're using wget, we should say so via wget's default; handling uncooperative
servers should be done on per-recipe basis, and ideally with tickets
to admins of those servers.

(Bitbake rev: feef5cd12e877f42ffcace168d44b0e6eb80a907)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-20 12:56:40 +00:00
Peter Kjellerstedt
d25f6b970f bitbake: fetch2/git: Make latest_versionstring extract tags with slashes correctly
Before, everything up to the last slash was removed when extracting the
names of the tags. This would lead to that a tag such as "agent/11.0.0"
would be incorrectly identified as "11.0.0", which would then be treated
as a correct version matching "^(?P<pver>\d+(\.\d+)+)".

(Bitbake rev: 8b21024b9966d5158ac4a77e87ffb935c2a57764)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 15:08:30 +00:00
Peter Kjellerstedt
9694fe1d68 bitbake: fetch2/git: A bit of clean-up of latest_versionstring()
This is mostly preparations for the next commit.

(Bitbake rev: dcd2abfde55cc59d9869a7c97620b6fc30a52047)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 15:08:30 +00:00
Peter Kjellerstedt
21603031df bitbake: tests/fetch: Make test_git_latest_versionstring support a max version
In some cases, the version found by latest_versionstring() may be higher
than the real version. Make it possible to specify a maximum version so
that this case can be detected.

(Bitbake rev: 9134d4777109bc78410c3e641420d9a78b485e33)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 15:08:30 +00:00
Chen Qi
272d5ae098 bitbake: fetch2/git.py: add comment in try_premirrors
The purpose of ensuring 'incremental fetch' is not easy to see from
the codes. So add comments to explain this.

(Bitbake rev: 8b890b87e30cd05ec92ed71ee3691a47b4d77253)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 15:08:30 +00:00
Chen Qi
09ecbcd307 bitbake: tests/fetch.py: add test case for using premirror in restricted network
We had issue when BB_ALLOWED_NETWORKS is set and `bitbake grpc-native -c fetch'
failed even with all contents available in PREMIRRORS.

Add a test case to ensure no regression in the future.

(Bitbake rev: 80c91ceb81b1cae203067af58d3f1fe9c619ae83)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 15:08:30 +00:00
Chen Qi
c984b03f02 bitbake: fetch2/git.py: fix a corner case in try_premirror
For gitsm recipes, it's possible that some URL is used more than once.
e.g.,
A -> B:rev1 (B is a submodule of A)
A -> C (C is a submodule of A)
C -> B:rev2 (B is a submodule of C)
A anc C are both using B as submodules, but on different revs.
Now if we have:
B:rev1 -> D
B:rev2 -> E
Then, the mirror will not be fully used.
Say we have all repo mirrors for A, B, C, D, E, then in theory it's not
necessary to reach out to any network for downloading. But it's not the
case. After downloading B(rev1) and its submodule D from mirrors, the fetch
process continues to download C, thus B(rev2) and E. Now it finds that B
needs an update because its submodule E needs an update. Of course this is
true because E is not downloaded yet. Now the problem comes to whether to
use mirror or not. The git.py defines try_premirror to return 'False' when
the ud.clonedir exists. As B has been cloned, the ud.clonedir exists and
try_mirror returns False, resulting in not using mirror and going to upstream
directly.

We can see that the mirrors are not fully used. This is usually not problem,
as the cost is only some network download. But in case the following two
settings are there, we get errors.
BB_NO_NETWORK = "0"
BB_ALLOWED_NETWORKS = "*.some.allowed.domain"
In such case, the gitsm recipe A will fail to fetch. Note that all contents
that A needs are in mirrors and now it's failing to fetch. This is unexpected.

Note that the different revs of the same repo in gitsm recipe is not the only
way to reveal this problem. For example, there might be a recipe call B that
uses B:rev3. Check the protobuf and grpc recipes as an example.

For now, we can use the following steps to reproduce this issue. To be clear,
the grpc recipe in meta-oe is now 1.60.0.
1. Add in local.conf:
   DL_DIR = "${TOPDIR}/downloads-premirror"
   bitbake grpc -c fetch
2. Comment out the DL_DIR setting in local.conf and add the following lines:
   PREMIRRORS:append = " \
     git://.*/.* git://${TOPDIR}/downloads-premirror/git2/MIRRORNAME;protocol=file \n \
     gitsm://.*/.* gitsm://${TOPDIR}/downloads-premirror/git2/MIRRORNAME;protocol=file \n \
   "
3. Set BB_NO_NETWORK = "1" and then 'bitbake grpc -c fetch'.
   This command succeeds and this shows that the premirror holds everything we need.
4. Add the following lines and then 'bitbake grpc -c fetch'.
   BB_NO_NETWORK = "0"
   BB_ALLOWED_NETWORKS = "*.some.domain"

After step 4, the error message is as below:
ERROR: grpc-1.60.0-r0 do_fetch: The URL: 'gitsm://github.com/protocolbuffers/protobuf.git;protocol=https;name=third_party/protobuf;subpath=third_party/protobuf;nobranch=1;lfs=True;bareclone=1;nobranch=1' is not trusted and cannot be used

This patch fixes this problem by handling this corner case, that is, if the URL is
not trusted from the settings of BB_NO_NETWORK and BB_ALLOWED_NETWORKS, then we should
try premirrors because trying to reach upstream is destined to fail.

(Bitbake rev: e1be272ad105b47d3131b77168d9172386993fcb)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 15:08:30 +00:00
Pavel Zhukov
de27ecd228 bitbake: tests/fetch.py: add multiple fetches test
Fetch from premirror few times to emulate multiple machines sharing same
clonedir or few rebuilds of the package from (pre)mirror
Regression test for [Yocto #15369]

(Bitbake rev: 7fcbac574c68f16b95ab7abb2874931d168d3c9e)

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 12:52:30 +00:00
Pavel Zhukov
b2d0f31d24 bitbake: fetch2/git.py: Fetch mirror into HEAD
Fix the issue with using of (pre)mirror in case if clonedir exists but
outdated.
Previous version of the code fetched new mirror content into FETCH_HEAD
instead of branch which caused refetch from the upstream. Add new remote
add fetch from it instead so the ref can be found by "_contains_ref"

Fixes [Yocto #15369]

(Bitbake rev: 69588e2a5c7c200e47b02b2391498dcb72388bd2)

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 12:52:30 +00:00
André Draszik
e6892bc47a bitbake: git-make-shallow: support git's safe.bareRepository
When git is configured with safe.bareRepository=explicit [1], the
git-make-shallow fails miserably. LWN has an article about the
problem that this configuration option addresses and why it is useful
in [2].

It also seems that it is being rolled out in some environments as a
default for users.

In order to allow having this configuration turned on for a user's
environment in general, the fetcher has to be tought to use --git-dir=
for all relevent git operations.

The alternative, implemented here, is to forcibly turn off that option
for all git operations. In the future, we could look into converting
these to using the --git-dir= command line argument instead.

Link: https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/config/safe.txt#n1 [1]
Link: https://lwn.net/Articles/892755/ [2]
(Bitbake rev: 7c63989db4590564516ed150930f4e2fa503e98f)

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 12:00:59 +00:00
André Draszik
577e73606a bitbake: tests/fetch: support git's safe.bareRepository
When git is configured with safe.bareRepository=explicit [1], the
bitbake selftests fail miserably. LWN has an article about the
problem that this configuration option addresses and why it is useful
in [2].

It also seems that it is being rolled out in some environments as a
default for users.

In order to allow having this configuration turned on for a user's
environment in general, the fetcher has to be tought to use --git-dir=
for all relevent git operations.

The alternative, implemented here, is to forcibly turn off that option
for all git operations. In the future, we could look into converting
these to using the --git-dir= command line argument instead.

Link: https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/config/safe.txt#n1 [1]
Link: https://lwn.net/Articles/892755/ [2]
(Bitbake rev: a45e14a7343e36101e45639931322e5649587f57)

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 12:00:59 +00:00
André Draszik
b3d9663817 bitbake: fetch/git2: support git's safe.bareRepository
When git is configured with safe.bareRepository=explicit [1], the
bitbake git fetcher fails miserably. LWN has an article about the
problem that this configuration option addresses and why it is useful
in [2].

It also seems that it is being rolled out in some environments as a
default for users.

In order to allow having this configuration turned on for a user's
environment in general, the fetcher has to be tought to use --git-dir=
for all relevent git operations.

The alternative, implemented here, is to forcibly turn off that option
for all git operations. In the future, we could look into converting
these to using the --git-dir= command line argument instead.

While at it, fix one open-coded invocation of git that wasn't using
ud.basecmd

Link: https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/config/safe.txt#n1 [1]
Link: https://lwn.net/Articles/892755/ [2]
(Bitbake rev: 5f3b1d8dc9ee70e707536bd75ee845b547440c97)

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 12:00:59 +00:00
Richard Purdie
eca5708b87 bitbake: bitbake: Bump version to 2.7.3 for hashserv changes
(Bitbake rev: c1e0a0b6ddc9667c9d62319bd9ccd4eb8c64c2a6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Tobias Hagelborn
4e673ccb00 bitbake: bitbake: hashserv: Postgres adaptations for ignoring duplicate inserts
Hash Equivalence server performs unconditional insert also of duplicate
hash entries. This causes excessive error log entries in Postgres.
Rather ignore the duplicate inserts.

The alternate behavior should be isolated to the postgres
engine type.

(Bitbake rev: e8d2d178d0fe96f9d6031c97328e8be17d752716)

Signed-off-by: Tobias Hagelborn <tobiasha@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
61e184b3ed bitbake: siggen: Add parallel unihash exist API
Adds API to query if unihashes are known to the server in parallel

(Bitbake rev: 7e2479109b40ce82507f73b4f935903f7f79fb06)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
e5056394e0 bitbake: siggen: Add parallel query API
Implements a new API called get_unihashes() that allows for querying
multiple unihashes in parallel.

The API is also reworked to make it easier for derived classes to
interface with the new API in a consistent manner. Instead of overriding
get_unihash() to add custom handling for local hash calculating (e.g.
caches) derived classes should now override get_cached_unihash(), and
return the local unihash or None if there isn't one.

(Bitbake rev: 6faf48c09a4003a31b32e450779fb8ac9cc5e946)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
37b4d7e493 bitbake: hashserv: Add Client Pool
Implements a Client Pool derived from the AsyncRPC client pool that
allows querying for multiple equivalent hashes in parallel

(Bitbake rev: ba4c764d8061c7b88cd4985ca493d6ea6e317106)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
2406bd1055 bitbake: asyncrpc: Add Client Pool object
Adds an abstract base class that can be used to implement a pool of
client connections. The class implements a thread that runs an async
event loop, and allows derived classes to schedule work on the loop and
wait for the work to be finished.

(Bitbake rev: f113456417f9ac0a4b44b291a6e22ea8219c3a5f)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
3bd2c69e70 bitbake: hashserv: Add unihash-exists API
Adds API to check if the server is aware of the existence of a given
unihash. This can be used as an optimization for sstate where a client
can query the hash equivalence server to check if a unihash exists
before querying the sstate cache. If the hash server isn't aware of the
existence of a unihash, then there is very likely not a matching sstate
object, so this should be able to significantly cut down on the number
of negative hits on the sstate cache.

(Bitbake rev: cfe0ac071cfb998e4a1dd263f8860b140843361a)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
be909636c6 bitbake: hashserv: sqlalchemy: Use _execute() helper
Use the _execute() helper to execute queries. This helper does the
logging of the statement that was being done manually everywhere.

(Bitbake rev: 0409a00d62f45afb1b172acbcea17bf17942e846)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Joshua Watt
1effd1014d bitbake: hashserv: Add Unihash Garbage Collection
Adds support for removing unused unihashes from the database. This is
done using a "mark and sweep" style of garbage collection where a
collection is started by marking which unihashes should be kept in the
database, then performing a sweep to remove any unmarked hashes.

(Bitbake rev: 433d4a075a1acfbd2a2913061739353a84bb01ed)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
Paul Gortmaker
324c9fd666 bitbake: hashserv: improve the loglevel error message to be more helpful
Coming from a kernel background, I was thinking along the lines of

	dmesg -n <integer>

for loglevel adjustments.  So I tried various large and small and
even zero number values with no luck before getting frustrated and
opening up the python.

Let us save others the frustration and give a hint what the args it
expects should look like.

(Bitbake rev: df184b2a4e80fca847cfe90644110b74a1af613e)

Signed-off-by: Paul Gortmaker <paulg@kernel.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:58:12 +00:00
David Reyna
f62e4d81ec bitbake: taskexp_ncurses: ncurses version of taskexp.py
* Create an ncurses version of the GTK app "taskexp.py".
* Add these additional features:
  - Sort tasks in recipes by their dependency order
  - Print individual and/or recipe-wide dependencies to a file
  - Add a wild card filter
  - Show the target recipes on BOLD
* Provide a GUI self test
* Provide a non-ncurses self test for ptest

(Bitbake rev: f49bec66ad51c8cddeceafbbe2445c46e396ee8b)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-18 17:38:47 +00:00
Richard Purdie
cdb1cb2ed8 bitbake: runqueue: Improve setcene performance when encoutering many 'hard' dependencies
"bitbake world -n --setscene-only" shows poor performance as the numbers of tasks
increases. Analysys shows this is due to the "deferred" hard dependencies being
repeatedly processed which doesn't allow much forward progress in overall task
execution.

To avoid this, mark when it has been done and don't reprocess until dependencies
are updated. We have to be careful as we've seen bugs where these dependencies
aren't processed at the right time. They also have to be reproceseed during task
migration/rehashing so the code has to "self heal" the data structures.

(Bitbake rev: e5609bac06c17dabcf6286b47b1a3f19f5a1160f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-13 13:52:10 +00:00
Richard Purdie
71f55957f0 bitbake: runqueue: Optimise taskname lookups in next_buildable_task
A quick profile of bitbake world showed 147 million calls to taskname_from_tid().
The next_buildable_task function is performance senstive so move the call
inside the if block to reduce the number of calls and speed the code up.

(Bitbake rev: 8b332c16a7b6b85c5cbe1919dd8cae45fda6adf9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-13 13:52:10 +00:00
Richard Purdie
a7bbb105d3 bitbake: runqueue: Improve performance for executing tasks
Now that runqueue performance profiling works again we can see a lot
of time is lost in build_taskdepdata. Whilst we can't compute that
in advance, we can compute the individual entries.

Therefore put a cache in place to compute those and save overhead in
starting up tasks.

(Bitbake rev: c4519b542702ba25023e53d77b275a6fa571ec50)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-13 13:52:10 +00:00
Adrian Freihofer
1a3f01cad4 bitbake: bitbake/lib/bs4/tests/test_tree.py: python 3.12 regex
Python 3 interprets string literals as Unicode strings, and therefore
\s is treated as an escaped Unicode character which is not correct.
Declaring the RegEx pattern as a raw string instead of unicode is
required for Python 3.

(Bitbake rev: a5f1bc69ef2e456bd163303a07cfb73825b01576)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-13 13:52:10 +00:00
Richard Purdie
babd5fea4a bitbake: process/server: Fix typo
Ensure the message matches the filenames the code actually uses.

(Bitbake rev: deb7db2e2b125c6a6732db4f185f4de5926494fd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-10 15:25:22 +00:00
Michael Opdenacker
0ac07ddf71 bitbake: doc: README: simpler link to contributor guide
(Bitbake rev: 57d2f54e00374fe7452e123ec3c6e7ac27afb024)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-10 14:13:51 +00:00
Thomas Perrot
987ab2a446 bitbake: wget.py: always use the custom user agent
Add the "--user-agent" paramater in the wget base command to
perform all wget commands with this parameter, because a few
HTTP servers block requests with the default wget user agent.

For example, "hg.openjdk.org" never send a response to requests
have been sent with wget:
wget https://hg.openjdk.org/jdk8u/jdk8u/archive/jdk8u272-ga.tar.bz2
https://hg.openjdk.org/jdk8u/jdk8u/archive/jdk8u272-ga.tar.bz2
Resolving hg.openjdk.org (hg.openjdk.org)... 23.54.129.73
Connecting to hg.openjdk.org (hg.openjdk.org)|23.54.129.73|:443... connected.
HTTP request sent, awaiting response...

(Bitbake rev: d6fa261a9603677f0b3abbd309c1ca6073b63f4c)

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-10 14:13:51 +00:00
Richard Purdie
0f50f21151 bitbake: process: Add profile logging for main loop
When the idle/main loop was added, we didn't include profiling information
for it. There is a performance issue in there, add logging for it.

(Bitbake rev: d8d5cd43a60560f67e86f4f625113b0f73b944c0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-10 14:13:51 +00:00
Toni Lammi
e834e8ee91 bitbake: support temporary AWS credentials
Support AWS_SESSION_TOKEN which is used in temporary
AWS credentials.

Fixes [YOCTO #15384].

(Bitbake rev: ae1e4c90bbc2002cb2728c64649c095c00220ceb)

Signed-off-by: Toni Lammi <toni.lammi@kone.com>
Reported-by: Toni Lammi <toni.lammi@tl-software.fi>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-09 14:06:16 +00:00
Martin Jansa
5276b7f548 bitbake: tests: fetch.py: use real subversion repository
* github no longer provides support for subversion clients:
  https://docs.github.com/en/enterprise-server@3.11/get-started/working-with-subversion-on-github/support-for-subversion-clients
  it was shut down on 2024-01-08:
  https://github.blog/2023-01-20-sunsetting-subversion-support/

  and this test was now failing with:

======================================================================
ERROR: test_external_svn (bb.tests.fetch.SVNTest.test_external_svn)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/OE/layers/bitbake/lib/bb/tests/fetch.py", line 1287, in test_external_svn
    fetcher.download()
  File "/OE/layers/bitbake/lib/bb/fetch2/__init__.py", line 1896, in download
    raise FetchError("Unable to fetch URL from any source.", u)
bb.fetch2.FetchError: Fetcher failure for URL: 'svn:///tmp/bitbake-fetch-zdvedqt_/svnfetch_localrepo_wup8mgn6/project;module=trunk;protocol=file;externals=allowed;rev=2'. Unable to fetch URL from any source.

Stdout:
Fetch svn:///tmp/bitbake-fetch-zdvedqt_/svnfetch_localrepo_wup8mgn6/project;module=trunk;protocol=file;externals=allowed;rev=2
Failed to fetch URL svn:///tmp/bitbake-fetch-zdvedqt_/svnfetch_localrepo_wup8mgn6/project;module=trunk;protocol=file;externals=allowed;rev=2, attempting MIRRORS if available
Fetcher failure: Fetch command export PSEUDO_DISABLED=1; /usr/bin/env svn --non-interactive --trust-server-cert co --no-auth-cache -r 2 file:///tmp/bitbake-fetch-zdvedqt_/svnfetch_localrepo_wup8mgn6/project/trunk@2 trunk failed with exit code 1, output:
A    trunk/README.md
 U   trunk
Checked out revision 2.

svn: warning: W205011: Error handling externals definition for 'trunk/bitbake':
svn: warning: W170013: Unable to connect to a repository at URL 'https://github.com/PhilipHazel/pcre2.git'
svn: E205011: Failure occurred processing one or more externals definitions

  in the rare cases where subversion was still installed on the host
  running bitbake-selftest :).

  to avoid this use still alive repository from https://svn.apache.org/
  and pick something rather small and only the trunk subdirectory which
  is fast to fetch:
  svn co https://svn.apache.org/repos/asf/serf/trunk
  takes just 2 sec here

  adjust expected dir/file to use "protocols/fcgi_buckets.h" instead of
  "trunk/README"

(Bitbake rev: a735898abcf056f897c9350bb128a5637e6b4617)

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-08 10:59:32 +00:00
Martin Jansa
58155ea1a3 bitbake: bitbake-diffsigs: fix walking the task dependencies and show better error
* when comparing 2 tmp/stamps/*do_configure.sigdata* I got
  TypeError("filename must be a str or bytes object, or a file")
  but both files I was comparing were
  Zstandard compressed data (v0.8+), Dictionary ID: None
  according to "file"

  with TypeError catched to show which file it failed to open I got better
  error which shows it was trying to read "do_prepare_recipe_sysroot.sigdata"
  file now and after a while you might notice that it's not just the expected
  file, but a dict with 'path', 'sstate', 'time'.

  Fix that in bitbake-diffsigs but keep the TypeError and add OSError
  in case it will eventually walk on file which isn't zstd compressed
  pipecompress throws CompressionError.

ERROR: Failed to open {'path': '5.15.do_prepare_recipe_sysroot.sigdata.99b12a401341a0df7c3553cb00c87a7674295496bd5c25ed71764ee0d0fb8eb8', 'sstate': False, 'time': 1707136354.991718}: filename must be a str or bytes object, or a file
Traceback (most recent call last):
  File "bitbake/bin/bitbake-diffsigs", line 192, in <module>
    output = bb.siggen.compare_sigfiles(options.sigdatafile1, options.sigdatafile2, recursecb, color=color)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/siggen.py", line 1039, in compare_sigfiles
    recout = recursecb(dep, a[dep], b[dep])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/bin/bitbake-diffsigs", line 102, in recursecb
    out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/siggen.py", line 857, in compare_sigfiles
    raise err
  File "bitbake/lib/bb/siggen.py", line 853, in compare_sigfiles
    with bb.compress.zstd.open(a, "rt", encoding="utf-8", num_threads=1) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/compress/zstd.py", line 12, in open
    return bb.compress._pipecompress.open_wrap(ZstdFile, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/compress/_pipecompress.py", line 59, in open_wrap
    raise TypeError("filename must be a str or bytes object, or a file")
TypeError: filename must be a str or bytes object, or a file

* if I replace zstd file with just plaintext it fails with:
  $ echo foo > foo
  $ echo foo > bar
  $ bitbake-diffsigs foo bar
  zstd: /*stdin*\: unsupported format
  ERROR: Process died with 1
  sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='foo'>

  with this change it shows the name of the file which it failed to uncompress:

  $ bitbake-diffsigs foo bar
  zstd: /*stdin*\: unsupported format
  ERROR: Failed to open sigdata file 'foo': Process died with 1
  ERROR: Process died with 1
  sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='foo'>

(Bitbake rev: f3f843a4fd6e0a9e8f6edef5dd3cf1fce29c50ba)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-08 10:59:32 +00:00
Ross Burton
ff0bc2a284 bitbake: bitbake: Version bump for inherit_defer addition
We've added a new statement, inherit_defer, so bump the version so this
can be checked.

(Bitbake rev: 191e6eb2bceb467c97e315301f1f64722cf0e976)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 16:25:39 +00:00
Richard Purdie
c56fce9e56 bitbake: ast/BBHandler: Add inherit_defer support
Add support for an inherit_defer statement which works as
inherit does but is only evaulated at the end of parsing.

This allows conditional expressions to be evaulated 'late' meaning changes
to PACKAGECONFIG from bbappends can be applied for example. This addresses
a usability/confusion issue users have with the current conditional
inherit mechanism since they don't realise the condition has to be
expanded immediately with the current model.

There is a commented out warning we could enable in future which
warns about the use of a conditional inherit that isn't deferred.

There is a behaviour difference in the placement of the inherit,
particularly around variables set using ?= which means wen swapping
from one to the other, caution must be used as values can change.

(Bitbake rev: 5c2e840eafeba1f0f754c226b87bfb674f7bea29)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-18 10:15:58 +00:00
Richard Purdie
61182659c2 bitbake: runqueue: Fix runall all bug
Where chains of RDEPENDS are multiple levels deep, the runall code was not
accounting for this and recursing deeply enough to gather all dependencies.

Fix this by iterating over the result until no more dependencies are found.

Tested-by: Jonas Gorski <jonas.gorski@bisdn.de>
Reported-by: Jonas Gorski <jonas.gorski@bisdn.de>
(Bitbake rev: 966f25dfc23a6d17b2b6d3e0100e9ae264f99025)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-12 11:59:36 +00:00
Alexander Kanavin
67e3f24333 bitbake: bitbake/runqueue: rework 'bitbake -S printdiff' logic
Previously printdiff code would iterate over tasks that were reported as invalid or absent,
trying to follow dependency chains that would reach the most basic invalid items in the tree.

While this works in tightly controlled local builds, it can lead to bizarre reports
against industrial-sized sstate caches, as the code would not consider whether the
overall target can be fulfilled from valid sstate objects, and instead report
missing sstate signature files that perhaps were never even created due to hash
equivalency providing shortcuts in builds.

This commit reworks the logic in two ways:

- start the iteration over final targets rather than missing objects
and try to recursively arrive at the root of the invalid object dependency.

A previous version of this patch relied relies on finding the most 'recent'
signature in stamps or sstate in a different function later, and recursively
comparing that to the current signature, which is unreliable on real world caches.

- if a given object can be fulfilled from sstate, recurse only into
its setscene dependencies; bitbake wouldn't care if dependencies
for the actual task are absent, and neither should printdiff

I wrote a recursive function for following dependencies, as
doing recursive algorithms non-recursively can result in write-only
code, as was the case here.

[YOCTO #15289]

(Bitbake rev: aadeca63da5d96160ce4d6d71da556e2e033f9b7)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 16:32:13 +00:00
Mark Asselstine
98c5c96dd3 bitbake: ui/knotty: properly handle exceptions when calling runCommand()
In runCommand() the send() and recv() can fail and raise
BrokenPipeError and EOFError exceptions when the bitbake-server is
unexpectedly terminated. In these cases a python traceback is
currently dumped. Similarly updateFromServer() which calls
runCommand() can also raise these and other exceptions, and currently
lacks proper exception handling resulting in python traceback.

We wrap calls to runCommand() and updateFromServer() in a try/except
block as well as improve the exception handling for updateToServer().

This along with the earlier commit which added text to the
BrokenPipeError and EOFError exceptions in runCommand() to indicate a
bitbake-server termination may have occurred, should improve the user's
ability to understand and handle these errors.

An easy way to trigger each of the runCommand() exceptions is to
'kill -9' bitbake-server before (causes EOFError) or after
(causes BrokenPipeError) the "Loading Cache" stage.

(Bitbake rev: 804d366ee3ddc0f37f0a6c712c8d42db45b119bc)

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 14:02:38 +00:00
Mark Asselstine
bc22d82c2f bitbake: server/process: catch and expand multiprocessing connection exceptions
Doing builds on systems with limited resources, or with high demand
package builds such as chromium it isn't uncommon for the OOM Killer
to be triggered and for bitbake-server to be selected as the process
to be killed. When the bitbake-server does terminate unexpectedly due
to the OOM Killer or otherwise, this currently results in a generic
python traceback with little indication as to what has failed.

Here we trap and raise the exceptions while extending the exception
text in runCommand() to make it clear that this is most likely caused
by the bitbake-server unexpectedly terminating.

Callers of runCommand() should be updated to properly handle the
BrokenPipeError and EOFError exceptions to avoid printing a python
traceback, but even if they don't, the added text in the exceptions
should provide some hints as to what might have caused the failure.

(Bitbake rev: 5ff62b802f79acc86bbd6a99484f08501ff5dc2d)

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 14:02:38 +00:00
Richard Purdie
c665a2c933 bitbake: ast: Fix EXPORT_FUNCTIONS bug
If you have two classes, both of which set EXPORT_FUNCTIONS for the same funciton
and a standard funciton definition for the function that is exported, the export
function can sometimes overwrite the standard one.

The issue is that the internal flag the code uses isn't ovweritten if the variable
is giving a new value. Fix the issue by using a comment in the code that is injected
so that we know if it is ours or not.

Also add some testing for EXPORT_FUNCTIONS, not perfect but a start.

(Bitbake rev: 66306d5151acb0a26a171c338d8f60eb9eb16c6b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alexander Kanavin
56b1af37dc bitbake: fetch/wget/checkstatus(): include the URL in debugging output about status check failure
Previously the output wasn't useful for finding out what was the actual
URL that failed, particularly in heavily multi-threaded invocations:

DEBUG: checkstatus() urlopen failed: HTTP Error 404: Not Found

With this change, the problem is described specifically:

DEBUG: checkstatus() urlopen failed for http://cdn.jsdelivr.net/yocto/sstate/all/universal/4f/91/sstate:gettext-minimal-native:x86_64-linux:0.22.4:r0:x86_64:11:4f91b650ebd7be601cbd0e3a37a8cc6385a3f4ee616f931969b50709ed8bf044_create_spdx.tar.zst: HTTP Error 404: Not Found

This will help with CDN cache tests in particular. When some object
isn't available, we need to know why: 4xx error, 5xx error, timeout
error or any other issue.

(Bitbake rev: ecd9b92815563509f55264ed6e7498aee797cedd)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alexander Kanavin
4890c6a7ca bitbake: fetch/checkstatus(): do not print the URI twice in FetchError exception
Previously, there was duplicate clutter in the output, particularly if the
URI points to sstate cache items:

bb.fetch2.FetchError: Fetcher failure for URL: {uri}. URL {uri} doesn't work

(Bitbake rev: 61537b8a98b963e4af265e046d41407b32fa5935)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Robert Yang
4e2fcdb383 bitbake: bitbake: tests/event: Add test_lineno_in_eventhandler
Add test_lineno_in_eventhandler to test lineno in eventhandler.

(Bitbake rev: 4e5de537bebb68180c5755858c81b095eb9ae2f6)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Robert Yang
3f41592920 bitbake: bitbake: event: Inject empty lines to make code match lineno in filename
So that we can get the correct error messages.

* In python 3.10.9, the error message was:
  ERROR: Unable to register event handler 'defaultbase_eventhandler':
    File "/path/to/poky/meta/classes-global/base.bbclass", line 4
      # SPDX-License-Identifier: MIT
             ^^^^^
  SyntaxError: invalid syntax

  This is hard to debug since the error line number 4 is incorrect, but nothing
  is wrong with the code in line 4.

* Now the error message and lineno is correct:
  ERROR: Unable to register event handler 'defaultbase_eventhandler':
    File "/path/to/poky/meta/classes-global/base.bbclass", line 256
      an error line
         ^^^^^
  SyntaxError: invalid syntax

And no impact on parsing time:
* Before:
$ rm -fr cache tmp; time bitbake -p
real    0m27.254s

* Now:
$ rm -fr cache tmp; time bitbake -p
real    0m27.200s

(Bitbake rev: c212933d9c786806852c87f188250a4f0a14c048)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alassane Yattara
36dc42bde7 bitbake: toaster/tests: Bug-fix ToasterTable show_rows testcases
Test if some rows are visible in table instead of compare row to row_to_show,
because sometime full avaiblable content did not display

Failed: https://autobuilder.yoctoproject.org/typhoon/#/builders/161/builds/147/steps/12/logs/stdio

(Bitbake rev: 5b0a48265aafa62259c575707c3afa6dd56f8008)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alassane Yattara
0dcf84f830 bitbake: toaster/tests: Bug-fix "element not interactable" in TestLayerDetailsPage::test_edit_layerdetails
Failed: https://autobuilder.yoctoproject.org/typhoon/#/builders/161/builds/143/steps/12/logs/stdio

(Bitbake rev: 187e96eb7393632f28a195f280fa133439bdc0fa)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alassane Yattara
c0ade693af bitbake: toaster/tests: bug-fix "#hint-error-project-name" should be visible
Failed: https://autobuilder.yoctoproject.org/typhoon/#/builders/161/builds/142

(Bitbake rev: 0ee5f4e06476b0ec2f5ea8c9f05d299ddda6312b)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alassane Yattara
49ccf2f5e0 bitbake: toaster/tests: Setup delay after driver action self.get(url)
Recurring test failures result from insufficient delays in driver actions.

(Bitbake rev: b0de2a61d14fbf30e338751b285b3bab80192275)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 13:55:33 +00:00
Alassane Yattara
070aa22705 bitbake: toaster/tests: Delay driver first action on create new project page
Wait for element visible on create new project page

(Bitbake rev: 664de3f6d3484b94f5d82ec634b512b825553aa9)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-07 22:59:55 +00:00
Alassane Yattara
1cd56989a0 bitbake: toaster/tests: Bug-fix element click intercepted
Fix "element click intercepted" on TestProjectConfigTab::test_project_config_tab_right_section

(Bitbake rev: c8685c762aa1fab687ff3a0943487675ef720755)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-07 22:59:55 +00:00
Alassane Yattara
74c234bf0d bitbake: toaster/tests: Bug-fix on TestProjectConfigTab::test_image_recipe_show_rows
Check some rows are visible in table instead of compare table row to
row_to_show, because recipe image table sometime doesn't display full avaiblable
images

(Bitbake rev: 1e2e5927ef7a8adfd3d0a3be1c75b4aa410d9908)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-07 22:59:55 +00:00
Richard Purdie
71c0d311ba bitbake: bitbake: Version bump for find_siginfo chanages
Bump the version to 2.7.1 for the find_siginfo changes.

(Bitbake rev: 03995e16bf7186f5368f772f617d563f4d280641)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-05 11:59:08 +00:00
Alexander Kanavin
7d400f94fe bitbake: bitbake/runqueue: prioritize local stamps over sstate signatures in printdiff
Even with the reworked printdiff code, sstate which is heavily used in parallel
can throw races at the tests: if a new matching, but otherwise unrelated
sstate signature appears between writing out local stamps and listing
matching sstate files, then that signature will be deemed 'the latest'
and the actual local stamp will be discarded. This change ensures
the scenario does not happen.

It also makes use of the reworked find_siginfo(), particularly the 'sstate'
entry in returned results.

(Bitbake rev: c8574b796dabb69699c70540dd95a44d8f7388ab)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-05 11:59:08 +00:00
Richard Purdie
859786a83f bitbake: siggen: Ensure version of siggen is verified
Since we need to change the form of the siggen function, we need to add versioning
and some verison checks. This means if a newer bitbake is used with older metadata
we can detect it.

(Bitbake rev: 721556568413508213d22c29985e305a45a8d68a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-05 11:59:08 +00:00
Alexander Kanavin
cc85c8eb9d bitbake: bitbake-diffsigs/runqueue: adapt to reworked find_siginfo()
In particular having 'time' explicitly used as a sorting key should make it
more clear how the entries are being sorted.

(Bitbake rev: 5439aca056c84ab4410aaf24bdb68e896191d8e1)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-05 11:59:08 +00:00
Richard Purdie
a41b54ccbd bitbake: bitbake: Post release version bump to 2.7.0
Bump to a development version post release.

(Bitbake rev: 28364c08f36c778a5cb2e3f20ceb052370ef153c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-05 11:39:33 +00:00
Alexander Kanavin
b0c47ae555 bitbake: bitbake/runqueue: add debugging for find_siginfo() calls
(Bitbake rev: 52f5503e8cf048331134233fb681db6dc736ae38)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-05 11:39:33 +00:00
Alassane Yattara
831b3d5b22 bitbake: toaster/toastergui: Bug-fix verify given layer path only if import/add local layer
(Bitbake rev: 94e88efa9dbefd37f1d48459ade19797b6034b84)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-04 23:48:29 +00:00
Alexander Kanavin
3958182710 bitbake: bitbake/codeparser.py: address ast module deprecations in py 3.12
Specifically:
/srv/work/alex/poky/bitbake/lib/bb/codeparser.py:279: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
  if isinstance(node.args[0], ast.Str):
/srv/work/alex/poky/bitbake/lib/bb/codeparser.py:280: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  value = node.args[0].s

(Bitbake rev: de8ba2770d9a1a94af3d084f9540da7e2fae6022)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-02 14:41:06 +00:00
Alassane Yattara
280917c2e7 bitbake: toaster/tests: Bug-fix "#project-created-notification" should be visible
Added more delay between click on create project but and when notification is displayed

(Bitbake rev: 5382cc0699eebc1e91675a2a147f8fe7dab23c14)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-01 23:13:50 +00:00
Alassane Yattara
350300f836 bitbake: toaster/tests: Skip to show more then 100 item in ToasterTable
(Bitbake rev: 860c931381e0694a854fd90775fb18dadb7d76c6)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-01 23:13:50 +00:00
Alassane Yattara
3e6d3817da bitbake: toaster/tests: bug-fix An element matching "#lastest_builds" should be on the page
(Bitbake rev: 5bcba4596cd9f4f54c7ae7ebd9322897c2f829cd)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-01 23:13:50 +00:00
Alassane Yattara
6a67f24773 bitbake: toaster/tests: bug-fix An element matching "#projectstable" should be visible
(Bitbake rev: 1edb97f741a48481b1b9f26c5cb31acd9059f07f)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-01 23:13:50 +00:00
Richard Purdie
fe5d2f0b66 bitbake: lib/bb: Add workaround for libgcc issues with python 3.8 and 3.9
With python 3.8 and 3.9, we see intermittent errors of:

libgcc_s.so.1 must be installed for pthread_cancel to work
Aborted (core dumped)

which seem related to:

https://stackoverflow.com/questions/64797838/libgcc-s-so-1-must-be-installed-for-pthread-cancel-to-work
https://bugs.ams1.psf.io/issue42888

These tend to occur on debian 11 and ubuntu 20.04.

Workaround this by ensuring libgcc is preloaded in all cases.

(Bitbake rev: c6666f6cfafd55e1c980239a7c5ff908f1a69196)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-30 11:03:25 +00:00
Joshua Watt
34bafb3cf2 bitbake: contrib/vim: Syntax improvements
Makes a few improvments to the vim Bitbake syntax plugin:
 1) Highlight python expansion expressions "${@...}" in
    inherit/include/require
 2) Highlight variables "${..}" and python expressions "${@...}" in
    addtask/deltask/addhandler
 3) Correctly handle multi-line sequences in addtask/deltask/addhanlder

(Bitbake rev: 39691d5d0f44a266f917a13884707283f83543de)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-23 16:20:25 +00:00
Marta Rybczynska
1720dae4ed bitbake: toastergui: verify that an existing layer path is given
Verify that an existing layer path was given when adding a new
layer.

Manually using the shell for globbing is unnecessary, use the glob
function instead for cleaner code.

(Bitbake rev: fe0881615896de844141393b21a121f7c3fa9d16)

Signed-off-by: Marta Rybczynska <marta.rybczynska@syslinbit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-20 22:08:31 +00:00
Alassane Yattara
98214f1bc2 bitbake: toaster/tests: Bug-fix test_functional_basic, delay driver actions
The errors causing faileds on functional_basic are dû to the delay between actions,
increase between driver actions.

(Bitbake rev: e8f8f6203b63c46249673e80872fea40475f6875)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-20 12:02:07 +00:00
Joshua Watt
490b94c3b5 bitbake: bitbake-hashserv: Add description of permissions
Adds a text description of the possible permissions in the hash server
help text

(Bitbake rev: 8295ac1b6672c25bee595cff6e000b2af817f904)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-18 09:18:01 +00:00
Richard Purdie
69a4180c88 bitbake: runqueue: Remove tie between rqexe and starts_worker
We've been moving to try and separate several pieces of runqueue. Allow
start_worker to operate separately to rqexe since they don't need to be
tied. This allows rqexe to be available to print_diff for future
improvements.

(Bitbake rev: 834e452243ff2eea6e8e2e7f4935b5233ffb4b00)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-17 19:07:21 +00:00
Richard Purdie
e706249f7b bitbake: utils: Fix mkdir with PosixPath
Avoid:
    Exception: AttributeError: 'PosixPath' object has no attribute 'find'

(Bitbake rev: 0b37fe89ba12549109905b6d0e6d07d342162436)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-17 19:07:21 +00:00
Marlon Rodriguez Garcia
ff7aba28f7 bitbake: toaster: Added validation to stop import if there is a build in progress
Added validation to prevent simultaneous imports from running because the database fails at runtime.
The option to create a queue was taken into consideration. However, it will require the use of Celery https://pypi.org/project/celery/ or Background Task https://pypi.org/project/django-background-tasks/ which require the use of external services and multiple dependencies.
If required we could explore the alternative in the future.

(Bitbake rev: eb417e27be5717a259f27e98dbd73255b1a42fc9)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-16 13:06:11 +00:00
Alassane Yattara
a02138ad48 bitbake: toaster/tests: Fixes functional tests warning on autobuilder
tests/functional/test_project_config.py::TestProjectConfig::test_set_download_dir
  /home/pokybuild/yocto-worker/toaster/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method TestProjectConfig.test_set_download_dir of <toaster.tests.functional.test_project_config.TestProjectConfig testMethod=test_set_download_dir>>)
    return self.run(*args, **kwds)

tests/functional/test_project_config.py::TestProjectConfig::test_set_sstate_dir
  /home/pokybuild/yocto-worker/toaster/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method TestProjectConfig.test_set_sstate_dir of <toaster.tests.functional.test_project_config.TestProjectConfig testMethod=test_set_sstate_dir>>)
    return self.run(*args, **kwds)

(Bitbake rev: 938cba3e80f26589ccbe34483c79e17056346fde)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alassane Yattara
ad2ffefb14 bitbake: toaster/tests: Update tests/functional/functional_helpers test_functional_basic
- Remove unused import time functional_helpers
- Delay driver actions from test_functional_basic

(Bitbake rev: c7a305f0ff3cd32875e2eb80bc0848f533209745)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alassane Yattara
adb7efe522 bitbake: toaster/tests: bug-fix element click intercepted in browser/test_layerdetails_page.py
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted

(Bitbake rev: d1936616cafc1aced69c7b5758e44638eb62b5ac)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alassane Yattara
81a0110ca5 bitbake: toaster/tests: Bug-Fix testcase functional/test_project_page_tab_config.py
All issues and failures stemmed from a specific test case:
test_project_config_tab_right_section in the file
bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py.

This test was designed to verify whether the "Most built recipes"
section on the project page correctly displays the latest and oldest
recipes built by the user, irrespective of the build outcome (failed,
        cancelled, succeeded, or errored).

The errors and failures arose because the build process did not
terminate as expected, particularly when attempting to build recipe
images such as "core-image-minimal" or "bash." It was discovered that
building a real recipe/image was unnecessary for the test's purpose.
Instead, building a fake recipe like "foo" provided a reliable way to
ensure the build would fail or be interrupted.

(Bitbake rev: 5162db5305826235c09d9fcd38b5fb48ded31622)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alassane Yattara
c8382b35e8 bitbake: toaster/tests: Removed all time.sleep occurrence
Use wait_until_visible instead of time.sleep to delay driver actions
(Bitbake rev: 96bf461d5860dad2377963c8dad6c754670738a6)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alassane Yattara
5648636a8b bitbake: toaster/tests: logging warning in console, trying to kill unavailable Runbuilds process
(Bitbake rev: 26100ca3b5e451e9d296654fc8c47a4299fea835)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alexander Lussier-Cullen
0fd93b86c4 bitbake: toaster/tests: fix chrome argument syntax and wait for driver exit
The chrome driver sometimes fails with a page crash for a full suite
of tests, pointing to a failure in the setup of the driver due to
resource limitations.
To mitigate these crashes, add a wait between driver driven tests to
ensure resources are freed.

(Bitbake rev: 8f998e27aae694c16f788aac12558621089d0839)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alexander Lussier-Cullen
e63d6cb38e bitbake: toaster/tests: fix functional tests setup and teardown
Functional tests sometimes do not properly wait for previous tests to
close their instance of Toaster before launching their own, which
causes failures.
Track test created Toaster processes globally and wait for them to be
exited before executing further tests which need a Toaster instance to
fix this.
Additionally, quit Toaster in the teardown using the stop command with
a fallback of manually killing the processes in case of documented
stalling problem.

(Bitbake rev: 16aad11ce8eadd93b4b00dc65826329ff5526c84)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Alexander Lussier-Cullen
e9c2003bd0 bitbake: toaster/tests: Exit tests on chromedriver creation failure
When failing to create the web driver session for selenium tests,
a cascade of erroring tests will follow. To avoid processing these
unnecessarily, exit the tests completely in this case.

(Bitbake rev: 9327196102dd2671fcdb3200d9490e683f81d3a1)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-15 14:37:28 +00:00
Marlon Rodriguez Garcia
524255ad26 bitbake: toaster: Commandline build import table improvements
Added dataTables library to include sorting and pagination for table element

Added jquery.dataTables to customize table rendering in section "Import eventlogs".
This library includes the following: sorting, pagination, search and CSS styles.

Default to ascending order and 50 builds per page.

(Bitbake rev: f88f314cb2b071569acf3c7d43fb7256ba50762f)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-13 20:35:02 +00:00
Alexander Lussier-Cullen
dc608a5bbe bitbake: bitbake: toaster: add functional testing toaster error details
Functional tests can sometimes fail to initialize toaster.
Most often this is due to a conflict on port 8000.
Add command information about whichever other process is running on
that port to better describe the initialization failure.

(Bitbake rev: da7f91d6dbe8703fb12d58ec95f077349d0005c8)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-13 11:49:18 +00:00
Marlon Rodriguez Garcia
799c131d92 bitbake: toaster: remove test and update setup to avoid rebuilding image
Update build test to fix setUp, by including the built, the system was rebuilding the image on every test, causing the database to lock
Delete test for unique order, this test was the only test using the self.built element and breaking the system.

(Bitbake rev: 9f1ad015051d4a4b363787c4a1f2b943d55eb8cb)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-13 11:49:18 +00:00
Alassane Yattara
8a7dffc278 bitbake: toaster/test: fix Copyright
(Bitbake rev: 4967c3f3b3c5971e9ac65cb833eb8617e8c3445c)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-13 11:49:18 +00:00
Alexander Lussier-Cullen
effe2498eb bitbake: toaster: Add verbose printout for missing chrome(driver) dependencies
If the chrome driver binary is missing dependencies, it was near impossible
to work out which ones from just the logs. Add code to help debug things
if this happens by including the ldd output.

(Bitbake rev: 0ffe5fccbb7db5aca5c409fe00be2be69a6e37d9)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-12 15:58:57 +00:00
Marlon Rodriguez Garcia
df5c8d6471 bitbake: toaster: Added new feature to import eventlogs from command line into toaster using replay functionality
Added a new button on the base template to access a new template.
Added a model register the information on the builds and generate access links
Added a form to include the option to load specific files
Added jquery and ajax functions to block screen and redirect to build page when import eventlogs is trigger
Added a new button on landing page linked to import build page, and set min-height of buttons in landing page for uniformity
Removed test assertion to check command line build in content, because new button contains text
Updated toaster_eventreplay to use library
Fix test in test_layerdetails_page
Rebased from master

This feature uses the value from the variable BB_DEFAULT_EVENTLOG to read the files created by bitbake
Exclude listing of files that don't contain the allvariables definitions used to replay builds
This part of the feature should be revisited. Over a long period of time, the BB_DEFAULT_EVENTLOG
will exponentially increase the size of the log file and cause bottlenecks when importing.

(Bitbake rev: ab96cafe03d8bab33c1de09602cc62bd6974f157)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-12 15:58:57 +00:00
Richard Purdie
b32dbb3747 bitbake: toaster/tests/builds: Add BB_HASHSERVE passthrough
As well as BB_HASHSERVE_UPSTREAM, ensure BB_HASHSERVE is passed through
to allow sstate resuse on the autobuilder.

(Bitbake rev: f18a647d998670cc37a8832cb36ffe03da43d1c5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-09 10:04:12 +00:00
Richard Purdie
4d14176aa6 bitbake: toaster: Update to use qemux86-64 machine by default
Toaster currently uses qemux86 as the default, update to match the
local.conf default changes, i.e. qemux86-64.

(Bitbake rev: 27fbba9ee15994a69284a7f8579c22d85e0ce863)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-09 10:04:12 +00:00
Pavel Zhukov
d14eb12deb bitbake: utils: Do not create directories with ${ in the name
In some cases ${ may not be expanded in the WORKDIR (one of the cases is
undefined variable) and causes cryptic failures [1]. Guard this by
erroring out if directory name contains ${

Fixes: [Yocto #15255]

[1]
ERROR: x-native-1.0+${SRCPV}-r0 do_deploy_source_date_epoch: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:sstate_hardcode_path(d)
     0003:
File: '/home/mischief/src/poky/meta/classes-global/sstate.bbclass', lineno: 654, function: sstate_hardcode_path
     0650:    bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
     0651:    subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
     0652:
     0653:        # If the fixmefn is empty, remove it..
 *** 0654:    if os.stat(fixmefn).st_size == 0:
     0655:        os.remove(fixmefn)
     0656:    else:
     0657:        bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
     0658:        subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/sstate-build-deploy_source_date_epoch/fixmepath'

(Bitbake rev: e91c256ec076e70cf8a18e369fe7862e50618c48)

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Alassane Yattara
7fefb85888 bitbake: toaster/tests: bug-fix tests writing files into /tmp on the autobuilders
- Use build directory instead of /tmp
- Better handle delay between driver actions

(Bitbake rev: 234b125c11e4cca015e4d54fbddbfd3d276b88f6)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Alassane Yattara
6d91225651 bitbake: toaster/tests: Fixes warnings in autobuilder
../bitbake/lib/toaster/tests/functional/functional_helpers.py:66
  /home/pokybuild/yocto-worker/toaster/build/bitbake/lib/toaster/tests/functional/functional_helpers.py:66: DeprecationWarning: invalid escape sequence '\s'
    project_url=re.search("(projectPageUrl\s:\s\")(.*)(\",)",rc)

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/pokybuild/yocto-worker/toaster/build/bitbake/lib/toaster/tests/commands/test_runbuilds.py", line 39, in run
    os.kill(int(pid), signal.SIGTERM)
ProcessLookupError: [Errno 3] No such process

(Bitbake rev: 5a4732d5e4437cfc366c6b034868903ad6f0088c)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Alassane Yattara
23d3e2c718 bitbake: toaster/tests: Bug fixes, functional tests dependent on each other
refactor test_create_project and test_project_page to remove their dependencies

(Bitbake rev: 54f7c0bb6ff435c4936c3422532aa071bd5b66e8)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Alassane Yattara
d5a6e3b546 bitbake: toaster/tests: Refactorize tests/functional
- Split testcases from test_project_page_tab_config into tow files
- Added new testcases in test_project_config
    - Test changing distro variable
    - Test setting IMAGE_INSTALL:append variable
    - Test setting PACKAGE_CLASSES variable
    - Test creating new bitbake variable

(Bitbake rev: 649218c648b79a89b0e91aa80d8c9bf8fa2de645)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Alassane Yattara
49128ef8ba bitbake: toaster/tests: Added functional/utils, contains useful methods using by functional tests
(Bitbake rev: c39a0cceedce324c311d00634c5329fbec1ba6d4)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Alassane Yattara
f6cc0b360f bitbake: toaster/tests: Ensure to kill toaster process create for tests functional
Toaster background task runbuilds continu running when even if tests is
done
(Bitbake rev: e885863dffebab77f501a58df172926aafec5623)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Marlon Rodriguez Garcia
ad2f5a359e bitbake: toaster/tests: Update build test
Updated build tests in toaster, added SSTATE_MIRROR to package build, changed build directory and update test order
This builds include the core-minimal-image, on the test enviroment a smaller package was use to run the test for time purposes

(Bitbake rev: af31116f0017912fc5a58a5976c814b6b326985f)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 17:17:42 +00:00
Richard Purdie
3ee5c86da3 bitbake: toaster-eventreplay: Remove ordering assumptions
Currently the script assumes the variarables are dumped at the start of the
file which is hard to arrange safely in the bitbake code and no longer a true
assumption.

Rewrite the code so that it can cope with different ordering and event files
containing multiple builds.

(Bitbake rev: a833a403a8f7c05008108f3ec1710c211cfa9ec2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:46:29 +00:00
Alexander Lussier-Cullen
637fdcc2b1 bitbake: toaster: fix pytest build test execution and test discovery
Ensure the proper django settings are used by moving the variable to
the environment assignment.
Remove python file specifier as this works relative to the working
directory, which can vary. The test file directory can instead be
specified when executing the pytest command.
Add annotations required to allow database access with pytest to the
build tests.

(Bitbake rev: 7f4dfaa5bd28ccf1ae0122d984ffa7e02e693960)

Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
CC: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:37:03 +00:00
Richard Purdie
28f57b8cee bitbake: bitbake: Move to version 2.6.1 to mark runqueue changes
(Bitbake rev: 651a6dcf6f8ff33a4e9290a37c23e4f243974ac3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:29:09 +00:00
Richard Purdie
73ef8d57e0 bitbake: toastergui: Fix regex markup issues
lib/toaster/toastergui/templatetags/projecttags.py:170: DeprecationWarning: invalid escape sequence '\$'
    value=re.sub('_\$.*', '', value)

tests/views/test_views.py::ViewTests::test_custom_incomplete_params
  lib/toaster/toastergui/urls.py:211: DeprecationWarning: invalid escape sequence '\d'
    '/packages/(?P<package_id>\d+|)$',

(Bitbake rev: 57c738a9118a7a900fc7353d88a385d52c8be6f5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Richard Purdie
786ba56074 bitbake: toastermain/settings: Avoid python filehandle closure warnings
Switch to using with blocks when accessing files to ensure file
descriptors are closed and avoid python warnings.

(Bitbake rev: e8574ee78eea23cc35900610bb15e47e40ef5ee1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Richard Purdie
c2484f3dec bitbake: toaster: Fix assertRegexpMatches deprecation warnings
Fix:
    DeprecationWarning: Please use assertRegex instead.

(Bitbake rev: 81ee203fd55d45b199d7c3af681855d254e0d876)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Richard Purdie
029e82d418 bitbake: bb/toaster: Fix assertEquals deprecation warnings
Fix:
    DeprecationWarning: Please use assertEqual instead

(Bitbake rev: dd990ea6843685927954101feb729f3faa3a16d9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Alassane Yattara
829953631b bitbake: toaster/test: delay driver action until elements to appear
Update  tests/browser/(test_landing_page.py and test_layerdetails_page.py)
to delay driver actions until for elements to appear

(Bitbake rev: 72908138bd2735c69f5e418ec5f0f2cf8215050a)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Alassane Yattara
8efe835e3b bitbake: toaster/test: from test_no_builds_message.py wait for the empty state div to appear
>From tests/browser/test_sample.py wait for the empty state div to appear

(Bitbake rev: 56ea671526d6ec81b0d69f1bab6ac8f6796b8018)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Alassane Yattara
2d1f6c055d bitbake: toaster/test: bug-fix on tests/browser/test_all_builds_page
- Bug-fix on table filtering on (CompletedOn, filter failed task)
- Better handle testcase used time.sleep and remove it

(Bitbake rev: 03a8657dd377f87be08dd149ec507d153cb10a07)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Richard Purdie
0f4fe4f763 bitbake: runqueue: Improve inter setscene task dependency handling
The way the code currently handles dependencies between setscene tasks is fairly
poor, basically by deleting chunks of dependencies and adding reversed dependency
relationships.

This was once the best way to handle things but now a lot of the surrounding code
has changed and this approach is suboptimal and can be improved.

This change firstly adds debug logging for "hard" setscene task dependencies since
previously the codepaths were missing from logs making them very hard to read.

The changes to the setscene dependency graph are removed entirely this these altered
graphs were a significant source of problems. Instead, if a hard dependency is run
into, we mark the hard dependency as buildable and defer the task until the hard
dependencies are met.

The code now also skips the check_dependencies() code for hard dependencies since
previously that code was having to list all possible hard dependencies. We don't
need to do that as we can safely assume hard dependencies are required.

With these changes to runqueue's behaviour, we stand some chance of being able to
fix other bugs in OE-Core related to useradd for example.

(Bitbake rev: 367789b53c1c22ec26e0f4836cdf2bdd9c7d84fa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:28:03 +00:00
Joshua Watt
70ad9b9b30 bitbake: hashserv: sqlite: Ensure sync propagates to database connections
When the sqlite database backend was restructured, the code to make the
databases run in WAL mode and to control if sync() is called was
accidentally dropped. This caused terrible database performance to the
point that server timeouts were occurring causing really slow builds.

Fix this by properly enabling WAL mode and setting the synchronous flag
as requested

(Bitbake rev: c5b8c91d325ed1ca8abe5fe28d989693555c0622)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-04 22:36:09 +00:00
Charlie Johnston
1f8a639a67 bitbake: fetch2: Ensure GCP fetcher checks if file exists before download.
The GCP fetcher was calling bb.fetch2.check_network_access with
"gsutil stat" as the command, but then never actually ran that
command to check if the file exists. In cases where the file did
not exist in a gs:// premirror, this would lead to an unhandled
exception from do_fetch when the GCP python API tried to perform
the download.

This change resolves that issue by adding a runfetchcmd to call
gsutil.

(Bitbake rev: 1ab1d36c0af6fc58a974106b61ff4d37da6cb229)

Signed-off-by: Charlie Johnston <charlie.johnston@loftorbital.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Richard Haar
64725a9c32 bitbake: bitbake: tests: Fix duplicate test_underscore_override test
Found a duplicate test, added  _2 suffix to one, 74 tests now pass up from 73.

(Bitbake rev: ae2a19dadb4f3065b8731a61f45f29e6a70af402)

Signed-off-by: Richard Haar <rh@richhaar.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Joshua Watt
6b6374c336 bitbake: bitbake-hashclient: Add commands to get hashes
Adds subcommands to query the server for equivalent hashes and for
output hashes.

(Bitbake rev: 36ba202232399738670c9fb11169ead5590a3e82)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
5b18ff6d6b bitbake: toaster/tests: Test single recipe page
Test recipe page
    - Check if title is displayed
    - Check add recipe layer displayed
    - Check left section is displayed
        - Check recipe: name, summary, description, Version, Section,
        License, Approx. packages included, Approx. size, Recipe file

(Bitbake rev: 4f16f6666ef7ccda0e7194f2107fcbbc8f915be4)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
eb2af42e0a bitbake: toaster/tests: Test single layer page
Test layer page
    - Check if title is displayed
    - Check add/remove layer button works
    - Check tabs(layers, recipes, machines) are displayed
    - Check left section is displayed
        - Check layer name
        - Check layer summary
        - Check layer description

(Bitbake rev: 740b37cc077803f134391c99fc4cae45550020f3)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
200541ec56 bitbake: toaster/tests: Bug-fix on tests/functional/test_project_page
- Generate a random name for create project while test
- Set timeout on method _wait_until_build
- update test_machines_page, test_softwareRecipe_page and
  test_single_layer_page to  fix exception "element not interactable"

(Bitbake rev: 51c051da61a0396bdaa965065796476de7340727)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
5cd899da39 bitbake: toaster/tests: Added distro page TestCase
Test distros page
    - Check if title "Compatible distros" is displayed
    - Check search input
    - Check "Add layer" button works
    - Check distro table feature(show/hide column, pagination)

(Bitbake rev: 8b56af0837e9f09f13d6892c1aa1d82ecd5ef87d)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
00fb8ffca3 bitbake: toaster/tests: Added Layers page TestCase
Test layers page
    - Check if title "Compatible layerss" is displayed
    - Check search input
    - Check "Add layer" button works
    - Check "Remove layer" button works
    - Check layers table feature(show/hide column, pagination)

(Bitbake rev: a7bdda5b31f95e39c70eefb8ddf0ec690b3786ef)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
9de0b70cc3 bitbake: toaster/tests: Added Machine page TestCase
Test Machine page
    - Check if title "Compatible machines" is displayed
    - Check search input
    - Check "Select machine" button works
    - Check "Add layer" button works
    - Check Machine table feature(show/hide column, pagination)

(Bitbake rev: 98b78d49e2169d57324e4e471d7ad353963c273a)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
9f78fee273 bitbake: toaster/tests: Test software recipe page
Test software recipe page
    - Check title "Compatible software recipes" is displayed
    - Check search input
    - Check "build recipe" button works
    - Check software recipe table feature(show/hide column, pagination)

(Bitbake rev: b9c8c77d73d19bd4ddf9b6e90b0aa71f92d36993)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
2ee91ebd9c bitbake: toaster/tests: Override table edit columns TestCase from image recipe page
Better handle TestCase of table  edit column feature

(Bitbake rev: 6adc708a1520f8c947f9c40fdc88ebe2b51ecc97)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:23 +00:00
Alassane Yattara
715898cb9a bitbake: toaster/tests: Update methods wait_until_~ to skip using time.sleep
Update Class Wait from selenium_helpers_base, to override
wait_until_visible and wait_until_present with poll argument to better
handle delay between driver actions

(Bitbake rev: 486817ac6ad28580d81dcf6e3789678d9259bb54)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-02 18:04:22 +00:00
Richard Purdie
27f7ef2e44 bitbake: cooker: Avoid eventlog variable listing lockups
If the event log is enabled and parsing the metadata triggers log messages,
the event code and deadlock. Iterating the variables inside the event handling
code causes this. SOURCE_DATE_EPOCH triggers a python function which calls
bb.debug() and can trigger a lockup as one example.

Move the code around and add it to the BuildStarted events explictly. This
does mean runs without builds no longer get variables added to the eventlog
however we can look into a more targetted version of data if/as/where neded.

(Bitbake rev: 4135a617ae16d509362b5bf56378139cdc0876d2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-27 22:52:08 +00:00
Richard Purdie
7943caf90c bitbake: ui/ncurses: Add missing function call to avoid traceback
The ncurses UI wasn't working due to a missing function call. Add it
to avoid a traceback when starting builds.

(Bitbake rev: db8f36b69a68de2179e5685cf24a42ec10d68257)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-27 22:52:08 +00:00
Felix Moessbauer
2696bf8cf3 bitbake: fetch2/aws: forward env-vars used in gitlab-ci K8s
This patch adds the following variables to the allow-list, which are
used in the "IAM roles for AWS when using the GitLab chart":

- AWS_ROLE_ARN
- AWS_WEB_IDENTITY_TOKEN_FILE

These variables are set in the CI job environment and are needed to
access the sstate cache artifacts in a connected S3 bucket.

[1] https://docs.gitlab.com/charts/advanced/external-object-storage/aws-iam-roles.html

Reported-by: Zhi Bin Dong <zhibin.dong@siemens.com>
(Bitbake rev: c534526ea73805ee7cc16f3168b05ece10e0c03c)

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-23 17:55:08 +00:00