Skip to contentSkip to conversation

Make packaged-staging use more correct PSTAGE_PKGARCH

RFC PATCH In review Tom Rini 3 participants 5 messages Jun 21, 2010 – Jun 23, 2010

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

RFC PATCH 1/1 Make packaged-staging use more correct PSTAGE_PKGARCH

packaged-staging.bbclass: Change PSTAGE_PKGARCH to something dynamic

Currently, we make all pstage packages be locked to BUILD_SYS which causes annoying warnings in some cases and doesn't allow for sharing between say 32 and 64bit (which is valid for target bits).

This changes to ${PACKAGE_ARCH}-${HOST_SYS} for everything and reworks the opkg.conf we generate to add entries as needed.

There is an alternative, suggested by Chris Larson, that we modify PSTAGE_PKGARCH in an anon python function so that we can avoid things like 'x86_64-x86_64-linux' in native packages and similar duplication in sdk packages, or otherwise be more dynamic (use HOST_OS instead of SYS and then catch the cross case, etc).

classes/packaged-staging.bbclass +0 -0
index 8a98940..d6ac67b 100644

-12,7 +12,7 @@

 # bitbake.conf set PSTAGING_ACTIVE = "0", this class sets to "1" if 
we're active
 #
 PSTAGE_PKGVERSION = "${PV}-${PR}"
-PSTAGE_PKGARCH    = "${BUILD_SYS}"
+PSTAGE_PKGARCH    = "${PACKAGE_ARCH}-${HOST_SYS}"
 PSTAGE_EXTRAPATH  ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/"
 PSTAGE_PKGPATH    = "${DISTRO}${PSTAGE_EXTRAPATH}"
 PSTAGE_PKGPN      = 
"${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}"
 -148,15 +148,15 @@ staging_helper () {
 	# Assemble appropriate opkg.conf
 	conffile=${PSTAGE_MACHCONFIG}
 	mkdir -p ${PSTAGE_WORKDIR}/pstaging_lists
+	arch="${PSTAGE_PKGARCH}"
 	if [ ! -e $conffile ]; then
-		ipkgarchs="${BUILD_SYS}"
-		priority=1
-		for arch in $ipkgarchs; do
-			echo "arch $arch $priority" >> $conffile
-			priority=$(expr $priority + 5)
-		done
+		echo "arch $arch 1" > $conffile
 		echo "dest root /" >> $conffile
 	fi
+	if [ -f $conffile -a `grep -q $arch $conffile;echo $?` -ne 0 ]; then
+		priority=$(expr `grep -cE "^arch" $conffile` + 1)
+		sed -i -e "/dest/iarch $arch $priority" $conffile
+	fi
 	if [ ! -e ${TMPDIR}${libdir_native}/opkg/info/ ]; then
 		mkdir -p ${TMPDIR}${libdir_native}/opkg/info/
 	fi
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#1 lore raw
Quoted 6 lines · Tom Rini

packaged-staging.bbclass: Change PSTAGE_PKGARCH to something dynamic

Currently, we make all pstage packages be locked to BUILD_SYS which causes annoying warnings in some cases and doesn't allow for sharing between say 32 and 64bit (which is valid for target bits).

Quoted 8 lines

This changes to ${PACKAGE_ARCH}-${HOST_SYS} for everything and reworks the opkg.conf we generate to add entries as needed.

There is an alternative, suggested by Chris Larson, that we modify PSTAGE_PKGARCH in an anon python function so that we can avoid things like 'x86_64-x86_64-linux' in native packages and similar duplication in sdk packages, or otherwise be more dynamic (use HOST_OS instead of SYS and then catch the cross case, etc).

I think this approach sounds better having same arch repeated twice would be confusing

Quoted 50 lines
classes/packaged-staging.bbclass +0 -0
index 8a98940..d6ac67b 100644
 -12,7 +12,7 @@
 # bitbake.conf set PSTAGING_ACTIVE = "0", this class sets to "1" if

we're active
#
PSTAGE_PKGVERSION = "${PV}-${PR}"

classes/packaged-staging.bbclass +1 -1
-PSTAGE_PKGARCH    = "${BUILD_SYS}"
+PSTAGE_PKGARCH    = "${PACKAGE_ARCH}-${HOST_SYS}"
 PSTAGE_EXTRAPATH  ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/"
 PSTAGE_PKGPATH    = "${DISTRO}${PSTAGE_EXTRAPATH}"
 PSTAGE_PKGPN      = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}',

