Skip to contentSkip to conversation

rrdtool: enable perl and python bindings

PATCH Superseded Chong Lu 3 participants 4 messages Apr 25, 2014

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Chong Lu

author
#0 lore raw

PATCH v5 1/1 rrdtool: enable perl and python bindings

1. default enable perl and python bindings
2. rrdtool uses perl.real, perl.real doesn't know where the PERL5LIB should be when prebuilts are used. Use the wrapper perl instead, perl sets PERL5LIB and invokes perl.real
3. While using dash as /bin/sh, subsequent commands in functions will not use the environment variables passed to the function call line unless explicitly run "export ENV_VAR".
4. delete unrecognized options: "--enable-local-libpng" and "--enable-local-zlib"

---
 meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb |  129 ++++++++++++++++++++-
 1 file changed, 123 insertions(+), 6 deletions(-)
meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb +123 -6
index 533451f..36785cd 100644
@@ -15,25 +15,142 @@ SRC_URI = "http://oss.oetiker.ch/rrdtool/pub/rrdtool-${PV}.tar.gz \
 SRC_URI[md5sum] = "ffe369d8921b4dfdeaaf43812100c38f"
 SRC_URI[sha256sum] = "956aaf431c955ba88dd7d98920ade3a8c4bad04adb1f9431377950a813a7af11"
 
-inherit autotools gettext
+inherit autotools gettext pythonnative perlnative python-dir
 
 EXTRA_AUTORECONF = "-I m4"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "python perl"
+
+PACKAGES_DYNAMIC += "^${PN}-perl ^${PN}-python"
+
+PACKAGECONFIG[python] = "--enable-python=yes \
+am_cv_python_pythondir=${STAGING_LIBDIR}/python${PYTHON_BASEVERSION}/site-packages \
+am_cv_python_pyexecdir=${STAGING_LIBDIR}/python${PYTHON_BASEVERSION}/site-packages,\
+--disable-python,python,"
+
+PACKAGECONFIG[perl] = \
+"--enable-perl=yes --with-perl-options='INSTALLDIRS="vendor"' \
+ac_cv_path_PERL_CC='${CC}',  \
+--disable-perl,perl,"
+
 PACKAGECONFIG[dbi] = "--enable-libdbi,--disable-libdbi,libdbi"
 
 EXTRA_OECONF = " \
     --enable-shared \
-    --enable-local-libpng \
-    --enable-local-zlib \
     --disable-libwrap \
     --program-prefix='' \
     rd_cv_ieee_works=yes \
-    --disable-perl \
-    --disable-python \
     --disable-ruby \
     --disable-lua \
     --disable-rpath \
 "
 
