[V2] Modify buildstats to be merged inside buildhistory

Submitted by Corneliu Stoicescu on Jan. 6, 2014, 5:12 p.m.

Details

Message ID 1389028342-23264-1-git-send-email-corneliux.stoicescu@intel.com
State New
Headers show

Commit Message

Corneliu Stoicescu Jan. 6, 2014, 5:12 p.m.
- added buildstats inheritance inside buildhistory
- when buildhisory is used, buildstats will be moved inside the buildhistory directory
---
 meta/classes/buildhistory.bbclass |    3 +++
 meta/classes/buildstats.bbclass   |    2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index e9a9c3b..54efecfe 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -16,9 +16,12 @@  BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group"
 BUILDHISTORY_COMMIT ?= "0"
 BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>"
 BUILDHISTORY_PUSH_REPO ?= ""
+BUILDSTATS_BASE = "${BUILDHISTORY_DIR}/buildstats"
 
 SSTATEPOSTINSTFUNCS += "buildhistory_emit_pkghistory"
 
+inherit buildstats
+
 #
 # Write out metadata about this package for comparision when writing future packages
 #
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 72fff11..c8769ae 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -1,4 +1,4 @@ 
-BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
+BUILDSTATS_BASE ??= "${TMPDIR}/buildstats/"
 BNFILE = "${BUILDSTATS_BASE}/.buildname"
 DEVFILE = "${BUILDSTATS_BASE}/.device"
 

Comments

Saul Wold Jan. 8, 2014, 5:31 p.m.
On 01/06/2014 09:12 AM, Corneliu Stoicescu wrote:
> - added buildstats inheritance inside buildhistory
> - when buildhisory is used, buildstats will be moved inside the buildhistory directory

This does not seem to have a Signed-off-by:

Please submit a v2 for review.

Thanks
	Sau!

> ---
>   meta/classes/buildhistory.bbclass |    3 +++
>   meta/classes/buildstats.bbclass   |    2 +-
>   2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index e9a9c3b..54efecfe 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -16,9 +16,12 @@ BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group"
>   BUILDHISTORY_COMMIT ?= "0"
>   BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>"
>   BUILDHISTORY_PUSH_REPO ?= ""
> +BUILDSTATS_BASE = "${BUILDHISTORY_DIR}/buildstats"
>
>   SSTATEPOSTINSTFUNCS += "buildhistory_emit_pkghistory"
>
> +inherit buildstats
> +
>   #
>   # Write out metadata about this package for comparision when writing future packages
>   #
> diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
> index 72fff11..c8769ae 100644
> --- a/meta/classes/buildstats.bbclass
> +++ b/meta/classes/buildstats.bbclass
> @@ -1,4 +1,4 @@
> -BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
> +BUILDSTATS_BASE ??= "${TMPDIR}/buildstats/"
>   BNFILE = "${BUILDSTATS_BASE}/.buildname"
>   DEVFILE = "${BUILDSTATS_BASE}/.device"
>
>
Richard Purdie Jan. 8, 2014, 5:36 p.m.
On Mon, 2014-01-06 at 18:12 +0100, Corneliu Stoicescu wrote:
> - added buildstats inheritance inside buildhistory
> - when buildhisory is used, buildstats will be moved inside the buildhistory directory
> ---
>  meta/classes/buildhistory.bbclass |    3 +++
>  meta/classes/buildstats.bbclass   |    2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index e9a9c3b..54efecfe 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -16,9 +16,12 @@ BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group"
>  BUILDHISTORY_COMMIT ?= "0"
>  BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>"
>  BUILDHISTORY_PUSH_REPO ?= ""
> +BUILDSTATS_BASE = "${BUILDHISTORY_DIR}/buildstats"
>  
>  SSTATEPOSTINSTFUNCS += "buildhistory_emit_pkghistory"
>  
> +inherit buildstats
> +

I don't think we need this inherit line. The user can still decide
whether to include it or not, if it is included, it can be under
buildhistory control. So it should be safe simply to remove it.

Cheers,

Richard
Corneliu Stoicescu Jan. 9, 2014, 10:46 a.m.
> > --- a/meta/classes/buildhistory.bbclass
> > +++ b/meta/classes/buildhistory.bbclass
> > @@ -16,9 +16,12 @@ BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd
> /etc/group"
> >  BUILDHISTORY_COMMIT ?= "0"
> >  BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory
> <buildhistory@${DISTRO}>"
> >  BUILDHISTORY_PUSH_REPO ?= ""
> > +BUILDSTATS_BASE = "${BUILDHISTORY_DIR}/buildstats"
> >
> >  SSTATEPOSTINSTFUNCS += "buildhistory_emit_pkghistory"
> >
> > +inherit buildstats
> > +
> 
> I don't think we need this inherit line. The user can still decide whether to
> include it or not, if it is included, it can be under buildhistory control. So it
> should be safe simply to remove it.
> 

Removing this inherit and using the manual suggested steps to activate buildhistory in local.conf:
"
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"
"

Will result in buildhistory being inherited before buildstats:
"
cornel@NODE1:~/SSD/poky/build$ bitbake -e | grep 'INHERIT='
INHERIT=" buildhistory poky-sanity package_rpm buildstats image-mklibs image-prelink debian devshell sstate license sanity"
"

This will cause part of the build_stats file(which is written at the end of the build) to be left out of the commits when git is used for buildhistory:
"
cornel@NODE1:~/SSD/poky/build/buildhistory$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   buildstats/core-image-minimal-qemux86-64/201401091123/build_stats
#
no changes added to commit (use "git add" and/or "git commit -a")
"

An easy way to avoid this is to activate buildhistory by adding it after buildstats in USER_CLASSES in local.conf:
"
USER_CLASSES ?= "buildstats image-mklibs image-prelink buildhistory"
"
Or
"
USER_CLASSES += "buildhistory"
"

So in order to make this work, we either change the suggested way to enable buildhistory or find a workaround in code.

Regards,
Corneliu