distutils-base.bbclass: Move common functionality to distutils-common-base.bbclass
authorKhem Raj <raj.khem@gmail.com>
Tue, 24 Mar 2009 21:01:30 +0000 (14:01 -0700)
committerKhem Raj <raj.khem@gmail.com>
Tue, 24 Mar 2009 21:01:30 +0000 (14:01 -0700)
Create a new class distutils-common-base.bbclass which holds the common
parts that can be used in native and target packages which need to use
distutils funtionality.

rpm, libxml2, zope are currently using them and needed to use
distutils-native-base for native recipes.

rpm and libxml need to defer the processing of certain configure
parameters which we evaluate using python. So we need to have python-native
built before we can process them. Hence we can not use EXTRA_OECONF
which is a python variable and gets expanded during parsing recipes
and ofcourse we have not yet built python-native.

We pass these extra options as a separate shell variable to do_configure
which we evaluate when that task is executing.

classes/distutils-base.bbclass
classes/distutils-common-base.bbclass [new file with mode: 0644]
classes/distutils-native-base.bbclass [new file with mode: 0644]
recipes/libxml/libxml2-native.inc
recipes/rpm/rpm-4.4.2.3.inc [new file with mode: 0644]
recipes/rpm/rpm-native_4.4.2.3.bb
recipes/rpm/rpm_4.4.2.3.bb
recipes/zope/zope-3.3.1.inc [new file with mode: 0644]
recipes/zope/zope-native_3.3.1.bb
recipes/zope/zope_3.3.1.bb

index a08414a..2e151de 100644 (file)
@@ -1,29 +1,5 @@
-EXTRA_OEMAKE = ""
 DEPENDS  += "${@["python-native python", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}"
 RDEPENDS += "python-core"
 
-export STAGING_INCDIR
-export STAGING_LIBDIR
+inherit distutils-common-base
 
-def python_dir(d):
-       import os, bb
-       staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 )
-       for majmin in "2.6 2.5 2.4 2.3".split():
-               if os.path.exists( "%s/python%s" % ( staging_incdir, majmin ) ): return "python%s" % majmin
-       raise "No Python in STAGING_INCDIR. Forgot to build python-native ?"
-
-PYTHON_DIR = "${@python_dir(d)}"
-
-PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-doc ${PN}"
-
-FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
-
-FILES_${PN}-dev += "\
-  ${libdir}/pkgconfig \
-  ${libdir}/${PYTHON_DIR}/site-packages/*.la \
-"
-FILES_${PN}-dbg = "\
-  ${libdir}/${PYTHON_DIR}/site-packages/.debug \
-  ${libdir}/${PYTHON_DIR}/site-packages/*/.debug \
-  ${libdir}/${PYTHON_DIR}/site-packages/*/*/.debug \
-"
diff --git a/classes/distutils-common-base.bbclass b/classes/distutils-common-base.bbclass
new file mode 100644 (file)
index 0000000..068eac4
--- /dev/null
@@ -0,0 +1,27 @@
+EXTRA_OEMAKE = ""
+
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+def python_dir(d):
+       import os, bb
+       staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 )
+       for majmin in "2.6 2.5 2.4 2.3".split():
+               if os.path.exists( "%s/python%s" % ( staging_incdir, majmin ) ): return "python%s" % majmin
+       raise "No Python in STAGING_INCDIR. Forgot to build python-native ?"
+
+PYTHON_DIR = "${@python_dir(d)}"
+
+PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-doc ${PN}"
+
+FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
+
+FILES_${PN}-dev += "\
+  ${libdir}/pkgconfig \
+  ${libdir}/${PYTHON_DIR}/site-packages/*.la \
+"
+FILES_${PN}-dbg = "\
+  ${libdir}/${PYTHON_DIR}/site-packages/.debug \
+  ${libdir}/${PYTHON_DIR}/site-packages/*/.debug \
+  ${libdir}/${PYTHON_DIR}/site-packages/*/*/.debug \
+"
diff --git a/classes/distutils-native-base.bbclass b/classes/distutils-native-base.bbclass
new file mode 100644 (file)
index 0000000..2703fe0
--- /dev/null
@@ -0,0 +1,3 @@
+DEPENDS  += "${@["python-native", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}"
+
+inherit distutils-common-base
index c8182de..3f67152 100644 (file)
@@ -5,10 +5,10 @@ FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/libxml2-${PV}"
 SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz"
 S = "${WORKDIR}/libxml2-${PV}"
 