d).replace('_', '-')}"
-148,15 +148,15 @@ staging_helper () {

classes/packaged-staging.bbclass +6 -6
 	# Assemble appropriate opkg.conf
 	conffile=${PSTAGE_MACHCONFIG}
 	mkdir -p ${PSTAGE_WORKDIR}/pstaging_lists
+	arch="${PSTAGE_PKGARCH}"
 	if [ ! -e $conffile ]; then
-		ipkgarchs="${BUILD_SYS}"
-		priority=1
-		for arch in $ipkgarchs; do
-			echo "arch $arch $priority" >> $conffile
-			priority=$(expr $priority + 5)
-		done
+		echo "arch $arch 1" > $conffile
 		echo "dest root /" >> $conffile
 	fi
+	if [ -f $conffile -a `grep -q $arch $conffile;echo $?` -ne 0 ]; then
+		priority=$(expr `grep -cE "^arch" $conffile` + 1)
+		sed -i -e "/dest/iarch $arch $priority" $conffile
+	fi
 	if [ ! -e ${TMPDIR}${libdir_native}/opkg/info/ ]; then
 		mkdir -p ${TMPDIR}${libdir_native}/opkg/info/
 	fi
Signature · 8 lines
-- 
Tom Rini
Mentor Graphics Corporation

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
author
#2 lore raw
Quoted 10 lines · Khem Raj
Quoted 9 lines · Tom Rini

packaged-staging.bbclass: Change PSTAGE_PKGARCH to something dynamic

Currently, we make all pstage packages be locked to BUILD_SYS which causes annoying warnings in some cases and doesn't allow for sharing between say 32 and 64bit (which is valid for target bits).

This changes to ${PACKAGE_ARCH}-${HOST_SYS} for everything and reworks the opkg.conf we generate to add entries as needed.

Quoted 8 lines
Quoted 5 lines

There is an alternative, suggested by Chris Larson, that we modify PSTAGE_PKGARCH in an anon python function so that we can avoid things like 'x86_64-x86_64-linux' in native packages and similar duplication in sdk packages, or otherwise be more dynamic (use HOST_OS instead of SYS and then catch the cross case, etc).

I think this approach sounds better having same arch repeated twice would be confusing

Here we go. This also reworks generating opkg.conf a little bit (it had multiple entries before due to a lazy grep).

classes/packaged-staging.bbclass +0 -0
index 8a98940..19a6a6d 100644
@@ -12,7 +12,7 @@
 # bitbake.conf set PSTAGING_ACTIVE = "0", this class sets to "1" if 

we're active
#
PSTAGE_PKGVERSION = "${PV}-${PR}"

-PSTAGE_PKGARCH    = "${BUILD_SYS}"
+PSTAGE_PKGARCH    = "${PACKAGE_ARCH}-${HOST_OS}"
 PSTAGE_EXTRAPATH  ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/"
 PSTAGE_PKGPATH    = "${DISTRO}${PSTAGE_EXTRAPATH}"
 PSTAGE_PKGPN      = 

"${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}" @@ -28,6 +28,12 @@ PSTAGE_NATIVEDEPENDS = "\

BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}"

