Skip to contentSkip to conversation

Modify buildstats to be merged inside buildhistory

PATCH In review Corneliu Stoicescu 3 participants 4 messages Jan 6, 2014 – Jan 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Modify buildstats to be merged inside buildhistory

- 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(-)
meta/classes/buildhistory.bbclass +3 -0
index e9a9c3b..54efecfe 100644
@@ -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
 #
meta/classes/buildstats.bbclass +1 -1
index 72fff11..c8769ae 100644
@@ -1,4 +1,4 @@
-BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
+BUILDSTATS_BASE ??= "${TMPDIR}/buildstats/"
 BNFILE = "${BUILDSTATS_BASE}/.buildname"
 DEVFILE = "${BUILDSTATS_BASE}/.device"
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 2 lines · Corneliu Stoicescu

- 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!

Quoted 33 lines
---
  meta/classes/buildhistory.bbclass |    3 +++
  meta/classes/buildstats.bbclass   |    2 +-
  2 files changed, 4 insertions(+), 1 deletion(-)
meta/classes/buildhistory.bbclass +3 -0
index e9a9c3b..54efecfe 100644
@@ -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
  #
meta/classes/buildstats.bbclass +1 -1
index 72fff11..c8769ae 100644
@@ -1,4 +1,4 @@
-BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
+BUILDSTATS_BASE ??= "${TMPDIR}/buildstats/"
  BNFILE = "${BUILDSTATS_BASE}/.buildname"
  DEVFILE = "${BUILDSTATS_BASE}/.device"
 
#2 lore raw
In reply to Corneliu Stoicescu
Quoted 12 lines · Corneliu Stoicescu

- 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(-)
meta/classes/buildhistory.bbclass +0 -0
index e9a9c3b..54efecfe 100644

meta/classes/buildhistory.bbclass BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group" · line 24

Quoted 9 lines
meta/classes/buildhistory.bbclass +3 -0
@@ -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

#3 lore raw
Quoted 10 lines

meta/classes/buildhistory.bbclass BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd

Quoted 3 lines
meta/classes/buildhistory.bbclass +0 -0
@@ -16,9 +16,12 @@ BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd

/etc/group"

meta/classes/buildhistory.bbclass BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd · line 17

Quoted 2 lines
meta/classes/buildhistory.bbclass +0 -0
 BUILDHISTORY_COMMIT ?= "0"
 BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory

<buildhistory@${DISTRO}>"

Quoted 3 lines
meta/classes/buildhistory.bbclass +1 -0
 BUILDHISTORY_PUSH_REPO ?= ""
+BUILDSTATS_BASE = "${BUILDHISTORY_DIR}/buildstats"
 
Quoted 9 lines

meta/classes/buildhistory.bbclass BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group" · line 24

Quoted 4 lines
meta/classes/buildhistory.bbclass +2 -0
 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