* [PATCH 0/2] add perl database support packages
@ 2013-08-08 9:01 Hongxu Jia
2013-08-08 9:01 ` [PATCH 1/2] libdbi-perl: add version 1.628 Hongxu Jia
2013-08-08 9:01 ` [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 Hongxu Jia
0 siblings, 2 replies; 13+ messages in thread
From: Hongxu Jia @ 2013-08-08 9:01 UTC (permalink / raw)
To: openembedded-core
In oe-core, only SQLite is supported, so we add perl-DBI and perl-DBD-SQLite.
Test Case:
1) vim local.conf:
...
IMAGE_INSTALL_append = " libdbm-sqlite-perl"
PERL_DBM_TEST = "1"
...
2) build core-image-sato and boot the target
3) run "sqlite-perl-test.pl" in target
...
root@qemuarm:~# sqlite-perl-test.pl
Connect to SQLite's in-memory database
Create table tbl1(name varchar(10), id smallint)
Insert into tbl1 values('yocto',10)
Insert into tbl1 values('windriver', 20)
Select * from tbl1
-----------------------------------
yocto: 10
windriver: 20
Update tbl1 set name = 'oe-core' where id = 10
Delete from tbl1 where id = 20
Select * from tbl1
-----------------------------------
oe-core: 10
Test Success
...
//Hongxu
The following changes since commit 9de0ad47462c13ac4a2d73e12e92be6c1b4e0415:
genericx86: ship all the driver firmware by default (2013-07-31 07:00:00 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib hongxu/perl-dbi
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/perl-dbi
Hongxu Jia (2):
libdbi-perl: add version 1.628
libdbm-sqlite-perl: add version 1.40
.../perl/files/sqlite-perl-test.pl | 69 ++++++++++++++++++++++
meta/recipes-extended/perl/libdbi-perl_1.628.bb | 27 +++++++++
.../perl/libdbm-sqlite-perl_1.40.bb | 40 +++++++++++++
3 files changed, 136 insertions(+)
create mode 100755 meta/recipes-extended/perl/files/sqlite-perl-test.pl
create mode 100644 meta/recipes-extended/perl/libdbi-perl_1.628.bb
create mode 100644 meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb
--
1.8.1.2
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 1/2] libdbi-perl: add version 1.628 2013-08-08 9:01 [PATCH 0/2] add perl database support packages Hongxu Jia @ 2013-08-08 9:01 ` Hongxu Jia 2013-08-08 9:01 ` [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 Hongxu Jia 1 sibling, 0 replies; 13+ messages in thread From: Hongxu Jia @ 2013-08-08 9:01 UTC (permalink / raw) To: openembedded-core The DBI is a database access module for the Perl programming language. It defines a set of methods, variables, and conventions that provide a consistent database interface, independent of the actual database being used. |<- Scope of DBI ->| .-. .--------------. .-------------. .-------. | |---| XYZ Driver |---| XYZ Engine | | Perl | | | `--------------' `-------------' | script| |A| |D| .--------------. .-------------. | using |--|P|--|B|---|Oracle Driver |---|Oracle Engine| | DBI | |I| |I| `--------------' `-------------' | API | | |... |methods| | |... Other drivers `-------' | |... `-' [YOCTO #4128] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/recipes-extended/perl/libdbi-perl_1.628.bb | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 meta/recipes-extended/perl/libdbi-perl_1.628.bb diff --git a/meta/recipes-extended/perl/libdbi-perl_1.628.bb b/meta/recipes-extended/perl/libdbi-perl_1.628.bb new file mode 100644 index 0000000..c115fac --- /dev/null +++ b/meta/recipes-extended/perl/libdbi-perl_1.628.bb @@ -0,0 +1,27 @@ +SUMMARY = "The Perl Database Interface" +DESCRIPTION = "DBI is a database access Application Programming Interface \ +(API) for the Perl Language. The DBI API Specification defines a set \ +of functions, variables and conventions that provide a consistent \ +database interface independent of the actual database being used. \ +" +HOMEPAGE = "http://search.cpan.org/dist/DBI/" +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0+" +RDEPENDS_${PN} = " perl-module-carp \ + perl-module-exporter \ + perl-module-exporter-heavy \ + perl-module-dynaloader \ +" +PR = "r0" + +LIC_FILES_CHKSUM = "file://DBI.pm;beginline=8147;endline=8151;md5=7d9e154a9ca3c093d2422f7c692d5861" + +SRC_URI = "http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-${PV}.tar.gz" +SRC_URI[md5sum] = "4273f8cc6ee3979ce448c7eb3f8a6a5a" +SRC_URI[sha256sum] = "46c834f4ba1b28c8d8a2db8095835a67fc69a9585761523aea3a74437a969b52" + +S = "${WORKDIR}/DBI-${PV}" + +inherit cpan + +BBCLASSEXTEND = "native" -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 9:01 [PATCH 0/2] add perl database support packages Hongxu Jia 2013-08-08 9:01 ` [PATCH 1/2] libdbi-perl: add version 1.628 Hongxu Jia @ 2013-08-08 9:01 ` Hongxu Jia 2013-08-08 9:06 ` Olof Johansson 2013-08-08 10:43 ` Burton, Ross 1 sibling, 2 replies; 13+ messages in thread From: Hongxu Jia @ 2013-08-08 9:01 UTC (permalink / raw) To: openembedded-core DBD::SQLite is a Perl DBI driver for SQLite, that includes the entire thing in the distribution. So in order to get a fast transaction capable RDBMS working for your perl project you simply have to install this module, and nothing else. There is a perl script for test, while variable PERL_DBM_TEST is assigned the value '1', the script will be added, and you could run the script to test whether DBD::SQLite is working properly. [YOCTO #4128] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- .../perl/files/sqlite-perl-test.pl | 69 ++++++++++++++++++++++ .../perl/libdbm-sqlite-perl_1.40.bb | 40 +++++++++++++ 2 files changed, 109 insertions(+) create mode 100755 meta/recipes-extended/perl/files/sqlite-perl-test.pl create mode 100644 meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb diff --git a/meta/recipes-extended/perl/files/sqlite-perl-test.pl b/meta/recipes-extended/perl/files/sqlite-perl-test.pl new file mode 100755 index 0000000..40f5916 --- /dev/null +++ b/meta/recipes-extended/perl/files/sqlite-perl-test.pl @@ -0,0 +1,69 @@ +#! /usr/bin/env perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation. +# +# Copyright (C) 2013 Wind River Systems, Inc. +# +# - It tests DBI and DBD::SQLite could work correctly which means one could +# manipulate sqlite database in perl +# - The test includes create/insert/update/delete/select, the five important +# things one can do with a table +use DBI; + +sub execute_sql { + my $dbh = $_[0]; + my $sql = $_[1]; + my $sth = $dbh->prepare($sql) + or die "Couldn't prepare statement: " . $dbh->errstr; + $sth->execute(); + print "$sql\n"; + return $sth; +} + +sub select_all { + my $dbh = $_[0]; + my $table = $_[1]; + my $sth = &execute_sql($dbh, "Select * from $table"); + + print "-----------------------------------\n"; + while (@data = $sth->fetchrow_array()) { + my $name = $data[0]; + my $id = $data[1]; + print "$name: $id\n"; + } + print "\n"; + + $sth->finish; + return $sth; +} + +# A private, temporary in-memory database is created for the connection. +# This in-memory database will vanish when the database connection is +# closed. It is handy for your library tests. +my $dbfile = ":memory:"; +my $dbh = DBI->connect("DBI:SQLite:dbname=$dbfile","","") + or die "Couldn't connect to database: " . DBI->errstr; +print "Connect to SQLite's in-memory database\n"; + +&execute_sql($dbh, "Create table tbl1(name varchar(10), id smallint)"); +&execute_sql($dbh, "Insert into tbl1 values('yocto',10)"); +&execute_sql($dbh, "Insert into tbl1 values('windriver', 20)"); +&select_all($dbh, "tbl1"); + +&execute_sql($dbh, "Update tbl1 set name = 'oe-core' where id = 10"); +&execute_sql($dbh, "Delete from tbl1 where id = 20"); +&select_all($dbh, "tbl1"); + +$dbh->disconnect; +print "Test Success\n" diff --git a/meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb b/meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb new file mode 100644 index 0000000..f3a05d2 --- /dev/null +++ b/meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb @@ -0,0 +1,40 @@ +SUMMARY = "A Perl DBI driver for SQLite" +DESCRIPTION = "DBD::SQLite is a Perl DBI driver for SQLite, that includes the entire \ +thing in the distribution. So in order to get a fast transaction capable \ +RDBMS working for your perl project you simply have to install this \ +module, and nothing else. \ +" +HOMEPAGE = "http://search.cpan.org/~ishigaki/DBD-SQLite/" + +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0+" +DEPENDS += "libdbi-perl-native" +RDEPENDS_${PN} += "libdbi-perl \ + sqlite3 \ + perl-module-constant \ + perl-module-locale \ + perl-module-tie-hash \ +" +PR = "r0" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=1726e2117494ba3e13e1c3d93f795360" + +SRC_URI = "http://search.cpan.org/CPAN/authors/id/I/IS/ISHIGAKI/DBD-SQLite-${PV}.tar.gz \ + file://sqlite-perl-test.pl \ +" + +SRC_URI[md5sum] = "b9876882186499583428b14cf5c0e29c" +SRC_URI[sha256sum] = "21fb65e740b6265512c82232b4ad8f75c19ac84c216830112656274eb8e375fb" + +S = "${WORKDIR}/DBD-SQLite-${PV}" + +inherit cpan + +BBCLASSEXTEND = "native" + +do_install_append() { + if [ ${PERL_DBM_TEST} = "1" ]; then + install -m 755 -D ${WORKDIR}/sqlite-perl-test.pl ${D}/${bindir}/sqlite-perl-test.pl + fi +} + -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 9:01 ` [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 Hongxu Jia @ 2013-08-08 9:06 ` Olof Johansson 2013-08-08 9:13 ` Hongxu Jia 2013-08-08 9:17 ` Hongxu Jia 2013-08-08 10:43 ` Burton, Ross 1 sibling, 2 replies; 13+ messages in thread From: Olof Johansson @ 2013-08-08 9:06 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core@lists.openembedded.org On 13-08-08 11:01 +0200, Hongxu Jia wrote: > create mode 100644 meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb The recipe is called libdbm-sqlite-perl, but the perl module is called DBD::SQLite. Is that intentional, and if so, why? Regards, -- olofjn ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 9:06 ` Olof Johansson @ 2013-08-08 9:13 ` Hongxu Jia 2013-08-08 9:17 ` Hongxu Jia 1 sibling, 0 replies; 13+ messages in thread From: Hongxu Jia @ 2013-08-08 9:13 UTC (permalink / raw) To: Olof Johansson; +Cc: openembedded-core@lists.openembedded.org [-- Attachment #1: Type: text/plain, Size: 646 bytes --] On 08/08/2013 05:06 PM, Olof Johansson wrote: > On 13-08-08 11:01 +0200, Hongxu Jia wrote: >> create mode 100644 meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb > The recipe is called libdbm-sqlite-perl, but the perl module is > called DBD::SQLite. Is that intentional, and if so, why? 'DBD::SQLite' is a name used in perl, see http://search.cpan.org/~ishigaki/DBD-SQLite-1.40/lib/DBD/SQLite.pm <http://search.cpan.org/%7Eishigaki/DBD-SQLite-1.40/lib/DBD/SQLite.pm> libdbm-sqlite-perl is the name which references the rule in oe-core (such as libconvert-asn1-perl_0.26.bb, libtimedate-perl_2.30.bb) //Hongxu > Regards, [-- Attachment #2: Type: text/html, Size: 1383 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 9:06 ` Olof Johansson 2013-08-08 9:13 ` Hongxu Jia @ 2013-08-08 9:17 ` Hongxu Jia 2013-08-08 13:06 ` Olof Johansson 1 sibling, 1 reply; 13+ messages in thread From: Hongxu Jia @ 2013-08-08 9:17 UTC (permalink / raw) To: Olof Johansson; +Cc: openembedded-core@lists.openembedded.org On 08/08/2013 05:06 PM, Olof Johansson wrote: > On 13-08-08 11:01 +0200, Hongxu Jia wrote: >> create mode 100644 meta/recipes-extended/perl/libdbm-sqlite-perl_1.40.bb > The recipe is called libdbm-sqlite-perl, but the perl module is > called DBD::SQLite. Is that intentional, and if so, why? I know what your mean, we should rename the recipe: s/libdbm-sqlite-perl_1.40.bb/libdbd-sqlite-perl_1.40.bb/ //Hongxu > Regards, ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 9:17 ` Hongxu Jia @ 2013-08-08 13:06 ` Olof Johansson 0 siblings, 0 replies; 13+ messages in thread From: Olof Johansson @ 2013-08-08 13:06 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core@lists.openembedded.org On 13-08-08 11:17 +0200, Hongxu Jia wrote: > On 08/08/2013 05:06 PM, Olof Johansson wrote: > > The recipe is called libdbm-sqlite-perl, but the perl module is > > called DBD::SQLite. Is that intentional, and if so, why? > > I know what your mean, we should rename the recipe: > s/libdbm-sqlite-perl_1.40.bb/libdbd-sqlite-perl_1.40.bb/ Yes, exactly. Sorry if I was unclear. -- olofjn ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 9:01 ` [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 Hongxu Jia 2013-08-08 9:06 ` Olof Johansson @ 2013-08-08 10:43 ` Burton, Ross 2013-08-08 11:06 ` Hongxu Jia 1 sibling, 1 reply; 13+ messages in thread From: Burton, Ross @ 2013-08-08 10:43 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core On 8 August 2013 10:01, Hongxu Jia <hongxu.jia@windriver.com> wrote: > DBD::SQLite is a Perl DBI driver for SQLite, that includes the entire > thing in the distribution. So in order to get a fast transaction capable > RDBMS working for your perl project you simply have to install this > module, and nothing else. What's the rationale for putting this into oe-core, verses meta-oe or even starting a meta-perl? Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 10:43 ` Burton, Ross @ 2013-08-08 11:06 ` Hongxu Jia 2013-08-08 11:12 ` Burton, Ross 0 siblings, 1 reply; 13+ messages in thread From: Hongxu Jia @ 2013-08-08 11:06 UTC (permalink / raw) To: Burton, Ross; +Cc: openembedded-core [-- Attachment #1: Type: text/plain, Size: 685 bytes --] On 08/08/2013 06:43 PM, Burton, Ross wrote: > On 8 August 2013 10:01, Hongxu Jia <hongxu.jia@windriver.com> wrote: >> DBD::SQLite is a Perl DBI driver for SQLite, that includes the entire >> thing in the distribution. So in order to get a fast transaction capable >> RDBMS working for your perl project you simply have to install this >> module, and nothing else. > What's the rationale for putting this into oe-core, verses meta-oe or > even starting a meta-perl? It seems DBI is a commonly-used perl database support package, and work with multiple DBDs, the DBD::driver is based on actual database. We get sqlite in oe-core, so put them in oe-core. //Hongxu > Ross [-- Attachment #2: Type: text/html, Size: 1526 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 11:06 ` Hongxu Jia @ 2013-08-08 11:12 ` Burton, Ross 2013-08-08 11:35 ` Hongxu Jia 0 siblings, 1 reply; 13+ messages in thread From: Burton, Ross @ 2013-08-08 11:12 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core On 8 August 2013 12:06, Hongxu Jia <hongxu.jia@windriver.com> wrote: > It seems DBI is a commonly-used perl database support package, > and work with multiple DBDs, the DBD::driver is based on actual > database. We get sqlite in oe-core, so put them in oe-core. There are many perl packages that are commonly-used but we don't put them all into oe-core. I'm really thinking that we need to start a meta-perl for the majority of Perl libraries, apart from the ones that are needed in oe-core. Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 11:12 ` Burton, Ross @ 2013-08-08 11:35 ` Hongxu Jia 2013-08-08 13:08 ` Olof Johansson 0 siblings, 1 reply; 13+ messages in thread From: Hongxu Jia @ 2013-08-08 11:35 UTC (permalink / raw) To: Burton, Ross; +Cc: openembedded-core On 08/08/2013 07:12 PM, Burton, Ross wrote: > On 8 August 2013 12:06, Hongxu Jia <hongxu.jia@windriver.com> wrote: >> It seems DBI is a commonly-used perl database support package, >> and work with multiple DBDs, the DBD::driver is based on actual >> database. We get sqlite in oe-core, so put them in oe-core. > There are many perl packages that are commonly-used but we don't put > them all into oe-core. I'm really thinking that we need to start a > meta-perl for the majority of Perl libraries, apart from the ones that > are needed in oe-core. Great, how about create a new layer named 'meta-perl', we sould do: - put these perl database libraries to that layer as a start; - and than move other perl libraries already existed in oe-core to that layer, it includes: * meta/recipes-extended/perl/ * meta/recipes-devtools/perl/ - except the perl libraries which used for lsb test, we should keep them where they are; * meta/recipes-lsb4/perl/ //Hongxu > Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 11:35 ` Hongxu Jia @ 2013-08-08 13:08 ` Olof Johansson 2013-08-08 13:13 ` Burton, Ross 0 siblings, 1 reply; 13+ messages in thread From: Olof Johansson @ 2013-08-08 13:08 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core@lists.openembedded.org On 13-08-08 13:35 +0200, Hongxu Jia wrote: > Great, how about create a new layer named 'meta-perl', we sould do: ... > - and than move other perl libraries already existed in oe-core > to that layer, it includes: > * meta/recipes-extended/perl/ > * meta/recipes-devtools/perl/ I assume perl module recipes already in oecore are there for a reason, and we should perhaps avoid moving them, and just let meta-perl depend on oecore. Right? But I like the idea of a meta-perl for my personal projects... Would be happy to help! -- olofjn ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 2013-08-08 13:08 ` Olof Johansson @ 2013-08-08 13:13 ` Burton, Ross 0 siblings, 0 replies; 13+ messages in thread From: Burton, Ross @ 2013-08-08 13:13 UTC (permalink / raw) To: Olof Johansson; +Cc: openembedded-core@lists.openembedded.org On 8 August 2013 14:08, Olof Johansson <olof.johansson@axis.com> wrote: > I assume perl module recipes already in oecore are there for a > reason, and we should perhaps avoid moving them, and just let > meta-perl depend on oecore. Right? Yeah. It's worth reviewing them, but generally perl modules in oe-core are there before other parts of oe-core depend on them. Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-08-08 13:13 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-08 9:01 [PATCH 0/2] add perl database support packages Hongxu Jia 2013-08-08 9:01 ` [PATCH 1/2] libdbi-perl: add version 1.628 Hongxu Jia 2013-08-08 9:01 ` [PATCH 2/2] libdbm-sqlite-perl: add version 1.40 Hongxu Jia 2013-08-08 9:06 ` Olof Johansson 2013-08-08 9:13 ` Hongxu Jia 2013-08-08 9:17 ` Hongxu Jia 2013-08-08 13:06 ` Olof Johansson 2013-08-08 10:43 ` Burton, Ross 2013-08-08 11:06 ` Hongxu Jia 2013-08-08 11:12 ` Burton, Ross 2013-08-08 11:35 ` Hongxu Jia 2013-08-08 13:08 ` Olof Johansson 2013-08-08 13:13 ` Burton, Ross
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox