Patchwork [1/1] glib-2.0-native: do_compile failed on opensuse 12.2 64bit

login
register
mail settings
Submitter Robert Yang
Date April 26, 2013, 11:41 a.m.
Message ID <4aa663aaedff33870a96a676b9394ff79fe49eac.1366963971.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/48941/
State New
Headers show

Comments

Robert Yang - April 26, 2013, 11:41 a.m.
The error message:
  File "/path/to/glib-2.34.3/gio/gdbus-2.0/codegen/parser.py", line 25, in <module>
    import xml.parsers.expat

ImportError: No module named xml.parsers.expat
make[2]: *** [gdbus-daemon-generated.h] Error 1

This is because opensuse 12.2 doesn't install the expat.py (one of
python's lib) by default, but our native python provides it, use the
native python would fix the problem.

[YOCTO #4424]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb |    2 +-
 meta/recipes-core/glib-2.0/glib.inc           |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Ross Burton - April 26, 2013, 12:08 p.m.
Hi,

On 26 April 2013 12:41, Robert Yang <liezhi.yang@windriver.com> wrote:
> The error message:
>   File "/path/to/glib-2.34.3/gio/gdbus-2.0/codegen/parser.py", line 25, in <module>
>     import xml.parsers.expat
>
> ImportError: No module named xml.parsers.expat
> make[2]: *** [gdbus-daemon-generated.h] Error 1
>
> This is because opensuse 12.2 doesn't install the expat.py (one of
> python's lib) by default, but our native python provides it, use the
> native python would fix the problem.

I don't like this.

xml.parsers.expat is a standard Python library that's been integrated since 2.0:

http://docs.python.org/2/library/pyexpat.html#module-xml.parsers.expat

If we can't assume that a distribution has shipped a working Python
we've got bigger problems.

We could sanity check this in some way, maybe in the recipe's
configure step so we can give a nicer message, but I don't think we
should depend on pythonnative when we're talking about a standard
feature of Python.

Ross
Robert Yang - April 27, 2013, 1:57 a.m.
On 04/26/2013 08:08 PM, Burton, Ross wrote:
> Hi,
>
> On 26 April 2013 12:41, Robert Yang <liezhi.yang@windriver.com> wrote:
>> The error message:
>>    File "/path/to/glib-2.34.3/gio/gdbus-2.0/codegen/parser.py", line 25, in <module>
>>      import xml.parsers.expat
>>
>> ImportError: No module named xml.parsers.expat
>> make[2]: *** [gdbus-daemon-generated.h] Error 1
>>
>> This is because opensuse 12.2 doesn't install the expat.py (one of
>> python's lib) by default, but our native python provides it, use the
>> native python would fix the problem.
>
> I don't like this.
>
> xml.parsers.expat is a standard Python library that's been integrated since 2.0:
>
> http://docs.python.org/2/library/pyexpat.html#module-xml.parsers.expat
>
> If we can't assume that a distribution has shipped a working Python
> we've got bigger problems.
>
> We could sanity check this in some way, maybe in the recipe's
> configure step so we can give a nicer message, but I don't think we
> should depend on pythonnative when we're talking about a standard
> feature of Python.
>

Hi Ross,

Thanks for the review, please see more comments:
The glib-2.0-native had already depend on python-native before this patch,
the depends chain is:

glib-2.0-native -> python-argparse-native -> python-native

I inherit the glib-2.0-native is for using the ${PYTHON} variable, it doesn't
change its depends, since we had built python-native already, and it works,
it seems more reasonable to use it rather than show error message and let the
user install other pkgs on the host, I think that this is what our native
recipe for.

// Robert


> Ross
>
>
Ross Burton - May 13, 2013, 3:18 p.m.
On 27 April 2013 02:57, Robert Yang <liezhi.yang@windriver.com> wrote:
> Thanks for the review, please see more comments:
> The glib-2.0-native had already depend on python-native before this patch,
> the depends chain is:
>
> glib-2.0-native -> python-argparse-native -> python-native

That argparse usage was dropped from upstream in 2.30, so we can drop
the dependency.

I still think that we shouldn't have to build a whole python because a
distribution decided to not install fundamental parts of Python out of
the box (python-xml).

Ross
Otavio Salvador - May 13, 2013, 3:23 p.m.
On Mon, May 13, 2013 at 12:18 PM, Burton, Ross <ross.burton@intel.com> wrote:
> On 27 April 2013 02:57, Robert Yang <liezhi.yang@windriver.com> wrote:
>> Thanks for the review, please see more comments:
>> The glib-2.0-native had already depend on python-native before this patch,
>> the depends chain is:
>>
>> glib-2.0-native -> python-argparse-native -> python-native
>
> That argparse usage was dropped from upstream in 2.30, so we can drop
> the dependency.
>
> I still think that we shouldn't have to build a whole python because a
> distribution decided to not install fundamental parts of Python out of
> the box (python-xml).

We may need to have a mechanism to specific build dependencies for
native depending on host version/distribution.

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Ross Burton - May 13, 2013, 3:28 p.m.
On 13 May 2013 16:23, Otavio Salvador <otavio@ossystems.com.br> wrote:
> We may need to have a mechanism to specific build dependencies for
> native depending on host version/distribution.

The situation is that Suse splits the expat parser into a separate
package for some reason, so the "fix" is to actually install the whole
Python core library by installing python-xml if it isn't already
pulled in.  We could add a sanity test that the python available is a
full python and not missing the expat parser (suse without python-xml)
or isn't python-minimal (ubuntu).

Ross
Otavio Salvador - May 13, 2013, 3:36 p.m.
On Mon, May 13, 2013 at 12:28 PM, Burton, Ross <ross.burton@intel.com> wrote:
> On 13 May 2013 16:23, Otavio Salvador <otavio@ossystems.com.br> wrote:
>> We may need to have a mechanism to specific build dependencies for
>> native depending on host version/distribution.
>
> The situation is that Suse splits the expat parser into a separate
> package for some reason, so the "fix" is to actually install the whole
> Python core library by installing python-xml if it isn't already
> pulled in.  We could add a sanity test that the python available is a
> full python and not missing the expat parser (suse without python-xml)
> or isn't python-minimal (ubuntu).

Yes; this might be a solution.

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Robert Yang - May 14, 2013, 1:47 a.m.
OK, got it, I will file a new patch sooner.

// Robert

On 05/13/2013 11:28 PM, Burton, Ross wrote:
> On 13 May 2013 16:23, Otavio Salvador <otavio@ossystems.com.br> wrote:
>> We may need to have a mechanism to specific build dependencies for
>> native depending on host version/distribution.
>
> The situation is that Suse splits the expat parser into a separate
> package for some reason, so the "fix" is to actually install the whole
> Python core library by installing python-xml if it isn't already
> pulled in.  We could add a sanity test that the python available is a
> full python and not missing the expat parser (suse without python-xml)
> or isn't python-minimal (ubuntu).
>
> Ross
>
>

Patch

diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
index 7795524..50f8968 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
@@ -45,7 +45,7 @@  RDEPENDS_${PN}-ptest_append_libc-glibc = "\
            "
 
 do_configure_prepend() {
-	sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
+	sed -i -e '1s,#!.*,#!${PYTHON},' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
 }
 
 do_install_append() {
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 42c34c3..0b09131 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -21,7 +21,7 @@  PACKAGES =+ "${PN}-utils ${PN}-bash-completion ${PN}-codegen"
 LEAD_SONAME = "libglib-2.0.*"
 FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext"
 
-inherit autotools gettext gtk-doc pkgconfig ptest
+inherit autotools gettext gtk-doc pkgconfig ptest pythonnative
 
 S = "${WORKDIR}/glib-${PV}"