Skip to contentSkip to conversation

bitbake: add documentation for "bitbake -S lockedsigs"

PATCH In review Julien Stephan 2 participants 10 messages Sep 17, 2024 – Sep 18, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bitbake: add documentation for "bitbake -S lockedsigs"

The following commit added "lockedsigs" as new signature handler for the
-S option of bitbake:
2cf13f25139 - lib/oe/sstatesig.py: dump locked.sigs.inc only when explicitly asked via -S lockedsigs

But it was not documented anywhere, so add some basic documentation for it in both the .rst documentation files and the help message of bitbake

---
 .../bitbake-user-manual-execution.rst               |  6 ++++++
 .../bitbake-user-manual-intro.rst                   | 13 +++++++++----
 bitbake/lib/bb/main.py                              | 12 +++++++-----
 3 files changed, 22 insertions(+), 9 deletions(-)
bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst +6 -0
index d58fbb32ea0..ac1e2a76811 100644
@@ -592,6 +592,12 @@ compare the matched signatures to determine the stamps and delta
 where these two stamp trees diverge. This can be used to determine why
 tasks need to be re-run in situations where that is not expected.
 
+The third signature handler that can be passed is "lockedsigs" that will
+conveniently write the task signatures in a file called "locked-sigs.inc",
+that can be included in user's configuration to lock recipes or tasks.
+User can include the whole file or extract the signatures needed to lock
+only selected tasks or recipes.
+
 .. note::
 
    It is likely that future versions of BitBake will provide other
bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst +9 -4
index 35ffb88b026..127c662320b 100644
@@ -398,10 +398,15 @@ Following is the usage and syntax for BitBake::
      -S SIGNATURE_HANDLER, --dump-signatures=SIGNATURE_HANDLER
                            Dump out the signature construction information, with
                            no task execution. The SIGNATURE_HANDLER parameter is
-                           passed to the handler. Two common values are none and
-                           printdiff but the handler may define more/less. none
-                           means only dump the signature, printdiff means compare
-                           the dumped signature with the cached one.
+                           passed to the handler. Allowed values are none,
+                           printdiff and lockedsigs. none means only dump the
+                           signature, printdiff means recursively compare the
+                           dumped signature with the most recent one in a local
+                           build or sstate cache (can be used to find out why
+                           tasks re-run when that is not expected). lockedsigs
+                           means generate a locked-sigs.inc file containing the
+                           locked signature of all tasks needed to build the
+                           target.
      -p, --parse-only      Quit after parsing the BB recipes.
      -s, --show-versions   Show current and preferred versions of all recipes.
      -e, --environment     Show the global or per-recipe environment complete
bitbake/lib/bb/main.py +7 -5
index bca8ebfa090..1f4313fa0dd 100755
@@ -215,11 +215,13 @@ def create_bitbake_parser():
                         default=[], metavar="SIGNATURE_HANDLER",
                         help="Dump out the signature construction information, with no task "
                              "execution. The SIGNATURE_HANDLER parameter is passed to the "
-                             "handler. Two common values are none and printdiff but the handler "
-                             "may define more/less. none means only dump the signature, printdiff"
-                             " means recursively compare the dumped signature with the most recent"
-                             " one in a local build or sstate cache (can be used to find out why tasks re-run"
-                             " when that is not expected)")
+                             "handler. Allowed values are none, printdiff and lockedsigs. "
+                             "none means only dump the signature, printdiff means recursively "
+                             "compare the dumped signature with the most recent one in a local "
+                             "build or sstate cache (can be used to find out why tasks re-run "
+                             "when that is not expected). lockedsigs means generate a locked-sigs.inc "
+                             "file containing the locked signature of all tasks needed to build "
+                             "the target.")
 
     exec_group.add_argument("--revisions-changed", action="store_true",
                         help="Set the exit code depending on whether upstream floating "
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 bitbake: main: add choices to restrict -S parameter

Currently, available -S parameters are "none", "printdiff" and "lockedsigs", but there is no check on parameter, so user can literally give anything to -S and it will act as if "none" was specified.

Fix this by adding the allowed values in choices for -S parameter

---
 bitbake/lib/bb/main.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/lib/bb/main.py +1 -0
index 1f4313fa0dd..24758646eaa 100755
@@ -213,6 +213,7 @@ def create_bitbake_parser():
 
     exec_group.add_argument("-S", "--dump-signatures", action="append",
                         default=[], metavar="SIGNATURE_HANDLER",
+                        choices=["none", "printdiff", "lockedsigs"],
                         help="Dump out the signature construction information, with no task "
                              "execution. The SIGNATURE_HANDLER parameter is passed to the "
                              "handler. Allowed values are none, printdiff and lockedsigs. "
Signature · 1 line
2.34.1
#2 lore raw
In reply to Julien Stephan
Quoted 7 lines · Julien Stephan via lists.openembedded.org

The following commit added "lockedsigs" as new signature handler for the
-S option of bitbake:
    2cf13f25139 - lib/oe/sstatesig.py: dump locked.sigs.inc only when explicitly asked via -S lockedsigs

But it was not documented anywhere, so add some basic documentation for it in both the .rst documentation files and the help message of bitbake

Quoted 6 lines

---
 .../bitbake-user-manual-execution.rst               |  6 ++++++ .../bitbake-user-manual-intro.rst                   | 13 +++++++++---- bitbake/lib/bb/main.py                              | 12 +++++++-----

 3 files changed, 22 insertions(+), 9 deletions(-)

Unfortunately I don't think this is quite so simple. The lockedsigs support is implemented in OE-Core and BitBake doesn't contain that code. This makes it very hard to accurately document since it is metadata dependent.

I do agree we need to improve this somehow, I just don't know how.

Cheers,

Richard

#3 lore raw
Quoted 16 lines · Richard Purdie
Quoted 7 lines · Julien Stephan via lists.openembedded.org

The following commit added "lockedsigs" as new signature handler for the
-S option of bitbake:
2cf13f25139 - lib/oe/sstatesig.py: dump locked.sigs.inc only when explicitly asked via -S lockedsigs

But it was not documented anywhere, so add some basic documentation for it in both the .rst documentation files and the help message of bitbake

Quoted 6 lines
---
 .../bitbake-user-manual-execution.rst               |  6 ++++++
 .../bitbake-user-manual-intro.rst                   | 13 +++++++++----
 bitbake/lib/bb/main.py                              | 12 +++++++-----
 3 files changed, 22 insertions(+), 9 deletions(-)
Quoted 6 lines

Unfortunately I don't think this is quite so simple. The lockedsigs support is implemented in OE-Core and BitBake doesn't contain that code. This makes it very hard to accurately document since it is metadata dependent.

I do agree we need to improve this somehow, I just don't know how.

Hi Richard,

Maybe we should remove this from bitbake and implement it using bblock? :) Let me know if I can help on this!

Cheers

Julien

Quoted 6 lines

Cheers,

Richard

#4 lore raw
Quoted 30 lines · Julien Stephan
Quoted 28 lines · Richard Purdie
Quoted 11 lines · Julien Stephan via lists.openembedded.org

The following commit added "lockedsigs" as new signature handler for the
-S option of bitbake:
    2cf13f25139 - lib/oe/sstatesig.py: dump locked.sigs.inc only when explicitly asked via -S lockedsigs

But it was not documented anywhere, so add some basic documentation for
it in both the .rst documentation files and the help message of bitbake

Quoted 8 lines

---
 .../bitbake-user-manual-execution.rst               |  6 ++++++ .../bitbake-user-manual-intro.rst                   | 13
+++++++++----
 bitbake/lib/bb/main.py                              | 12
+++++++-----

 3 files changed, 22 insertions(+), 9 deletions(-)

Unfortunately I don't think this is quite so simple. The lockedsigs support is implemented in OE-Core and BitBake doesn't contain that code. This makes it very hard to accurately document since it is metadata dependent.

Quoted 7 lines
Quoted 1 line

I do agree we need to improve this somehow, I just don't know how.

Hi Richard,

Maybe we should remove this from bitbake and implement it using bblock? :)
Let me know if I can help on this!

That is a direction I've been wondering about and I think it would make sense. It is one of the reasons I wanted to see the lock/unlock commands become separate tools!

Cheers,

Richard

#5 lore raw
Quoted 36 lines · Richard Purdie
Quoted 34 lines · Julien Stephan
Quoted 23 lines · Richard Purdie
Quoted 11 lines · Julien Stephan via lists.openembedded.org

The following commit added "lockedsigs" as new signature handler for the
-S option of bitbake:
2cf13f25139 - lib/oe/sstatesig.py: dump locked.sigs.inc only
when explicitly asked via -S lockedsigs

But it was not documented anywhere, so add some basic documentation for
it in both the .rst documentation files and the help message of bitbake

Quoted 8 lines
---
 .../bitbake-user-manual-execution.rst               |  6 ++++++
 .../bitbake-user-manual-intro.rst                   | 13
+++++++++----
 bitbake/lib/bb/main.py                              | 12
+++++++-----
 3 files changed, 22 insertions(+), 9 deletions(-)
Quoted 6 lines

Unfortunately I don't think this is quite so simple. The lockedsigs support is implemented in OE-Core and BitBake doesn't contain that code. This makes it very hard to accurately document since it is metadata dependent.

I do agree we need to improve this somehow, I just don't know how.

Hi Richard,

Quoted 8 lines
Quoted 3 lines

Maybe we should remove this from bitbake and implement it using bblock? :)
Let me know if I can help on this!

That is a direction I've been wondering about and I think it would make sense. It is one of the reasons I wanted to see the lock/unlock commands become separate tools!

ok then let me try to come up with something :)

By the way, my next step was to send a patch adding documentation for SIGGEN_LOCKEDSIGS*
variables, but I realize that the same problem applies to these variables, right?
I don't see any reference for these variables inside bitbake code.. Should I add them in yocto-docs ?

Quoted 5 lines

Cheers,

Richard

#6 lore raw
Quoted 50 lines · Julien Stephan
Quoted 48 lines · Richard Purdie
Quoted 45 lines · Julien Stephan
Quoted 35 lines · Richard Purdie
Quoted 15 lines · Julien Stephan via lists.openembedded.org

The following commit added "lockedsigs" as new signature handler
for the
-S option of bitbake:
    2cf13f25139 - lib/oe/sstatesig.py: dump locked.sigs.inc only
when explicitly asked via -S lockedsigs

But it was not documented anywhere, so add some basic documentation for
it in both the .rst documentation files and the help message of
bitbake

Quoted 8 lines

---
 .../bitbake-user-manual-execution.rst               |  6
++++++
 .../bitbake-user-manual-intro.rst                   | 13
+++++++++----
 bitbake/lib/bb/main.py                              | 12
+++++++-----

 3 files changed, 22 insertions(+), 9 deletions(-)

Unfortunately I don't think this is quite so simple. The lockedsigs
support is implemented in OE-Core and BitBake doesn't contain that
code. This makes it very hard to accurately document since it is
metadata dependent.

Quoted 2 lines

I do agree we need to improve this somehow, I just don't know how.

Hi Richard,

Maybe we should remove this from bitbake and implement it using bblock? :)
Let me know if I can help on this!

Quoted 7 lines
Quoted 5 lines

That is a direction I've been wondering about and I think it would make
sense. It is one of the reasons I wanted to see the lock/unlock commands become separate tools!

ok then let me try to come up with something :)

Sounds good!

Quoted 6 lines

By the way, my next step was to send a patch adding documentation for SIGGEN_LOCKEDSIGS*
variables, but I realize that the same problem applies to these variables,  right?
I don't see any reference for these variables inside bitbake code.. Should I add them in yocto-docs ?

Yes, they wouldn't be documented in bitbake but they could be documented in the main variable index.

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [bitbake-devel] [PATCH 2/2] bitbake: main: add choices to restrict -S parameter

Quoted 17 lines · Julien Stephan via lists.openembedded.org

Currently, available -S parameters are "none", "printdiff" and "lockedsigs", but there is no check on parameter, so user can literally give anything to -S and it will act as if "none" was specified.

Fix this by adding the allowed values in choices for -S parameter

---
 bitbake/lib/bb/main.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/lib/bb/main.py +0 -0
index 1f4313fa0dd..24758646eaa 100755

bitbake/lib/bb/main.py def create_bitbake_parser(): · line 216

Quoted 4 lines
bitbake/lib/bb/main.py +1 -0
@@ -213,6 +213,7 @@ def create_bitbake_parser():
 
     exec_group.add_argument("-S", "--dump-signatures", action="append",
                         default=[], metavar="SIGNATURE_HANDLER",
+                        choices=["none", "printdiff", "lockedsigs"],

Richard,

Should I send a v2, dropping lockedsigs? Or should this patch be dropped also?

Cheers
Julien

Quoted 15 lines
bitbake/lib/bb/main.py +0 -1
                         help="Dump out the signature construction information, with no task "
                              "execution. The SIGNATURE_HANDLER parameter is passed to the "
                              "handler. Allowed values are none, printdiff and lockedsigs. "
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16566): https://lists.openembedded.org/g/bitbake-devel/message/16566
Mute This Topic: https://lists.openembedded.org/mt/108502729/4356723
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#9 lore raw

Re: [bitbake-devel] [PATCH 2/2] bitbake: main: add choices to restrict -S parameter

Quoted 21 lines · Julien Stephan via lists.openembedded.org
Quoted 18 lines · Julien Stephan via lists.openembedded.org

Currently, available -S parameters are "none", "printdiff" and "lockedsigs", but there is no check on parameter, so user can literally give anything to -S and it will act as if "none" was specified.

Fix this by adding the allowed values in choices for -S parameter

---
 bitbake/lib/bb/main.py | 1 +

 1 file changed, 1 insertion(+)
bitbake/lib/bb/main.py +0 -0
index 1f4313fa0dd..24758646eaa 100755
@@ -213,6 +213,7 @@ def create_bitbake_parser():
 
Quoted 7 lines

bitbake/lib/bb/main.py def create_bitbake_parser(): · line 216

Quoted 3 lines
bitbake/lib/bb/main.py +1 -0
      exec_group.add_argument("-S", "--dump-signatures", action="append",
                          default=[], metavar="SIGNATURE_HANDLER",
+                        choices=["none", "printdiff", "lockedsigs"],

Richard,

Should I send a v2, dropping lockedsigs? Or should this patch be dropped also?

The comment applied to the series, I can't merge it as the handlers are metadata specific. I think we might need to ultimately move this functionality elsewhere and drop -S entirely.

Cheers,

Richard

#10 lore raw

Re: [bitbake-devel] [PATCH 2/2] bitbake: main: add choices to restrict -S parameter

Quoted 29 lines · Richard Purdie
Quoted 27 lines · Julien Stephan via lists.openembedded.org
Quoted 17 lines · Julien Stephan via lists.openembedded.org

Currently, available -S parameters are "none", "printdiff" and "lockedsigs", but there is no check on parameter, so user can literally give anything to -S and it will act as if "none" was specified.

Fix this by adding the allowed values in choices for -S parameter

---
 bitbake/lib/bb/main.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/lib/bb/main.py +0 -0
index 1f4313fa0dd..24758646eaa 100755

bitbake/lib/bb/main.py def create_bitbake_parser(): · line 216

Quoted 4 lines
bitbake/lib/bb/main.py +1 -0
@@ -213,6 +213,7 @@ def create_bitbake_parser():
 
     exec_group.add_argument("-S", "--dump-signatures", action="append",
                         default=[], metavar="SIGNATURE_HANDLER",
+                        choices=["none", "printdiff", "lockedsigs"],

Richard,

Quoted 6 lines
Quoted 1 line

Should I send a v2, dropping lockedsigs? Or should this patch be dropped also?

The comment applied to the series, I can't merge it as the handlers are metadata specific. I think we might need to ultimately move this functionality elsewhere and drop -S entirely.

Noted!
Thank you

Quoted 3 lines

Cheers,

Richard