Skip to contentSkip to conversation

buildinfo: Added buildinfo recipe

PATCH In review Alejandro Hernandez 4 participants 4 messages Oct 10, 2014 – Oct 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildinfo: Added buildinfo recipe

Writes build information to target filesystem to help developers

[YOCTO #6770]

---
 meta/recipes-extended/buildinfo/buildinfo_0.1.bb | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 meta/recipes-extended/buildinfo/buildinfo_0.1.bb
meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +34 -0
new file mode 100644
index 0000000..b299efb
@@ -0,0 +1,34 @@
+DESCRIPTION = "Writing build information on target filesystem"
+SECTION = "MISC"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+PR = "r0"
+
+inherit buildhistory
+
+def buildinfo_target(d):
+        # Get context
+        if d.getVar('BB_WORKERCONTEXT', True) != '1':
+                return ""
+        # Single and list variables to be read
+        vars = "DISTRO DISTRO_VERSION BB_VERSION BUILD_SYS TARGET_SYS MACHINE USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL PACKAGE_EXCLUDE"
+        listvars = "USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL PACKAGE_EXCLUDE"
+        return outputvars(vars, listvars, d)
+
+do_install() {
+        # Write info to file
+        cat > build <<END
+-----------------------
+Build Configuration:  |
+-----------------------
+${@buildinfo_target(d)}
+-----------------------
+Layer Revisions:      |
+-----------------------
+${@buildhistory_get_metadata_revs(d)}
+END
+
+        # Install file with right permissions
+	install -d ${D}${sysconfdir}
+	install -m 0444 build ${D}${sysconfdir}
+}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 16 lines · Alejandro Hernandez

Writes build information to target filesystem to help developers

[YOCTO #6770]

---
 meta/recipes-extended/buildinfo/buildinfo_0.1.bb | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 meta/recipes-extended/buildinfo/buildinfo_0.1.bb
meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +0 -0
new file mode 100644
index 0000000..b299efb

meta/recipes-extended/buildinfo/buildinfo_0.1.bb line 2

Quoted 2 lines
meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +2 -0
@@ -0,0 +1,34 @@
+DESCRIPTION = "Writing build information on target filesystem"
+SECTION = "MISC"

MISC? I'd use base.

meta/recipes-extended/buildinfo/buildinfo_0.1.bb line 5

Quoted 3 lines
meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +3 -0
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+PR = "r0"

Don't set PR please.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#2 lore raw
In reply to Alejandro Hernandez

Op 10 okt. 2014, om 20:29 heeft Alejandro Hernandez <[email protected]> het volgende geschreven:

Quoted 16 lines

Writes build information to target filesystem to help developers

[YOCTO #6770]

---
meta/recipes-extended/buildinfo/buildinfo_0.1.bb | 34 ++++++++++++++++++++++++

1 file changed, 34 insertions(+)

create mode 100644 meta/recipes-extended/buildinfo/buildinfo_0.1.bb

meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +0 -0
new file mode 100644
index 0000000..b299efb

meta/recipes-extended/buildinfo/buildinfo_0.1.bb line 5

Quoted 5 lines
meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +5 -0
@@ -0,0 +1,34 @@
+DESCRIPTION = "Writing build information on target filesystem"
+SECTION = "MISC"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+PR = "r0"

PR isn't used anymore

meta/recipes-extended/buildinfo/buildinfo_0.1.bb line 15

Quoted 10 lines
meta/recipes-extended/buildinfo/buildinfo_0.1.bb new file +10 -0
+
+inherit buildhistory
+
+def buildinfo_target(d):
+        # Get context
+        if d.getVar('BB_WORKERCONTEXT', True) != '1':
+                return ""
+        # Single and list variables to be read
+        vars = "DISTRO DISTRO_VERSION BB_VERSION BUILD_SYS TARGET_SYS MACHINE USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL PACKAGE_EXCLUDE"
+        listvars = "USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL PACKAGE_EXCLUDE"

Don't use IMAGE* vars in package recipes, that breaks the orthogonality of the OE system.

#3 lore raw
Quoted 1 line · Koen Kooi

Don't use IMAGE* vars in package recipes, that breaks the orthogonality of the OE system.

To expand on what Koen said, you shouldn't use image-specific variables in a package as then the package can't be re-used in multiple images. At best you'll end up rebuilding the package every time an image is created, at worst images will have incorrect buildinfo.

Instead, implement this functionality as an optional image creation postprocess hook.

Ross