+# don't use perl.real, this results in break issues with prebuilts since perl.real doesn't
+# know where the PERL5LIB is...
+# use wrapper perl instead
+EXTRA_OEMAKE = "PERL=${STAGING_BINDIR_NATIVE}/perl-native/perl FULLPERL=${STAGING_BINDIR_NATIVE}/perl-native/perl"
+
+export BUILD_SYS
+export HOST_SYS
+export STAGING_LIBDIR
+export STAGING_INCDIR
+
+do_configure() {
+	#fix the pkglib problem with newer automake
+	#perl
+	sed -i -e "s|-Wl,--rpath -Wl,\$rp||g" \
+	    ${S}/bindings/perl-shared/Makefile.PL
+
+	#python
+	sed -i -e '/PYTHON_INCLUDES="-I${/c \
+	PYTHON_INCLUDES="-I=/usr/include/python${PYTHON_BASEVERSION}"' \
+	    ${S}/m4/acinclude.m4
+	#remove the hardcoded $(libdir) rpath
+	sed -i -e 's|--rpath=$(libdir)||g' ${S}/bindings/Makefile.am
+
+	autotools_do_configure
+
+	perl_version=`perl -v 2>/dev/null | \
+	    sed -n 's/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p'`
+
+	#modify python sitepkg
+	#remove the dependency of perl-shared:Makefile
+	#or perl-shared/Makefile will be regenerated
+	#if any code touch bindings/Makefile after below perl bindings code
+	sed -i -e "s:\$(PYTHON) setup.py install:\$(PYTHON) setup.py install \
+	    --install-lib=${D}${PYTHON_SITEPACKAGES_DIR}:" \
+	    -e "s:perl-shared/Makefile.PL Makefile:perl-shared/Makefile.PL:" \
+	    ${S}/bindings/Makefile
+
+	#redo the perl bindings
+	(
+	cd bindings/perl-shared;
+	perl -I${STAGING_LIBDIR}/perl/$perl_version Makefile.PL INSTALLDIRS="vendor"
+	    INSTALLPRIVLIB="abc";
+	sed -i -e "s| ${libdir}/perl/| ${STAGING_LIBDIR}/perl/|g" Makefile;
+
+	cd ../../bindings/perl-piped;
+	perl -I${STAGING_LIBDIR}/perl/$perl_version Makefile.PL INSTALLDIRS="vendor";
+	sed -i -e "s| ${libdir}/perl/| ${STAGING_LIBDIR}/perl/|g" Makefile;
+	)
+
+	#change the interpreter in file
+	sed -i -e "s|^PERL = ${STAGING_BINDIR_NATIVE}/.*|PERL = /usr/bin/perl|g" \
+	    ${S}/examples/Makefile
+	sed -i -e "s|${STAGING_BINDIR_NATIVE}/perl-native/perl|/usr/bin/perl|g" \
+	    ${S}/examples/*.pl
+}
+
+python populate_packages_prepend() {
+    def fill_more(name, rdep=None):
+        if name is None or name.strip() == "":
+            return
+
+        fpack=d.getVar('PACKAGES') or ""
+        fpack="${PN}-" + name + " " + fpack
+        d.setVar('PACKAGES', fpack)
+        if rdep is not None:
+            prdep=d.getVar('RDEPENDS_${PN}-' + name) or ""
+            prdep=rdep + " " + prdep
+            d.setVar('RDEPENDS_${PN}-' + name, prdep)
+
+            prdep=d.getVar('RDEPENDS_${PN}-' + name) or ""
+            bb.debug(1, "RDEPENDS_${PN}-" + name + "=" + prdep)
+
+    conf=(d.getVar('PACKAGECONFIG', True) or "").split()
+    pack=d.getVar('PACKAGES') or ""
+    bb.debug(1, "PACKAGECONFIG=%s" % conf)
+    bb.debug(1, "PACKAGES1=%s" % pack )
+
+    if "perl" in conf :
+        fill_more("perl")
+
+    if "python" in conf:
+        fill_more("python")
+
+    pack=d.getVar('PACKAGES', True) or ""
+    bb.debug(1, "PACKAGES after=%s" % pack)
+
+    #debug code
+    #prdep=d.getVar('RDEPENDS_${PN}') or ""
+    #bb.debug(1, "RDEPENDS_${PN}" + "=" + prdep)
+    #prdep=d.getVar('RDEPENDS') or ""
+    #bb.debug(1, "RDEPENDS" + "=" + prdep)
+}
+
+FILES_${PN}-doc += "${datadir}/examples"
+
+DESCRIPTION_${PN}-perl = \
+"The ${PN}-perl package includes RRDtool bindings for perl."
+FILES_${PN}-perl = "${libdir}/perl/vendor_perl/*/*.pm ${datadir}/${PN}/examples \
+    ${libdir}/perl/vendor_perl/*/auto/RRDs/RRDs.*"
+RDEPENDS_${PN}-perl = "perl perl-module-lib perl-module-getopt-long perl-module-time-hires \
+    perl-module-io-file perl-module-ipc-open2 perl-module-io-socket"
+
+DESCRIPTION_${PN}-python = \
+"The ${PN}-python package includes RRDtool bindings for python."
+FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*"
+RDEPENDS_${PN}-python = "python"
 
+FILES_${PN}-dbg += "${libdir}/perl/vendor_perl/*/auto/RRDs/.debug \
+    ${libdir}/python${PYTHON_BASEVERSION}/site-packages/.debug"
Signature · 1 line
1.7.9.5
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chong Lu schreef op 25-04-14 04:22:

Quoted 26 lines

1. default enable perl and python bindings 2. rrdtool uses perl.real, perl.real doesn't know where the PERL5LIB should be when prebuilts are used. Use the wrapper perl instead, perl sets PERL5LIB and invokes perl.real 3. While using dash as /bin/sh, subsequent commands in functions will not use the environment variables passed to the function call line unless explicitly run "export ENV_VAR". 4. delete unrecognized
options: "--enable-local-libpng" and "--enable-local-zlib"

meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb | 129 ++++++++++++++++++++- 1 file changed, 123 insertions(+), 6 deletions(-)

(quoted diff) +0 -0

b/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb index 533451f..36785cd 100644 --- a/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb +++ b/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb @@ -15,25 +15,142 @@ SRC_URI = "http://oss.oetiker.ch/rrdtool/pub/rrdtool-${PV}.tar.gz \
SRC_URI[md5sum] = "ffe369d8921b4dfdeaaf43812100c38f" SRC_URI[sha256sum] = "956aaf431c955ba88dd7d98920ade3a8c4bad04adb1f9431377950a813a7af11"

-inherit autotools gettext +inherit autotools gettext pythonnative perlnative python-dir

EXTRA_AUTORECONF = "-I m4"

Review

Quoted 2 lines
(quoted diff) +1 -1
-PACKAGECONFIG ??= "" +PACKAGECONFIG ??= "python perl" + 
+PACKAGES_DYNAMIC += "^${PN}-perl ^${PN}-python"

No, just no. Martin said 'Add it to PACKAGES'.

Quoted 10 lines

+python populate_packages_prepend() { + def fill_more(name,
rdep=None): + if name is None or name.strip() == "": +
return + + fpack=d.getVar('PACKAGES') or "" +
fpack="${PN}-" + name + " " + fpack + d.setVar('PACKAGES', fpack)
+ if rdep is not None: +
prdep=d.getVar('RDEPENDS_${PN}-' + name) or "" + prdep=rdep +
" " + prdep + d.setVar('RDEPENDS_${PN}-' + name, prdep) + +
prdep=d.getVar('RDEPENDS_${PN}-' + name) or "" + bb.debug(1,
"RDEPENDS_${PN}-" + name + "=" + prdep) + + conf=(d.getVar('PACKAGECONFIG', True) or "").split() +

Quoted 8 lines

pack=d.getVar('PACKAGES') or "" + bb.debug(1, "PACKAGECONFIG=%s" %
conf) + bb.debug(1, "PACKAGES1=%s" % pack ) + + if "perl" in conf
: + fill_more("perl") + + if "python" in conf: +
fill_more("python") + + pack=d.getVar('PACKAGES', True) or "" +
bb.debug(1, "PACKAGES after=%s" % pack) + + #debug code +
#prdep=d.getVar('RDEPENDS_${PN}') or "" + #bb.debug(1,
"RDEPENDS_${PN}" + "=" + prdep) + #prdep=d.getVar('RDEPENDS') or "" +
#bb.debug(1, "RDEPENDS" + "=" + prdep) +}

What is this?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org

iD8DBQFTWhJvMkyGM64RGpERArXTAJ4u1918rurp4h7aTEX6wW2/J0C+IgCeLLQc ALaeAdoJhjuntnDEx23edT0=
=0QxD
-----END PGP SIGNATURE-----

author
#2 lore raw
Quoted 25 lines · Koen Kooi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chong Lu schreef op 25-04-14 04:22:

Quoted 21 lines

1. default enable perl and python bindings 2. rrdtool uses perl.real, perl.real doesn't know where the PERL5LIB should be when prebuilts are used. Use the wrapper perl instead, perl sets PERL5LIB and invokes perl.real 3. While using dash as /bin/sh, subsequent commands in functions will not use the environment variables passed to the function call line unless explicitly run "export ENV_VAR". 4. delete unrecognized
options: "--enable-local-libpng" and "--enable-local-zlib"

meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb | 129 ++++++++++++++++++++- 1 file changed, 123 insertions(+), 6 deletions(-)

(quoted diff) +0 -0

b/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb index 533451f..36785cd 100644 --- a/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb +++ b/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb @@ -15,25 +15,142 @@ SRC_URI = "http://oss.oetiker.ch/rrdtool/pub/rrdtool-${PV}.tar.gz \
SRC_URI[md5sum] = "ffe369d8921b4dfdeaaf43812100c38f" SRC_URI[sha256sum] = "956aaf431c955ba88dd7d98920ade3a8c4bad04adb1f9431377950a813a7af11"

Quoted 9 lines

Review

Quoted 7 lines

-inherit autotools gettext +inherit autotools gettext pythonnative perlnative python-dir

EXTRA_AUTORECONF = "-I m4"

(quoted diff) +1 -1
-PACKAGECONFIG ??= "" +PACKAGECONFIG ??= "python perl" +
+PACKAGES_DYNAMIC += "^${PN}-perl ^${PN}-python"

No, just no. Martin said 'Add it to PACKAGES'.

If I add it to PACKAGES, I will get following errors:
ERROR: QA Issue: rrdtool-perl is listed in PACKAGES multiple times, this leads to packaging errors.
ERROR: QA Issue: rrdtool-python is listed in PACKAGES multiple times, this leads to packaging errors.

Quoted 27 lines
Quoted 10 lines

+python populate_packages_prepend() { + def fill_more(name,
rdep=None): + if name is None or name.strip() == "": +
return + + fpack=d.getVar('PACKAGES') or "" +
fpack="${PN}-" + name + " " + fpack + d.setVar('PACKAGES', fpack)
+ if rdep is not None: +
prdep=d.getVar('RDEPENDS_${PN}-' + name) or "" + prdep=rdep +
" " + prdep + d.setVar('RDEPENDS_${PN}-' + name, prdep) + +
prdep=d.getVar('RDEPENDS_${PN}-' + name) or "" + bb.debug(1,
"RDEPENDS_${PN}-" + name + "=" + prdep) + + conf=(d.getVar('PACKAGECONFIG', True) or "").split() +

Quoted 8 lines

pack=d.getVar('PACKAGES') or "" + bb.debug(1, "PACKAGECONFIG=%s" %
conf) + bb.debug(1, "PACKAGES1=%s" % pack ) + + if "perl" in conf
: + fill_more("perl") + + if "python" in conf: +
fill_more("python") + + pack=d.getVar('PACKAGES', True) or "" +
bb.debug(1, "PACKAGES after=%s" % pack) + + #debug code +
#prdep=d.getVar('RDEPENDS_${PN}') or "" + #bb.debug(1,
"RDEPENDS_${PN}" + "=" + prdep) + #prdep=d.getVar('RDEPENDS') or "" +
#bb.debug(1, "RDEPENDS" + "=" + prdep) +}

What is this?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org

iD8DBQFTWhJvMkyGM64RGpERArXTAJ4u1918rurp4h7aTEX6wW2/J0C+IgCeLLQc ALaeAdoJhjuntnDEx23edT0=
=0QxD
-----END PGP SIGNATURE-----

#3 lore raw
Quoted 36 lines · Chong Lu
Quoted 25 lines · Koen Kooi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chong Lu schreef op 25-04-14 04:22:

Quoted 21 lines

1. default enable perl and python bindings 2. rrdtool uses perl.real, perl.real doesn't know where the PERL5LIB should be when prebuilts are used. Use the wrapper perl instead, perl sets PERL5LIB and invokes perl.real 3. While using dash as /bin/sh, subsequent commands in functions will not use the environment variables passed to the function call line unless explicitly run "export ENV_VAR". 4. delete unrecognized
options: "--enable-local-libpng" and "--enable-local-zlib"

meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb | 129 ++++++++++++++++++++- 1 file changed, 123 insertions(+), 6 deletions(-)

(quoted diff) +0 -0

b/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb index 533451f..36785cd 100644 --- a/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb +++ b/meta-oe/recipes-extended/rrdtool/rrdtool_1.4.7.bb @@ -15,25 +15,142 @@ SRC_URI = "http://oss.oetiker.ch/rrdtool/pub/rrdtool-${PV}.tar.gz \
SRC_URI[md5sum] = "ffe369d8921b4dfdeaaf43812100c38f" SRC_URI[sha256sum] = "956aaf431c955ba88dd7d98920ade3a8c4bad04adb1f9431377950a813a7af11"

Quoted 9 lines

Review

Quoted 7 lines

-inherit autotools gettext +inherit autotools gettext pythonnative perlnative python-dir

EXTRA_AUTORECONF = "-I m4"

(quoted diff) +1 -1
-PACKAGECONFIG ??= "" +PACKAGECONFIG ??= "python perl" +
+PACKAGES_DYNAMIC += "^${PN}-perl ^${PN}-python"

No, just no. Martin said 'Add it to PACKAGES'.

Quoted 5 lines

If I add it to PACKAGES, I will get following errors:
ERROR: QA Issue: rrdtool-perl is listed in PACKAGES multiple times, this leads to packaging errors.
ERROR: QA Issue: rrdtool-python is listed in PACKAGES multiple times, this leads to packaging errors.

You need to remove mangling PACKAGES from populate_packages_prepend

Quoted 33 lines
Quoted 27 lines
Quoted 10 lines

+python populate_packages_prepend() { + def fill_more(name,
rdep=None): + if name is None or name.strip() == "": +
return + + fpack=d.getVar('PACKAGES') or "" +
fpack="${PN}-" + name + " " + fpack + d.setVar('PACKAGES', fpack)
+ if rdep is not None: +
prdep=d.getVar('RDEPENDS_${PN}-' + name) or "" + prdep=rdep +
" " + prdep + d.setVar('RDEPENDS_${PN}-' + name, prdep) + +
prdep=d.getVar('RDEPENDS_${PN}-' + name) or "" + bb.debug(1,
"RDEPENDS_${PN}-" + name + "=" + prdep) + + conf=(d.getVar('PACKAGECONFIG', True) or "").split() +

Quoted 8 lines

pack=d.getVar('PACKAGES') or "" + bb.debug(1, "PACKAGECONFIG=%s" %
conf) + bb.debug(1, "PACKAGES1=%s" % pack ) + + if "perl" in conf
: + fill_more("perl") + + if "python" in conf: +
fill_more("python") + + pack=d.getVar('PACKAGES', True) or "" +
bb.debug(1, "PACKAGES after=%s" % pack) + + #debug code +
#prdep=d.getVar('RDEPENDS_${PN}') or "" + #bb.debug(1,
"RDEPENDS_${PN}" + "=" + prdep) + #prdep=d.getVar('RDEPENDS') or "" +
#bb.debug(1, "RDEPENDS" + "=" + prdep) +}

What is this?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org

iD8DBQFTWhJvMkyGM64RGpERArXTAJ4u1918rurp4h7aTEX6wW2/J0C+IgCeLLQc ALaeAdoJhjuntnDEx23edT0=
=0QxD
-----END PGP SIGNATURE-----

Signature · 4 lines
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]