[02/23] buildhistory.bbclass: add BUILDHISTORY_FORCE_UPDATE option

Submitted by Mikko Rapeli on July 20, 2017, 1:22 p.m. | Patch ID: 142164

Details

Message ID 1500556991-11471-3-git-send-email-mikko.rapeli@bmw.de
State New
Headers show

Commit Message

Mikko Rapeli July 20, 2017, 1:22 p.m.
Setting BUILDHISTORY_FORCE_UPDATE = "1" in local.conf forces buildhistory
updates and recipe rebuilds also when only buildhistory.bbclass changed.

This is handy when using sstate cache and modifying buildhistory to include
new data like recipe and package LICENSE fields.

By default new buildhistory data is updated when recipes are rebuild and
new fields like LICENSE are not deployed immediately.

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
---
 meta/classes/buildhistory.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index cc3b144..bc3145e 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -42,10 +42,11 @@  BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>"
 BUILDHISTORY_PUSH_REPO ?= ""
 
 SSTATEPOSTINSTFUNCS_append = " buildhistory_emit_pkghistory"
-# We want to avoid influencing the signatures of sstate tasks - first the function itself:
-sstate_install[vardepsexclude] += "buildhistory_emit_pkghistory"
+# If BUILDHISTORY_FORCE_UPDATE is not set, we want to avoid influencing the
+# signatures of sstate tasks - first the function itself:
+sstate_install[vardepsexclude] += "${@'' if d.getVar('BUILDHISTORY_FORCE_UPDATE', True) == '1' else 'buildhistory_emit_pkghistory'}"
 # then the value added to SSTATEPOSTINSTFUNCS:
-SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory"
+SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "${@'' if d.getVar('BUILDHISTORY_FORCE_UPDATE', True) == '1' else '| buildhistory_emit_pkghistory'"
 
 # Similarly for our function that gets the output signatures
 SSTATEPOSTUNPACKFUNCS_append = " buildhistory_emit_outputsigs"

Comments

Mikko Rapeli Aug. 2, 2017, 7:41 a.m.
On Thu, Jul 20, 2017 at 04:22:50PM +0300, Mikko Rapeli wrote:
> Setting BUILDHISTORY_FORCE_UPDATE = "1" in local.conf forces buildhistory
> updates and recipe rebuilds also when only buildhistory.bbclass changed.
> 
> This is handy when using sstate cache and modifying buildhistory to include
> new data like recipe and package LICENSE fields.
> 
> By default new buildhistory data is updated when recipes are rebuild and
> new fields like LICENSE are not deployed immediately.

Are there some problems with this approach?

I did not find other ways to force updates of buildhistory data without
writing custom functions to update LICENSE and CVE_PRODUCT (which I care about
now) for every build. If there was a way to invalidate the full sstate
cache then that would work too, but I doubt a simple PE update somewhere would
do it.

-Mikko

> Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
> ---
>  meta/classes/buildhistory.bbclass | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index cc3b144..bc3145e 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -42,10 +42,11 @@ BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>"
>  BUILDHISTORY_PUSH_REPO ?= ""
>  
>  SSTATEPOSTINSTFUNCS_append = " buildhistory_emit_pkghistory"
> -# We want to avoid influencing the signatures of sstate tasks - first the function itself:
> -sstate_install[vardepsexclude] += "buildhistory_emit_pkghistory"
> +# If BUILDHISTORY_FORCE_UPDATE is not set, we want to avoid influencing the
> +# signatures of sstate tasks - first the function itself:
> +sstate_install[vardepsexclude] += "${@'' if d.getVar('BUILDHISTORY_FORCE_UPDATE', True) == '1' else 'buildhistory_emit_pkghistory'}"
>  # then the value added to SSTATEPOSTINSTFUNCS:
> -SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory"
> +SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "${@'' if d.getVar('BUILDHISTORY_FORCE_UPDATE', True) == '1' else '| buildhistory_emit_pkghistory'"
>  
>  # Similarly for our function that gets the output signatures
>  SSTATEPOSTUNPACKFUNCS_append = " buildhistory_emit_outputsigs"
> -- 
> 1.9.1