public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-21  7:59 [PATCH 0/2] Refactor external-python-tarball Kang Kai
@ 2013-01-21  7:59 ` Kang Kai
  2013-01-21 10:25   ` Richard Purdie
  0 siblings, 1 reply; 9+ messages in thread
From: Kang Kai @ 2013-01-21  7:59 UTC (permalink / raw)
  To: openembedded-core; +Cc: Zhenfeng.Zhao

external-python-tarball only can be built when inherit package_ipk now.
Update it and split the populate python operation to separated bbclass
according the value of PACKAGE_CLASSES, then it could be built for rpm
and deb too.

[Yocto 3006]

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 meta/classes/populate_python_deb.bbclass          |   42 ++++++++++++++
 meta/classes/populate_python_ipk.bbclass          |   43 +++++++++++++++
 meta/classes/populate_python_rpm.bbclass          |   59 ++++++++++++++++++++
 meta/recipes-core/meta/external-python-tarball.bb |   61 ++++-----------------
 4 files changed, 155 insertions(+), 50 deletions(-)
 create mode 100644 meta/classes/populate_python_deb.bbclass
 create mode 100644 meta/classes/populate_python_ipk.bbclass
 create mode 100644 meta/classes/populate_python_rpm.bbclass

diff --git a/meta/classes/populate_python_deb.bbclass b/meta/classes/populate_python_deb.bbclass
new file mode 100644
index 0000000..5f2edb8
--- /dev/null
+++ b/meta/classes/populate_python_deb.bbclass
@@ -0,0 +1,42 @@
+do_populate_sdk[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot bzip2-native:do_populate_sysroot"
+do_populate_sdk[recrdeptask] += "do_package_write_deb"
+
+
+DEB_SDK_ARCH = "${@[d.getVar('SDK_ARCH', True), "i386"]\
+                [d.getVar('SDK_ARCH', True) in \
+                ["x86", "i486", "i586", "i686", "pentium"]]}"
+
+do_populate_sdk[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
+
+populate_sdk_post_deb () {
+
+	local target_rootfs=$1
+
+	mkdir -p ${target_rootfs}/etc
+	tar -cf - -C ${STAGING_ETCDIR_NATIVE} -ps apt | tar -xf - -C ${target_rootfs}/etc
+}
+
+populate_python_sdk () {
+
+	# update index
+	package_update_index_deb
+
+	## install nativesdk ##
+	echo "Installing NATIVESDK packages"
+	export INSTALL_ROOTFS_DEB="${SDK_OUTPUT}"
+	export INSTALL_BASEARCH_DEB="${DEB_SDK_ARCH}"
+	export INSTALL_ARCHS_DEB="${SDK_PACKAGE_ARCHS}"
+	export INSTALL_PACKAGES_NORMAL_DEB="${TOOLCHAIN_HOST_TASK}"
+	export INSTALL_PACKAGES_ATTEMPTONLY_DEB="${TOOLCHAIN_HOST_TASK_ATTEMPTONLY}"
+	export PACKAGES_LINGUAS_DEB=""
+	export INSTALL_TASK_DEB="populate_sdk-nativesdk"
+
+	package_install_internal_deb
+	populate_sdk_post_deb ${SDK_OUTPUT}/${SDKPATHNATIVE}
+
+	#move remainings
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/lib/dpkg
+	mv ${SDK_OUTPUT}/var/lib/dpkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/lib/dpkg
+	rm -rf ${SDK_OUTPUT}/var
+}
+
diff --git a/meta/classes/populate_python_ipk.bbclass b/meta/classes/populate_python_ipk.bbclass
new file mode 100644
index 0000000..dadd13f
--- /dev/null
+++ b/meta/classes/populate_python_ipk.bbclass
@@ -0,0 +1,43 @@
+
+DEPENDS += "opkg-native opkg-utils-native"
+
+IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}"
+
+populate_python_sdk() {
+	mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/
+
+	rm -f ${IPKGCONF_TARGET}
+	touch ${IPKGCONF_TARGET}
+	rm -f ${IPKGCONF_SDK}
+	touch ${IPKGCONF_SDK}
+
+	package_update_index_ipk
+	package_generate_ipkg_conf
+
+	for arch in ${PACKAGE_ARCHS}; do
+		revipkgarchs="$arch $revipkgarchs"
+	done
+
+	${IPKG_HOST} update
+	${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK}
+
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
+	mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
+	rm -Rf ${SDK_OUTPUT}/var
+
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
+	install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
+
+	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
+
+	# Link the ld.so.cache file into the hosts filesystem
+	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
+
+	# Add version information
+	versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
+	touch $versionfile
+	echo 'Distro: ${DISTRO}' >> $versionfile
+	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
+	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
+	echo 'Timestamp: ${DATETIME}' >> $versionfile
+}
diff --git a/meta/classes/populate_python_rpm.bbclass b/meta/classes/populate_python_rpm.bbclass
new file mode 100644
index 0000000..4eb9ce8
--- /dev/null
+++ b/meta/classes/populate_python_rpm.bbclass
@@ -0,0 +1,59 @@
+# Smart is python based, so be sure python-native is available to us.
+EXTRANATIVEPATH += "python-native"
+
+do_populate_sdk[depends] += "rpm-native:do_populate_sysroot"
+do_populate_sdk[depends] += "rpmresolve-native:do_populate_sysroot"
+do_populate_sdk[depends] += "python-smartpm-native:do_populate_sysroot"
+
+# Creating the repo info in do_rootfs
+do_populate_sdk[depends] += "createrepo-native:do_populate_sysroot"
+
+do_populate_sdk[recrdeptask] += "do_package_write_rpm"
+
+rpmlibdir = "/var/lib/rpm"
+RPMOPTS="--dbpath ${rpmlibdir}"
+RPM="rpm ${RPMOPTS}"
+
+do_populate_sdk[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
+
+populate_sdk_post_rpm () {
+
+	local target_rootfs=$1
+
+	# remove lock files
+	rm -f ${target_rootfs}/__db.*
+
+	# Remove all remaining resolver files
+	rm -rf ${target_rootfs}/install
+	rm -rf ${target_rootfs}/var/lib/smart
+}
+
+populate_python_sdk () {
+
+	package_update_index_rpm
+
+	export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}"
+	export INSTALL_PLATFORM_RPM="${SDK_ARCH}"
+    export INSTALL_PLATFORM_EXTRA_RPM="${SDK_ARCH}-nativesdk"
+	export INSTALL_PACKAGES_RPM="${TOOLCHAIN_HOST_TASK}"
+	export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${TOOLCHAIN_TARGET_HOST_ATTEMPTONLY}"
+	export INSTALL_PACKAGES_LINGUAS_RPM=""
+	export INSTALL_PROVIDENAME_RPM="/bin/sh /bin/bash /usr/bin/env /usr/bin/perl pkgconfig libGL.so()(64bit) libGL.so"
+	export INSTALL_TASK_RPM="populate_sdk_rpm-nativesdk"
+	export INSTALL_COMPLEMENTARY_RPM=""
+
+	# Setup base system configuration
+	mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
+
+	package_install_internal_rpm --sdk
+	populate_sdk_post_rpm ${INSTALL_ROOTFS_RPM}
+
+	# move host RPM library data
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/rpm
+	mv ${SDK_OUTPUT}${rpmlibdir}/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/rpm/
+	rm -Rf ${SDK_OUTPUT}/var
+
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
+	mv ${SDK_OUTPUT}/etc/* ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
+	rm -rf ${SDK_OUTPUT}/etc
+}
diff --git a/meta/recipes-core/meta/external-python-tarball.bb b/meta/recipes-core/meta/external-python-tarball.bb
index 2085acc..d996bdf 100644
--- a/meta/recipes-core/meta/external-python-tarball.bb
+++ b/meta/recipes-core/meta/external-python-tarball.bb
@@ -3,18 +3,17 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native sed-native"
+DEPENDS = "virtual/fakeroot-native sed-native"
 
-PR = "r1"
+PR = "r2"
 
 inherit meta
+inherit populate_python_${IMAGE_PKGTYPE}
 
 SDK_DIR = "${WORKDIR}/sdk"
 SDK_OUTPUT = "${SDK_DIR}/image"
 SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
 
-IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}"
-
 TOOLCHAIN_HOST_TASK ?= "\
     nativesdk-python-core \
     nativesdk-python-textutils \
@@ -43,56 +42,18 @@ RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
 
 EXCLUDE_FROM_WORLD = "1"
 
-do_populate_sdk() {
-	rm -rf ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/
-
-	rm -f ${IPKGCONF_TARGET}
-	touch ${IPKGCONF_TARGET}
-	rm -f ${IPKGCONF_SDK}
-	touch ${IPKGCONF_SDK}
-
-	package_update_index_ipk
-	package_generate_ipkg_conf
-
-	for arch in ${PACKAGE_ARCHS}; do
-		revipkgarchs="$arch $revipkgarchs"
-	done
-
-	${IPKG_HOST} update
-	${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK}
-
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
-	mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
-	rm -Rf ${SDK_OUTPUT}/var
+fakeroot do_populate_sdk() {
+    rm -rf ${SDK_OUTPUT}
+    mkdir -p ${SDK_OUTPUT}
 
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
-	install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
+    populate_python_sdk
 
-	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
-
-	# Link the ld.so.cache file into the hosts filesystem
-	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
-
-	# Add version information
-	versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
-	touch $versionfile
-	echo 'Distro: ${DISTRO}' >> $versionfile
-	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
-	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
-	echo 'Timestamp: ${DATETIME}' >> $versionfile
-
-	# Package it up
-	mkdir -p ${SDK_DEPLOY}
-	cd ${SDK_OUTPUT}
-	tar  --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
+    # Package it up
+    mkdir -p ${SDK_DEPLOY}
+    cd ${SDK_OUTPUT}
+    tar  --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
 }
 
 do_populate_sdk[nostamp] = "1"
 do_populate_sdk[recrdeptask] = "do_package_write"
 addtask populate_sdk before do_build after do_install
-
-inherit blacklist
-
-PNBLACKLIST[external-python-tarball] = "${@base_contains('PACKAGE_CLASSES', 'package_ipk', '', 'This recipe requires \'package_ipk\' support to be enabled in PACKAGE_CLASSES.', d)}"
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-21  7:59 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
@ 2013-01-21 10:25   ` Richard Purdie
  2013-01-22  1:52     ` Kang Kai
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Purdie @ 2013-01-21 10:25 UTC (permalink / raw)
  To: Kang Kai; +Cc: Zhenfeng.Zhao, openembedded-core

On Mon, 2013-01-21 at 15:59 +0800, Kang Kai wrote:
> external-python-tarball only can be built when inherit package_ipk now.
> Update it and split the populate python operation to separated bbclass
> according the value of PACKAGE_CLASSES, then it could be built for rpm
> and deb too.
> 
> [Yocto 3006]
> 
> Signed-off-by: Kang Kai <kai.kang@windriver.com>
> ---
>  meta/classes/populate_python_deb.bbclass          |   42 ++++++++++++++
>  meta/classes/populate_python_ipk.bbclass          |   43 +++++++++++++++
>  meta/classes/populate_python_rpm.bbclass          |   59 ++++++++++++++++++++
>  meta/recipes-core/meta/external-python-tarball.bb |   61 ++++-----------------
>  4 files changed, 155 insertions(+), 50 deletions(-)
>  create mode 100644 meta/classes/populate_python_deb.bbclass
>  create mode 100644 meta/classes/populate_python_ipk.bbclass
>  create mode 100644 meta/classes/populate_python_rpm.bbclass

No, sorry but this isn't right. We already have package specific
functions to do these things, we should be trying to reuse those. If we
can't reuse the functions, we need to improve them so we can.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-21 10:25   ` Richard Purdie
@ 2013-01-22  1:52     ` Kang Kai
  0 siblings, 0 replies; 9+ messages in thread
From: Kang Kai @ 2013-01-22  1:52 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Zhenfeng.Zhao, openembedded-core

On 2013年01月21日 18:25, Richard Purdie wrote:
> On Mon, 2013-01-21 at 15:59 +0800, Kang Kai wrote:
>> external-python-tarball only can be built when inherit package_ipk now.
>> Update it and split the populate python operation to separated bbclass
>> according the value of PACKAGE_CLASSES, then it could be built for rpm
>> and deb too.
>>
>> [Yocto 3006]
>>
>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>> ---
>>   meta/classes/populate_python_deb.bbclass          |   42 ++++++++++++++
>>   meta/classes/populate_python_ipk.bbclass          |   43 +++++++++++++++
>>   meta/classes/populate_python_rpm.bbclass          |   59 ++++++++++++++++++++
>>   meta/recipes-core/meta/external-python-tarball.bb |   61 ++++-----------------
>>   4 files changed, 155 insertions(+), 50 deletions(-)
>>   create mode 100644 meta/classes/populate_python_deb.bbclass
>>   create mode 100644 meta/classes/populate_python_ipk.bbclass
>>   create mode 100644 meta/classes/populate_python_rpm.bbclass
> No, sorry but this isn't right. We already have package specific
> functions to do these things, we should be trying to reuse those. If we
> can't reuse the functions, we need to improve them so we can.

OK, I'll try to use the existed function.

Thanks,
Kai
>
> Cheers,
>
> Richard
>
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 0/2] V2: Refactor external-python-tarball
@ 2013-01-22 11:30 Kang Kai
  2013-01-22 11:30 ` [PATCH 1/2] createrepo-native: update dependency Kang Kai
  2013-01-22 11:30 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
  0 siblings, 2 replies; 9+ messages in thread
From: Kang Kai @ 2013-01-22 11:30 UTC (permalink / raw)
  To: richard.purdie; +Cc: Zhenfeng.Zhao, openembedded-core

V2:
Reuse the populate_sdk_base code to update external-python-tarball.

The following changes since commit 37e025f6f9c410005e0f1dee0767e38eaec01cbd:

  bitbake: hob: Hob should display warnings generated during parsing (2013-01-21 19:05:31 +0000)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib kangkai/external-python
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/external-python

Kang Kai (2):
  createrepo-native: update dependency
  external-python-tarball: code refactoring

 meta/recipes-core/meta/external-python-tarball.bb  |   69 ++------------------
 .../createrepo/createrepo_0.4.11.bb                |    4 +-
 2 files changed, 8 insertions(+), 65 deletions(-)

-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] createrepo-native: update dependency
  2013-01-22 11:30 [PATCH 0/2] V2: Refactor external-python-tarball Kang Kai
@ 2013-01-22 11:30 ` Kang Kai
  2013-01-22 11:30 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
  1 sibling, 0 replies; 9+ messages in thread
From: Kang Kai @ 2013-01-22 11:30 UTC (permalink / raw)
  To: richard.purdie; +Cc: Zhenfeng.Zhao, openembedded-core

"RDEPENDS_${PN}_class-native" doesn't work for native recipe because no
-native package will be created. Then the dependencies listed here are
not built when bitbake createrepo-native.
Update and use DEPENDS_class-native instead.

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 .../createrepo/createrepo_0.4.11.bb                |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-support/createrepo/createrepo_0.4.11.bb b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
index 227ebcb..c977c2e 100644
--- a/meta/recipes-support/createrepo/createrepo_0.4.11.bb
+++ b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
@@ -4,9 +4,9 @@ HOMEPAGE = "http://createrepo.baseurl.org/"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760"
 
-RDEPENDS_${PN}_class-native += "libxml2-native rpm-native"
+DEPENDS_class-native += "libxml2-native rpm-native"
 
-PR = "r8"
+PR = "r9"
 
 SRC_URI= "http://createrepo.baseurl.org/download/${BP}.tar.gz \
           file://fix-native-install.patch \
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-22 11:30 [PATCH 0/2] V2: Refactor external-python-tarball Kang Kai
  2013-01-22 11:30 ` [PATCH 1/2] createrepo-native: update dependency Kang Kai
@ 2013-01-22 11:30 ` Kang Kai
  2013-01-22 16:58   ` Saul Wold
  1 sibling, 1 reply; 9+ messages in thread
From: Kang Kai @ 2013-01-22 11:30 UTC (permalink / raw)
  To: richard.purdie; +Cc: Zhenfeng.Zhao, openembedded-core

external-python-tarball only can be built when inherit package_ipk now.
Update it to reuse existed populate sdk code that it could be built for
rpm and deb too.

[Yocto 3006]

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 meta/recipes-core/meta/external-python-tarball.bb |   69 ++-------------------
 1 files changed, 6 insertions(+), 63 deletions(-)

diff --git a/meta/recipes-core/meta/external-python-tarball.bb b/meta/recipes-core/meta/external-python-tarball.bb
index 2085acc..186bf50 100644
--- a/meta/recipes-core/meta/external-python-tarball.bb
+++ b/meta/recipes-core/meta/external-python-tarball.bb
@@ -3,19 +3,16 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native sed-native"
+DEPENDS = "virtual/fakeroot-native sed-native"
 
-PR = "r1"
+PR = "r2"
 
 inherit meta
+inherit populate_sdk
 
-SDK_DIR = "${WORKDIR}/sdk"
-SDK_OUTPUT = "${SDK_DIR}/image"
-SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
+TOOLCHAIN_TARGET_TASK = ""
 
-IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}"
-
-TOOLCHAIN_HOST_TASK ?= "\
+TOOLCHAIN_HOST_TASK = "\
     nativesdk-python-core \
     nativesdk-python-textutils \
     nativesdk-python-sqlite3 \
@@ -37,62 +34,8 @@ TOOLCHAIN_HOST_TASK ?= "\
     nativesdk-chrpath \
     "
 
-TOOLCHAIN_OUTPUTNAME ?= "python-nativesdk-standalone-${SDKMACHINE}"
+TOOLCHAIN_OUTPUTNAME = "python-nativesdk-standalone-${SDKMACHINE}"
 
 RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
 
 EXCLUDE_FROM_WORLD = "1"
-
-do_populate_sdk() {
-	rm -rf ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/
-
-	rm -f ${IPKGCONF_TARGET}
-	touch ${IPKGCONF_TARGET}
-	rm -f ${IPKGCONF_SDK}
-	touch ${IPKGCONF_SDK}
-
-	package_update_index_ipk
-	package_generate_ipkg_conf
-
-	for arch in ${PACKAGE_ARCHS}; do
-		revipkgarchs="$arch $revipkgarchs"
-	done
-
-	${IPKG_HOST} update
-	${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK}
-
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
-	mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
-	rm -Rf ${SDK_OUTPUT}/var
-
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
-	install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
-
-	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
-
-	# Link the ld.so.cache file into the hosts filesystem
-	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
-
-	# Add version information
-	versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
-	touch $versionfile
-	echo 'Distro: ${DISTRO}' >> $versionfile
-	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
-	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
-	echo 'Timestamp: ${DATETIME}' >> $versionfile
-
-	# Package it up
-	mkdir -p ${SDK_DEPLOY}
-	cd ${SDK_OUTPUT}
-	tar  --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
-}
-
-do_populate_sdk[nostamp] = "1"
-do_populate_sdk[recrdeptask] = "do_package_write"
-addtask populate_sdk before do_build after do_install
-
-inherit blacklist
-
-PNBLACKLIST[external-python-tarball] = "${@base_contains('PACKAGE_CLASSES', 'package_ipk', '', 'This recipe requires \'package_ipk\' support to be enabled in PACKAGE_CLASSES.', d)}"
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-22 11:30 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
@ 2013-01-22 16:58   ` Saul Wold
  2013-01-23  2:35     ` Kang Kai
  0 siblings, 1 reply; 9+ messages in thread
From: Saul Wold @ 2013-01-22 16:58 UTC (permalink / raw)
  To: Kang Kai; +Cc: Zhenfeng.Zhao, openembedded-core

On 01/22/2013 03:30 AM, Kang Kai wrote:
> external-python-tarball only can be built when inherit package_ipk now.
> Update it to reuse existed populate sdk code that it could be built for
> rpm and deb too.
>
> [Yocto 3006]
>
> Signed-off-by: Kang Kai <kai.kang@windriver.com>
> ---
>   meta/recipes-core/meta/external-python-tarball.bb |   69 ++-------------------
>   1 files changed, 6 insertions(+), 63 deletions(-)
>
> diff --git a/meta/recipes-core/meta/external-python-tarball.bb b/meta/recipes-core/meta/external-python-tarball.bb
> index 2085acc..186bf50 100644
> --- a/meta/recipes-core/meta/external-python-tarball.bb
> +++ b/meta/recipes-core/meta/external-python-tarball.bb
> @@ -3,19 +3,16 @@ LICENSE = "MIT"
>   LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
>                       file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
>
> -DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native sed-native"
> +DEPENDS = "virtual/fakeroot-native sed-native"
>
> -PR = "r1"
> +PR = "r2"
>
>   inherit meta
> +inherit populate_sdk
>
> -SDK_DIR = "${WORKDIR}/sdk"
> -SDK_OUTPUT = "${SDK_DIR}/image"
> -SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
> +TOOLCHAIN_TARGET_TASK = ""
>
> -IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}"
> -
> -TOOLCHAIN_HOST_TASK ?= "\
> +TOOLCHAIN_HOST_TASK = "\
>       nativesdk-python-core \
>       nativesdk-python-textutils \
>       nativesdk-python-sqlite3 \
> @@ -37,62 +34,8 @@ TOOLCHAIN_HOST_TASK ?= "\
>       nativesdk-chrpath \
>       "
>
> -TOOLCHAIN_OUTPUTNAME ?= "python-nativesdk-standalone-${SDKMACHINE}"
> +TOOLCHAIN_OUTPUTNAME = "python-nativesdk-standalone-${SDKMACHINE}"
>
Why are you changing the above two from being overriden to straight 
assignments?  Don't we want these to possibly be overriden with 
additional TASK info or allow the name to change?

This is not explained in the commit message


Sau!

>   RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
>
>   EXCLUDE_FROM_WORLD = "1"
> -
> -do_populate_sdk() {
> -	rm -rf ${SDK_OUTPUT}
> -	mkdir -p ${SDK_OUTPUT}
> -	mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/
> -
> -	rm -f ${IPKGCONF_TARGET}
> -	touch ${IPKGCONF_TARGET}
> -	rm -f ${IPKGCONF_SDK}
> -	touch ${IPKGCONF_SDK}
> -
> -	package_update_index_ipk
> -	package_generate_ipkg_conf
> -
> -	for arch in ${PACKAGE_ARCHS}; do
> -		revipkgarchs="$arch $revipkgarchs"
> -	done
> -
> -	${IPKG_HOST} update
> -	${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK}
> -
> -	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
> -	mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
> -	rm -Rf ${SDK_OUTPUT}/var
> -
> -	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
> -	install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
> -
> -	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
> -
> -	# Link the ld.so.cache file into the hosts filesystem
> -	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
> -
> -	# Add version information
> -	versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
> -	touch $versionfile
> -	echo 'Distro: ${DISTRO}' >> $versionfile
> -	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
> -	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
> -	echo 'Timestamp: ${DATETIME}' >> $versionfile
> -
> -	# Package it up
> -	mkdir -p ${SDK_DEPLOY}
> -	cd ${SDK_OUTPUT}
> -	tar  --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
> -}
> -
> -do_populate_sdk[nostamp] = "1"
> -do_populate_sdk[recrdeptask] = "do_package_write"
> -addtask populate_sdk before do_build after do_install
> -
> -inherit blacklist
> -
> -PNBLACKLIST[external-python-tarball] = "${@base_contains('PACKAGE_CLASSES', 'package_ipk', '', 'This recipe requires \'package_ipk\' support to be enabled in PACKAGE_CLASSES.', d)}"
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-22 16:58   ` Saul Wold
@ 2013-01-23  2:35     ` Kang Kai
  0 siblings, 0 replies; 9+ messages in thread
From: Kang Kai @ 2013-01-23  2:35 UTC (permalink / raw)
  To: Saul Wold; +Cc: Zhenfeng.Zhao, openembedded-core

On 2013年01月23日 00:58, Saul Wold wrote:
> On 01/22/2013 03:30 AM, Kang Kai wrote:
>> external-python-tarball only can be built when inherit package_ipk now.
>> Update it to reuse existed populate sdk code that it could be built for
>> rpm and deb too.
>>
>> [Yocto 3006]
>>
>> Signed-off-by: Kang Kai <kai.kang@windriver.com>
>> ---
>> meta/recipes-core/meta/external-python-tarball.bb | 69 
>> ++-------------------
>> 1 files changed, 6 insertions(+), 63 deletions(-)
>>
>> diff --git a/meta/recipes-core/meta/external-python-tarball.bb 
>> b/meta/recipes-core/meta/external-python-tarball.bb
>> index 2085acc..186bf50 100644
>> --- a/meta/recipes-core/meta/external-python-tarball.bb
>> +++ b/meta/recipes-core/meta/external-python-tarball.bb
>> @@ -3,19 +3,16 @@ LICENSE = "MIT"
>> LIC_FILES_CHKSUM = 
>> "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
>> file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
>>
>> -DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native 
>> sed-native"
>> +DEPENDS = "virtual/fakeroot-native sed-native"
>>
>> -PR = "r1"
>> +PR = "r2"
>>
>> inherit meta
>> +inherit populate_sdk
>>
>> -SDK_DIR = "${WORKDIR}/sdk"
>> -SDK_OUTPUT = "${SDK_DIR}/image"
>> -SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
>> +TOOLCHAIN_TARGET_TASK = ""
>>
>> -IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}"
>> -
>> -TOOLCHAIN_HOST_TASK ?= "\
>> +TOOLCHAIN_HOST_TASK = "\
>> nativesdk-python-core \
>> nativesdk-python-textutils \
>> nativesdk-python-sqlite3 \
>> @@ -37,62 +34,8 @@ TOOLCHAIN_HOST_TASK ?= "\
>> nativesdk-chrpath \
>> "
>>
>> -TOOLCHAIN_OUTPUTNAME ?= "python-nativesdk-standalone-${SDKMACHINE}"
>> +TOOLCHAIN_OUTPUTNAME = "python-nativesdk-standalone-${SDKMACHINE}"
>>
> Why are you changing the above two from being overriden to straight 
> assignments? Don't we want these to possibly be overriden with 
> additional TASK info or allow the name to change?

Hi Saul,

Vars TOOLCHAIN_OUTPUTNAME TOOLCHAIN_HOST_TASK and TOOLCHAIN_TARGET_TASK 
are also defined with ?= in populate_sdk_base.bbclass, so I simply 
thought to override them in external-python-tarball.bb with '='.
Sorry for that, I'll update with inheriting bbclasses at the end of .bb 
file.

Regards,
Kai

>
> This is not explained in the commit message
>
>
> Sau!
>
>> RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
>>
>> EXCLUDE_FROM_WORLD = "1"
>> -
>> -do_populate_sdk() {
>> - rm -rf ${SDK_OUTPUT}
>> - mkdir -p ${SDK_OUTPUT}
>> - mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/
>> -
>> - rm -f ${IPKGCONF_TARGET}
>> - touch ${IPKGCONF_TARGET}
>> - rm -f ${IPKGCONF_SDK}
>> - touch ${IPKGCONF_SDK}
>> -
>> - package_update_index_ipk
>> - package_generate_ipkg_conf
>> -
>> - for arch in ${PACKAGE_ARCHS}; do
>> - revipkgarchs="$arch $revipkgarchs"
>> - done
>> -
>> - ${IPKG_HOST} update
>> - ${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK}
>> -
>> - install -d 
>> ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
>> - mv ${SDK_OUTPUT}/var/lib/opkg/* 
>> ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
>> - rm -Rf ${SDK_OUTPUT}/var
>> -
>> - install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
>> - install -m 0644 ${IPKGCONF_SDK} 
>> ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
>> -
>> - rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
>> -
>> - # Link the ld.so.cache file into the hosts filesystem
>> - ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
>> -
>> - # Add version information
>> - versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
>> - touch $versionfile
>> - echo 'Distro: ${DISTRO}' >> $versionfile
>> - echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
>> - echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
>> - echo 'Timestamp: ${DATETIME}' >> $versionfile
>> -
>> - # Package it up
>> - mkdir -p ${SDK_DEPLOY}
>> - cd ${SDK_OUTPUT}
>> - tar --owner=root --group=root -cj 
>> --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
>> -}
>> -
>> -do_populate_sdk[nostamp] = "1"
>> -do_populate_sdk[recrdeptask] = "do_package_write"
>> -addtask populate_sdk before do_build after do_install
>> -
>> -inherit blacklist
>> -
>> -PNBLACKLIST[external-python-tarball] = 
>> "${@base_contains('PACKAGE_CLASSES', 'package_ipk', '', 'This recipe 
>> requires \'package_ipk\' support to be enabled in PACKAGE_CLASSES.', 
>> d)}"
>>
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] external-python-tarball: code refactoring
  2013-01-23  3:13 [PATCH 0/2] V3: Refactor external-python-tarball.bb Kang Kai
@ 2013-01-23  3:13 ` Kang Kai
  0 siblings, 0 replies; 9+ messages in thread
From: Kang Kai @ 2013-01-23  3:13 UTC (permalink / raw)
  To: sgw; +Cc: Zhenfeng.Zhao, openembedded-core

external-python-tarball only can be built when inherit package_ipk now.
Update it to reuse existed populate sdk code that it could be built for
rpm and deb too.

Remove var DEPENDS, SDK_* and flags of do_populate_sdk because they are
already defined in populate_sdk bbclasses.

[Yocto 3006]

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 meta/recipes-core/meta/external-python-tarball.bb |   67 +-------------------
 1 files changed, 4 insertions(+), 63 deletions(-)

diff --git a/meta/recipes-core/meta/external-python-tarball.bb b/meta/recipes-core/meta/external-python-tarball.bb
index 2085acc..2513cf6 100644
--- a/meta/recipes-core/meta/external-python-tarball.bb
+++ b/meta/recipes-core/meta/external-python-tarball.bb
@@ -3,17 +3,9 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-DEPENDS = "opkg-native opkg-utils-native virtual/fakeroot-native sed-native"
+PR = "r2"
 
-PR = "r1"
-
-inherit meta
-
-SDK_DIR = "${WORKDIR}/sdk"
-SDK_OUTPUT = "${SDK_DIR}/image"
-SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
-
-IPKG_HOST = "opkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}"
+TOOLCHAIN_TARGET_TASK ?= ""
 
 TOOLCHAIN_HOST_TASK ?= "\
     nativesdk-python-core \
@@ -43,56 +35,5 @@ RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
 
 EXCLUDE_FROM_WORLD = "1"
 
-do_populate_sdk() {
-	rm -rf ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}${localstatedir}/lib/opkg/
-
-	rm -f ${IPKGCONF_TARGET}
-	touch ${IPKGCONF_TARGET}
-	rm -f ${IPKGCONF_SDK}
-	touch ${IPKGCONF_SDK}
-
-	package_update_index_ipk
-	package_generate_ipkg_conf
-
-	for arch in ${PACKAGE_ARCHS}; do
-		revipkgarchs="$arch $revipkgarchs"
-	done
-
-	${IPKG_HOST} update
-	${IPKG_HOST} install ${TOOLCHAIN_HOST_TASK}
-
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
-	mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
-	rm -Rf ${SDK_OUTPUT}/var
-
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
-	install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
-
-	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
-
-	# Link the ld.so.cache file into the hosts filesystem
-	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
-
-	# Add version information
-	versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
-	touch $versionfile
-	echo 'Distro: ${DISTRO}' >> $versionfile
-	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
-	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
-	echo 'Timestamp: ${DATETIME}' >> $versionfile
-
-	# Package it up
-	mkdir -p ${SDK_DEPLOY}
-	cd ${SDK_OUTPUT}
-	tar  --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
-}
-
-do_populate_sdk[nostamp] = "1"
-do_populate_sdk[recrdeptask] = "do_package_write"
-addtask populate_sdk before do_build after do_install
-
-inherit blacklist
-
-PNBLACKLIST[external-python-tarball] = "${@base_contains('PACKAGE_CLASSES', 'package_ipk', '', 'This recipe requires \'package_ipk\' support to be enabled in PACKAGE_CLASSES.', d)}"
+inherit meta
+inherit populate_sdk
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-01-23  3:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-22 11:30 [PATCH 0/2] V2: Refactor external-python-tarball Kang Kai
2013-01-22 11:30 ` [PATCH 1/2] createrepo-native: update dependency Kang Kai
2013-01-22 11:30 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
2013-01-22 16:58   ` Saul Wold
2013-01-23  2:35     ` Kang Kai
  -- strict thread matches above, loose matches on Subject: below --
2013-01-23  3:13 [PATCH 0/2] V3: Refactor external-python-tarball.bb Kang Kai
2013-01-23  3:13 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
2013-01-21  7:59 [PATCH 0/2] Refactor external-python-tarball Kang Kai
2013-01-21  7:59 ` [PATCH 2/2] external-python-tarball: code refactoring Kang Kai
2013-01-21 10:25   ` Richard Purdie
2013-01-22  1:52     ` Kang Kai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox