Skip to contentSkip to conversation

utils.py: Modify and rename distro_features_backfill python function

PATCH In review Andrei Gherzan 4 participants 11 messages Jul 10, 2012 – Jul 25, 2012 1 message not in the archive

lore
Share & tools
lore

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

#1 lore raw

PATCH 1/5 utils.py: Modify and rename distro_features_backfill python function

This function was written to be used with DISTRO_FEATURES. This behavior is usefull with MACHINE_FEATURES as well.

---
 meta/lib/oe/utils.py |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
meta/lib/oe/utils.py +6 -3
index 8912dac..5a19a76 100644
@@ -89,15 +89,18 @@ def inherits(d, *classes):
     """Return True if the metadata inherits any of the specified classes"""
     return any(bb.data.inherits_class(cls, d) for cls in classes)
 
-def distro_features_backfill(d):
+def features_backfill(var,d):
+    # This construct allows the addition of new features to variable specified
+    # as var
+    # Example for var = "DISTRO_FEATURES"
     # This construct allows the addition of new features to DISTRO_FEATURES
     # that if not present would disable existing functionality, without
     # disturbing distributions that have already set DISTRO_FEATURES.
     # Distributions wanting to elide a value in DISTRO_FEATURES_BACKFILL should
     # add the feature to DISTRO_FEATURES_BACKFILL_CONSIDERED
 
-    backfill = (d.getVar("DISTRO_FEATURES_BACKFILL", True) or "").split()
-    considered = (d.getVar("DISTRO_FEATURES_BACKFILL_CONSIDERED", True) or "").split()
+    backfill = (d.getVar(var+"_BACKFILL", True) or "").split()
+    considered = (d.getVar(var+"_BACKFILL_CONSIDERED", True) or "").split()
 
     addfeatures = []
     for feature in backfill:
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/5 bitbake.conf: Use the new form of features_backfill function

This function was modified in order to be used with other variables then DISTRO_FEATURES. Use this new function name and add the parameter needed.

---
 meta/conf/bitbake.conf |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
index 3453a86..855ba6a 100644
@@ -722,7 +722,7 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 
 DISTRO_FEATURES_BACKFILL = "pulseaudio"
-DISTRO_FEATURES_append = "${@oe.utils.distro_features_backfill(d)}"
+DISTRO_FEATURES_append = "${@oe.utils.features_backfill("DISTRO_FEATURES",d)}"
 
 COMBINED_FEATURES = "\
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "alsa", d)} \
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/5 bitbake.conf: Add MACHINE_FEATURES_BACKFILL and append to MACHINE_FEATURES

In reply to Andrei Gherzan

This is works the way DISTRO_FEATURES_BACKFILL does.

---
 meta/conf/bitbake.conf |    3 +++
 1 file changed, 3 insertions(+)
meta/conf/bitbake.conf +3 -0
index 855ba6a..6a4d4ef 100644
@@ -724,6 +724,9 @@ IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 DISTRO_FEATURES_BACKFILL = "pulseaudio"
 DISTRO_FEATURES_append = "${@oe.utils.features_backfill("DISTRO_FEATURES",d)}"
 
+MACHINE_FEATURES_BACKFILL = ""
+MACHINE_FEATURES_append = "${@oe.utils.features_backfill("MACHINE_FEATURES",d)}"
+
 COMBINED_FEATURES = "\
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "alsa", d)} \
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "bluetooth", d)} \
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/5 bitbake.conf: Add rtc to MACHINE_FEATURES_BACKFILL

In reply to Andrei Gherzan

This was done this way so that the current machine configuration would remain unaffected.
The rtc MACHINE_FEATURE will specify if a real time clock is avalaible.

---
 meta/conf/bitbake.conf |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
index 6a4d4ef..8904132 100644
@@ -724,7 +724,7 @@ IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 DISTRO_FEATURES_BACKFILL = "pulseaudio"
 DISTRO_FEATURES_append = "${@oe.utils.features_backfill("DISTRO_FEATURES",d)}"
 
-MACHINE_FEATURES_BACKFILL = ""
+MACHINE_FEATURES_BACKFILL = "rtc"
 MACHINE_FEATURES_append = "${@oe.utils.features_backfill("MACHINE_FEATURES",d)}"
 
 COMBINED_FEATURES = "\
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/5 busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

In reply to Andrei Gherzan
---
 meta/recipes-core/busybox/busybox.inc |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
meta/recipes-core/busybox/busybox.inc +7 -3
index 82137a3..17ff442 100644
@@ -180,9 +180,13 @@ do_install () {
 	if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
 		install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
 	fi
-	if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
-		install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
-	fi
+	case "${MACHINE_FEATURES}" in
+	*rtc*)
+		if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
+			install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
+		fi
+		;;
+	esac
 	if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
 		install -d ${D}${sysconfdir}/udhcpc.d
 		install -d ${D}${datadir}/udhcpc
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH 5/5] busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

Quoted 16 lines · Andrei Gherzan
---
 meta/recipes-core/busybox/busybox.inc |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
meta/recipes-core/busybox/busybox.inc +0 -3
index 82137a3..17ff442 100644
@@ -180,9 +180,13 @@ do_install () {
 	if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
 		install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
 	fi
-	if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
-		install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
-	fi

meta/recipes-core/busybox/busybox.inc do_install () { · line 192

Quoted 10 lines
meta/recipes-core/busybox/busybox.inc +7 -0
+	case "${MACHINE_FEATURES}" in
+	*rtc*)
+		if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
+			install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
+		fi
+		;;
+	esac
 	if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
 		install -d ${D}${sysconfdir}/udhcpc.d
 		install -d ${D}${datadir}/udhcpc

This makes busybox machine specific? Is that really what you want to do?

Cheers,

Richard

#7 lore raw

Re: [PATCH 5/5] busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

Quoted 32 lines · Richard Purdie

Review

Quoted 6 lines · Andrei Gherzan
---
 meta/recipes-core/busybox/busybox.inc |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-core/busybox/busybox.inc

meta/recipes-core/busybox/busybox.inc do_install () { · line 181

Quoted 6 lines

index 82137a3..17ff442 100644

meta/recipes-core/busybox/busybox.inc +0 -0
@@ -180,9 +180,13 @@ do_install () {
      if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
              install -m 0755 ${WORKDIR}/busybox-udhcpd

${D}${sysconfdir}/init.d/

meta/recipes-core/busybox/busybox.inc do_install () {

Quoted 3 lines
meta/recipes-core/busybox/busybox.inc +0 -2
      fi
-     if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
-             install -m 0755 ${WORKDIR}/hwclock.sh

${D}${sysconfdir}/init.d/

meta/recipes-core/busybox/busybox.inc do_install () {

Quoted 5 lines
meta/recipes-core/busybox/busybox.inc +4 -1
-     fi
+     case "${MACHINE_FEATURES}" in
+     *rtc*)
+             if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
+                     install -m 0755 ${WORKDIR}/hwclock.sh

${D}${sysconfdir}/init.d/

meta/recipes-core/busybox/busybox.inc do_install () { · line 192

Quoted 6 lines
meta/recipes-core/busybox/busybox.inc +3 -0
+             fi
+             ;;
+     esac
      if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
              install -d ${D}${sysconfdir}/udhcpc.d
              install -d ${D}${datadir}/udhcpc
Quoted 3 lines

This makes busybox machine specific? Is that really what you want to do?

I want to have hwclock init script only on machines with RTC.

@g

#8 lore raw

Re: [PATCH 5/5] busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

Quoted 35 lines · Andrei Gherzan
Quoted 32 lines · Richard Purdie

Review

Quoted 6 lines · Andrei Gherzan
---
 meta/recipes-core/busybox/busybox.inc |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-core/busybox/busybox.inc

meta/recipes-core/busybox/busybox.inc do_install () { · line 181

Quoted 6 lines

index 82137a3..17ff442 100644

meta/recipes-core/busybox/busybox.inc +0 -0
@@ -180,9 +180,13 @@ do_install () {
      if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
              install -m 0755 ${WORKDIR}/busybox-udhcpd

${D}${sysconfdir}/init.d/

meta/recipes-core/busybox/busybox.inc do_install () {

Quoted 3 lines
meta/recipes-core/busybox/busybox.inc +0 -2
      fi
-     if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
-             install -m 0755 ${WORKDIR}/hwclock.sh

${D}${sysconfdir}/init.d/

meta/recipes-core/busybox/busybox.inc do_install () {

Quoted 5 lines
meta/recipes-core/busybox/busybox.inc +4 -1
-     fi
+     case "${MACHINE_FEATURES}" in
+     *rtc*)
+             if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
+                     install -m 0755 ${WORKDIR}/hwclock.sh

${D}${sysconfdir}/init.d/

Quoted 6 lines
meta/recipes-core/busybox/busybox.inc +3 -0
+             fi
+             ;;
+     esac
      if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
              install -d ${D}${sysconfdir}/udhcpc.d
              install -d ${D}${datadir}/udhcpc
Quoted 5 lines
Quoted 3 lines

This makes busybox machine specific? Is that really what you want to do?

I want to have hwclock init script only on machines with RTC.

And to move a little further, busybox should be configured with CONFIG_HWCLOCK=y only if it makes sense for that MACHINE. In my opinion this is machine specific. So avoiding an init script but still having useless utils doesn't sound good for me.

@g

#9 lore raw

Re: [PATCH 5/5] busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

Quoted 3 lines · Andrei Gherzan

And to move a little further, busybox should be configured with CONFIG_HWCLOCK=y only if it makes sense for that MACHINE. In my opinion this is machine specific.

That's a DISTRO decision. I suspect most that have binary feeds would prefer to have a single busybox binary per architecture, and accept the few wasted bytes on machines without RTC, than to make it MACHINE specific and end up building it multiple times.

Anyway, such policy belongs in your distro layer and not in oe-core.

p.

#10 lore raw

Re: [PATCH 5/5] busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

Quoted 9 lines · Phil Blundell
Quoted 3 lines · Andrei Gherzan

And to move a little further, busybox should be configured with CONFIG_HWCLOCK=y only if it makes sense for that MACHINE. In my opinion this is machine specific.

That's a DISTRO decision. I suspect most that have binary feeds would prefer to have a single busybox binary per architecture, and accept the few wasted bytes on machines without RTC, than to make it MACHINE specific and end up building it multiple times.

Agreed.

It would be better to package initscript + hwclock to separate packages and then pull it to image only for machines with RTC.. but not making whole busybox machine specific.

Another advantage of this would be option to use busybox-hwclock as utility and hwclock-systemd instead of busybox-hwclock-init for images which are using systemd.

Cheers,

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#11 lore raw

Re: [PATCH 5/5] busybox.inc: Install hwclock init script only if rtc is present in MACHINE_FEATURES

Quoted 13 lines · Martin Jansa
Quoted 9 lines · Phil Blundell
Quoted 3 lines · Andrei Gherzan

And to move a little further, busybox should be configured with CONFIG_HWCLOCK=y only if it makes sense for that MACHINE. In my opinion this is machine specific.

That's a DISTRO decision. I suspect most that have binary feeds would prefer to have a single busybox binary per architecture, and accept the few wasted bytes on machines without RTC, than to make it MACHINE specific and end up building it multiple times.

Agreed.

Quoted 9 lines

It would be better to package initscript + hwclock to separate packages and then pull it to image only for machines with RTC.. but not making whole busybox machine specific.

Another advantage of this would be option to use busybox-hwclock as utility and hwclock-systemd instead of busybox-hwclock-init for images which are using systemd.

Thank you all. It makes sense to keep busybox machine independent. I agree. Now if i package this init script separately how would it be pulled in by images? Think this could brake some image which now relay on this being pulled in by busybox.

ag