-inherit distutils-base autotools native pkgconfig
+inherit autotools native pkgconfig distutils-native-base
 
 do_configure_prepend () {
-       EXTRA_OECONF = "\
+       EXTRA_LIBXML2_OECONF="\
        --with-python=${PYTHON_DIR} \
        --without-debug \
        --without-legacy \
@@ -18,6 +18,10 @@ do_configure_prepend () {
        "
 }
 
+do_configure (){
+       autotools_do_configure ${EXTRA_LIBXML2_OECONF}
+}
+
 do_stage () {
        oe_runmake install
 }
diff --git a/recipes/rpm/rpm-4.4.2.3.inc b/recipes/rpm/rpm-4.4.2.3.inc
new file mode 100644 (file)
index 0000000..eef308f
--- /dev/null
@@ -0,0 +1,96 @@
+DESCRIPTION = "The RPM Package Manager."
+HOMEPAGE = "http://rpm.org/"
+LICENSE = "LGPL GPL"
+PR = "r15"
+
+SRC_URI = "http://www.rpm.org/releases/rpm-4.4.x/rpm-4.4.2.3.tar.gz \
+           file://external-tools.patch;patch=1 \
+          file://cross_libpaths.patch;patch=1 \
+          file://rpmconfigdir.patch;patch=1 \
+          file://weakdeps.patch;patch=1;pnum=0 \
+          file://tagsbackport.patch;patch=1;pnum=0 \
+          file://missingok.patch;patch=1;pnum=0 \
+          file://extcond.patch;patch=1;pnum=0"
+
+inherit autotools
+
+S = "${WORKDIR}/rpm-${PV}"
+
+ARM_INSTRUCTION_SET = "arm"
+
+acpaths = "-I ${S}/db/dist/aclocal -I ${S}/db/dist/aclocal_java"
+
+PACKAGES += "python-rpm"
+FILES_python-rpm = "${libdir}/python*/site-packages/rpm/_*"
+
+# Handle the db MUTEX settings here, the POSIX library is
+# the default - "POSIX/pthreads/library".
+# Don't ignore the nice SWP instruction on the ARM:
+# These enable the ARM assembler mutex code, this won't
+# work with thumb compilation...
+ARM_MUTEX = "--with-mutex=ARM/gcc-assembly"
+MUTEX = ""
+MUTEX_arm = "${ARM_MUTEX}"
+MUTEX_armeb = "${ARM_MUTEX}"
+EXTRA_OECONF += "${MUTEX}"
+
+export varprefix = "${localstatedir}"
+
+do_configure_prepend (){
+       EXTRA_RPM_OECONF="--with-python \
+       --with-python-incdir=${STAGING_INCDIR}/${PYTHON_DIR} \
+       --with-python-libdir=${libdir}/${PYTHON_DIR} \
+       --without-apidocs \
+       --without-selinux \
+       --without-lua \
+       --without-dmalloc \
+       --without-efence"
+}
+
+do_configure () {
+       rm ${S}/popt/ -Rf
+       rm ${S}/db/dist/configure.in -f
+       cd ${S}/db/dist/aclocal
+       rm libtool* -f
+       for i in `ls *.ac`; do
+           j=`echo $i | sed 's/.ac/.m4/g'`
+           mv $i $j
+       done
+       cd ${S}/db/dist/aclocal_java
+       for i in `ls *.ac`; do
+           j=`echo $i | sed 's/.ac/.m4/g'`
+           mv $i $j
+       done
+       cd ${S}
+       autotools_do_configure ${EXTRA_RPM_OECONF}
+       cd ${S}/db/dist
+       . ./RELEASE
+       # Edit version information we couldn't pre-compute.
+       sed -i -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g"  configure
+       sed -i -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g"  configure
+       sed -i -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g"  configure
+       sed -i -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g"  configure
+       sed -i -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g"  configure
+       sed -i -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g"  configure
+       cd ${S}/db3
+       ${S}/db3/configure \
+                   --build=${BUILD_SYS} \
+                   --host=${HOST_SYS} \
+                   --target=${TARGET_SYS} \
+                   --prefix=${prefix} \
+                   --exec_prefix=${exec_prefix} \
+                   --bindir=${bindir} \
+                   --sbindir=${sbindir} \
+                   --libexecdir=${libexecdir} \
+                   --datadir=${datadir} \
+                   --sysconfdir=${sysconfdir} \
+                   --sharedstatedir=${sharedstatedir} \
+                   --localstatedir=${localstatedir} \
+                   --libdir=${libdir} \
+                   --includedir=${includedir} \
+                   --oldincludedir=${oldincludedir} \
+                   --infodir=${infodir} \
+                   --mandir=${mandir} \
+                   ${EXTRA_RPM_OECONF} \
+                   --with-pic
+}
index 935d077..287383c 100644 (file)
@@ -1,5 +1,6 @@
-require rpm_${PV}.bb
-inherit native
+inherit native distutils-native-base
+
+require rpm-${PV}.inc
 
 DEPENDS = "beecrypt-native gettext-native zlib-native file-native popt-native python-native"
 
index 6bdd0ed..3e67378 100644 (file)
@@ -1,98 +1,4 @@
-DESCRIPTION = "The RPM Package Manager."
-HOMEPAGE = "http://rpm.org/"
-LICENSE = "LGPL GPL"
-DEPENDS = "zlib beecrypt file popt python sed-native"
-PR = "r14"
-
-SRC_URI = "http://www.rpm.org/releases/rpm-4.4.x/rpm-4.4.2.3.tar.gz \
-           file://external-tools.patch;patch=1 \
-          file://cross_libpaths.patch;patch=1 \
-          file://rpmconfigdir.patch;patch=1 \
-          file://weakdeps.patch;patch=1;pnum=0 \
-          file://tagsbackport.patch;patch=1;pnum=0 \
-          file://missingok.patch;patch=1;pnum=0 \
-          file://extcond.patch;patch=1;pnum=0"
-
-inherit autotools gettext distutils-base
-
-S = "${WORKDIR}/rpm-${PV}"
-
-ARM_INSTRUCTION_SET = "arm"
-
-acpaths = "-I ${S}/db/dist/aclocal -I ${S}/db/dist/aclocal_java"
+inherit distutils-base gettext
 
-PACKAGES += "python-rpm"
-FILES_python-rpm = "${libdir}/python*/site-packages/rpm/_*"
-
-# Handle the db MUTEX settings here, the POSIX library is
-# the default - "POSIX/pthreads/library".
-# Don't ignore the nice SWP instruction on the ARM:
-# These enable the ARM assembler mutex code, this won't
-# work with thumb compilation...
-ARM_MUTEX = "--with-mutex=ARM/gcc-assembly"
-MUTEX = ""
-MUTEX_arm = "${ARM_MUTEX}"
-MUTEX_armeb = "${ARM_MUTEX}"
-EXTRA_OECONF += "${MUTEX}"
-
-export varprefix = "${localstatedir}"
-
-do_configure_prepend (){
-       EXTRA_OECONF = "--with-python \
-               --with-python-incdir=${STAGING_INCDIR}/${PYTHON_DIR} \
-               --with-python-libdir=${libdir}/${PYTHON_DIR} \
-               --without-apidocs \
-               --without-selinux \
-               --without-lua \
-               --without-dmalloc \
-               --without-efence"
-}
-
-do_configure () {
-       rm ${S}/popt/ -Rf
-       rm ${S}/db/dist/configure.in -f
-       cd ${S}/db/dist/aclocal
-       rm libtool* -f
-       for i in `ls *.ac`; do
-           j=`echo $i | sed 's/.ac/.m4/g'`
-           mv $i $j
-       done
-       cd ${S}/db/dist/aclocal_java
-       for i in `ls *.ac`; do
-           j=`echo $i | sed 's/.ac/.m4/g'`
-           mv $i $j
-       done
-       cd ${S}
-       autotools_do_configure
-       cd ${S}/db/dist
-       . ./RELEASE
-       # Edit version information we couldn't pre-compute.
-       sed -i -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g"  configure
-       sed -i -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g"  configure
-       sed -i -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g"  configure
-       sed -i -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g"  configure
-       sed -i -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g"  configure
-       sed -i -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g"  configure
-       cd ${S}/db3
-       ${S}/db3/configure \
-                   --build=${BUILD_SYS} \
-                   --host=${HOST_SYS} \
-                   --target=${TARGET_SYS} \
-                   --prefix=${prefix} \
-                   --exec_prefix=${exec_prefix} \
-                   --bindir=${bindir} \
-                   --sbindir=${sbindir} \
-                   --libexecdir=${libexecdir} \
-                   --datadir=${datadir} \
-                   --sysconfdir=${sysconfdir} \
-                   --sharedstatedir=${sharedstatedir} \
-                   --localstatedir=${localstatedir} \
-                   --libdir=${libdir} \
-                   --includedir=${includedir} \
-                   --oldincludedir=${oldincludedir} \
-                   --infodir=${infodir} \
-                   --mandir=${mandir} \
-                   ${EXTRA_OECONF} \
-                   --with-pic
-
-}
+DEPENDS = "zlib beecrypt file popt python sed-native"
+require ${PN}-${PV}.inc
diff --git a/recipes/zope/zope-3.3.1.inc b/recipes/zope/zope-3.3.1.inc
new file mode 100644 (file)
index 0000000..b06174c
--- /dev/null
@@ -0,0 +1,45 @@
+DESCRIPTION = "A full fledged pluggable content management system with integrated web server and much more."
+SECTION = "console/network"
+PRIORITY = "optional"
+LICENSE = "ZPL"
+PR = "r9"
+
+SRC_URI = "http://www.zope.org/Products/Zope3/${PV}/Zope-${PV}.tgz"
+S = "${WORKDIR}/Zope-${PV}"
+
+do_configure() {
+       ./configure --with-python=${STAGING_BINDIR_NATIVE}/python --prefix=${prefix} --force
+}
+
+do_compile() {
+       oe_runmake HOST_SYS=${HOST_SYS} BUILD_SYS=${BUILD_SYS} STAGING_INCDIR=${STAGING_INCDIR}
+}
+
+do_install() {
+       install -d ${D}${libdir}/${PYTHON_DIR}
+       oe_runmake install prefix=${D}${prefix} HOST_SYS=${HOST_SYS} BUILD_SYS=${BUILD_SYS}
+       mv ${D}${libdir}/python/* ${D}${libdir}/${PYTHON_DIR} 
+       rm -rf ${D}${libdir}/${PYTHON_DIR}/twisted
+       rm -rf ${D}${libdir}/${PYTHON_DIR}/zope/app/twisted
+}
+
+PACKAGES =+ "python-zopeinterface python-zopeinterface-dbg"
+
+FILES_${PN} = "${prefix}"
+FILES_${PN}_doc = "${prefix}/doc"
+FILES_${PN}-dbg += "\
+${libdir}/${PYTHON_DIR}/BTrees/.debug \
+${libdir}/${PYTHON_DIR}/persistent/.debug \
+${libdir}/${PYTHON_DIR}/zope/proxy/.debug \
+${libdir}/${PYTHON_DIR}/zope/thread/.debug \
+${libdir}/${PYTHON_DIR}/zope/security/.debug \
+${libdir}/${PYTHON_DIR}/zope/hookable/.debug \
+${libdir}/${PYTHON_DIR}/zope/app/container/.debug \
+${libdir}/${PYTHON_DIR}/zope/i18nmessageid/.debug \
+${libdir}/${PYTHON_DIR}/ZODB/.debug"
+FILES_python-zopeinterface-dbg += "${libdir}/${PYTHON_DIR}/zope/interface/.debug "
+
+FILES_python-zopeinterface = " ${libdir}/${PYTHON_DIR}/zope/__init__.py* \
+       ${libdir}/${PYTHON_DIR}/zope/interface/*.* \
+       ${libdir}/${PYTHON_DIR}/zope/interface/common"
+
index 970df6d..70d19e9 100644 (file)
@@ -1,9 +1,6 @@
-require zope_${PV}.bb
-inherit native
+inherit native distutils-native-base
 
-DEPENDS = "python-native"
-
-inherit distutils-base
+require zope-${PV}.inc
 
 export BUILD_SYS
 export HOST_SYS
index 05df3dd..cf81b15 100644 (file)
@@ -1,49 +1,5 @@
-DESCRIPTION = "A full fledged pluggable content management system with integrated web server and much more."
-SECTION = "console/network"
-PRIORITY = "optional"
-DEPENDS = "python"
-RDEPENDS = "python-core python-shell"
-LICENSE = "ZPL"
-PR = "r8"
-
-SRC_URI = "http://www.zope.org/Products/Zope3/${PV}/Zope-${PV}.tgz"
-S = "${WORKDIR}/Zope-${PV}"
+RDEPENDS = "python-shell"
 
 inherit distutils-base
 
-do_configure() {
-       ./configure --with-python=${STAGING_BINDIR_NATIVE}/python --prefix=${prefix} --force
-}
-
-do_compile() {
-       oe_runmake HOST_SYS=${HOST_SYS} BUILD_SYS=${BUILD_SYS} STAGING_INCDIR=${STAGING_INCDIR}
-}
-
-do_install() {
-       install -d ${D}${libdir}/${PYTHON_DIR}
-       oe_runmake install prefix=${D}${prefix} HOST_SYS=${HOST_SYS} BUILD_SYS=${BUILD_SYS}
-       mv ${D}${libdir}/python/* ${D}${libdir}/${PYTHON_DIR} 
-       rm -rf ${D}${libdir}/${PYTHON_DIR}/twisted
-       rm -rf ${D}${libdir}/${PYTHON_DIR}/zope/app/twisted
-}
-
-PACKAGES =+ "python-zopeinterface python-zopeinterface-dbg"
-
-FILES_${PN} = "${prefix}"
-FILES_${PN}_doc = "${prefix}/doc"
-FILES_${PN}-dbg += "\
-${libdir}/${PYTHON_DIR}/BTrees/.debug \
-${libdir}/${PYTHON_DIR}/persistent/.debug \
-${libdir}/${PYTHON_DIR}/zope/proxy/.debug \
-${libdir}/${PYTHON_DIR}/zope/thread/.debug \
-${libdir}/${PYTHON_DIR}/zope/security/.debug \
-${libdir}/${PYTHON_DIR}/zope/hookable/.debug \
-${libdir}/${PYTHON_DIR}/zope/app/container/.debug \
-${libdir}/${PYTHON_DIR}/zope/i18nmessageid/.debug \
-${libdir}/${PYTHON_DIR}/ZODB/.debug"
-FILES_python-zopeinterface-dbg += "${libdir}/${PYTHON_DIR}/zope/interface/.debug "
-
-FILES_python-zopeinterface = " ${libdir}/${PYTHON_DIR}/zope/__init__.py* \
-       ${libdir}/${PYTHON_DIR}/zope/interface/*.* \
-       ${libdir}/${PYTHON_DIR}/zope/interface/common"
-
+require ${PN}-${PV}.inc