+python __anonymous() {
+ # We need PSTAGE_PKGARCH to contain information about the target.
+ if bb.data.inherits_class('cross', d):
+ bb.data.setVar('PSTAGE_PKGARCH', "${HOST_SYS}-${PACKAGE_ARCH}-${TARGET_OS}", d)
+}
+
python () {
pstage_allowed = True

@@ -148,14 +154,13 @@ staging_helper () {
# Assemble appropriate opkg.conf conffile=${PSTAGE_MACHCONFIG}
mkdir -p ${PSTAGE_WORKDIR}/pstaging_lists
+ arch="${PSTAGE_PKGARCH}"
if [ ! -e $conffile ]; then
- ipkgarchs="${BUILD_SYS}"
- priority=1
- for arch in $ipkgarchs; do
- echo "arch $arch $priority" >> $conffile
- priority=$(expr $priority + 5)
- done
+ echo "arch $arch 1" > $conffile
echo "dest root /" >> $conffile
+ elif [ grep -c " $arch " $conffile -eq 0 ]; then
+ priority=$(expr grep -cE "^arch" $conffile + 1)
+ sed -i -e "/dest/iarch $arch $priority" $conffile
fi
if [ ! -e ${TMPDIR}${libdir_native}/opkg/info/ ]; then
mkdir -p ${TMPDIR}${libdir_native}/opkg/info/

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
Acked-by
#3 lore raw
Quoted 17 lines · Tom Rini
Quoted 16 lines · Khem Raj
Quoted 14 lines · Tom Rini

packaged-staging.bbclass: Change PSTAGE_PKGARCH to something dynamic

Currently, we make all pstage packages be locked to BUILD_SYS which causes annoying warnings in some cases and doesn't allow for sharing between say 32 and 64bit (which is valid for target bits).

This changes to ${PACKAGE_ARCH}-${HOST_SYS} for everything and reworks the opkg.conf we generate to add entries as needed.

There is an alternative, suggested by Chris Larson, that we modify PSTAGE_PKGARCH in an anon python function so that we can avoid things like 'x86_64-x86_64-linux' in native packages and similar duplication in sdk packages, or otherwise be more dynamic (use HOST_OS instead of SYS and then catch the cross case, etc).

Quoted 7 lines
Quoted 2 lines

I think this approach sounds better having same arch repeated twice would be confusing

Here we go. This also reworks generating opkg.conf a little bit (it had multiple entries before due to a lazy grep).

very nice

Quoted 60 lines
classes/packaged-staging.bbclass +0 -0
index 8a98940..19a6a6d 100644
@@ -12,7 +12,7 @@
 # bitbake.conf set PSTAGING_ACTIVE = "0", this class sets to "1" if

we're active
#
PSTAGE_PKGVERSION = "${PV}-${PR}"

classes/packaged-staging.bbclass +1 -1
-PSTAGE_PKGARCH    = "${BUILD_SYS}"
+PSTAGE_PKGARCH    = "${PACKAGE_ARCH}-${HOST_OS}"
 PSTAGE_EXTRAPATH  ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/"
 PSTAGE_PKGPATH    = "${DISTRO}${PSTAGE_EXTRAPATH}"
 PSTAGE_PKGPN      = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}',

d).replace('_', '-')}"

classes/packaged-staging.bbclass +11 -6
@@ -28,6 +28,12 @@ PSTAGE_NATIVEDEPENDS = "\
 
 BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}"
 
+python __anonymous() {
+    # We need PSTAGE_PKGARCH to contain information about the target.
+    if bb.data.inherits_class('cross', d):
+        bb.data.setVar('PSTAGE_PKGARCH',
 "${HOST_SYS}-${PACKAGE_ARCH}-${TARGET_OS}", d)
+}
+
 python () {
     pstage_allowed = True
@@ -148,14 +154,13 @@ staging_helper () {
 	# Assemble appropriate opkg.conf
 	conffile=${PSTAGE_MACHCONFIG}
 	mkdir -p ${PSTAGE_WORKDIR}/pstaging_lists
+	arch="${PSTAGE_PKGARCH}"
 	if [ ! -e $conffile ]; then
-		ipkgarchs="${BUILD_SYS}"
-		priority=1
-		for arch in $ipkgarchs; do
-			echo "arch $arch $priority" >> $conffile
-			priority=$(expr $priority + 5)
-		done
+		echo "arch $arch 1" > $conffile
 		echo "dest root /" >> $conffile
+	elif [ `grep -c " $arch " $conffile` -eq 0 ]; then
+		priority=$(expr `grep -cE "^arch" $conffile` + 1)
+		sed -i -e "/dest/iarch $arch $priority" $conffile
 	fi
 	if [ ! -e ${TMPDIR}${libdir_native}/opkg/info/ ]; then
 		mkdir -p ${TMPDIR}${libdir_native}/opkg/info/
Signature · 8 lines
-- 
Tom Rini
Mentor Graphics Corporation

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Acked-by
#4 lore raw
Quoted 21 lines · Khem Raj
Quoted 20 lines · Tom Rini
Quoted 18 lines · Khem Raj
Quoted 6 lines · Tom Rini

packaged-staging.bbclass: Change PSTAGE_PKGARCH to something dynamic

Currently, we make all pstage packages be locked to BUILD_SYS which causes annoying warnings in some cases and doesn't allow for sharing between say 32 and 64bit (which is valid for target bits).

Quoted 8 lines

This changes to ${PACKAGE_ARCH}-${HOST_SYS} for everything and reworks the opkg.conf we generate to add entries as needed.

There is an alternative, suggested by Chris Larson, that we modify PSTAGE_PKGARCH in an anon python function so that we can avoid things like 'x86_64-x86_64-linux' in native packages and similar duplication in sdk packages, or otherwise be more dynamic (use HOST_OS instead of SYS and then catch the cross case, etc).

I think this approach sounds better having same arch repeated twice would be confusing

Quoted 8 lines
Quoted 4 lines

Here we go. This also reworks generating opkg.conf a little bit (it had multiple entries before due to a lazy grep).

very nice

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics