From a54fdc0570df7d7375c02eb6bdc609ed23d4961c Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 21 May 2015 17:34:31 +0800 Subject: [PATCH 1/3] libdbi/libdbd: Import the perl module needed for a script We need DBI and the sqlite3 backend support for a small monitoring application. Make it available. The files were taken from meta-perl as of yesterday. --- .../libdbd-sqlite-perl/sqlite-perl-test.pl | 69 +++++++++++++++++++ .../perl-libdbd/libdbd-sqlite-perl_1.40.bb | 39 +++++++++++ .../perl-libdbd/libdbi-perl_1.628.bb | 26 +++++++ 3 files changed, 134 insertions(+) create mode 100755 recipes-extra/perl-libdbd/libdbd-sqlite-perl/sqlite-perl-test.pl create mode 100644 recipes-extra/perl-libdbd/libdbd-sqlite-perl_1.40.bb create mode 100644 recipes-extra/perl-libdbd/libdbi-perl_1.628.bb diff --git a/recipes-extra/perl-libdbd/libdbd-sqlite-perl/sqlite-perl-test.pl b/recipes-extra/perl-libdbd/libdbd-sqlite-perl/sqlite-perl-test.pl new file mode 100755 index 0000000000..40f5916f58 --- /dev/null +++ b/recipes-extra/perl-libdbd/libdbd-sqlite-perl/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/recipes-extra/perl-libdbd/libdbd-sqlite-perl_1.40.bb b/recipes-extra/perl-libdbd/libdbd-sqlite-perl_1.40.bb new file mode 100644 index 0000000000..fad03d8178 --- /dev/null +++ b/recipes-extra/perl-libdbd/libdbd-sqlite-perl_1.40.bb @@ -0,0 +1,39 @@ +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 \ +" + +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 +} + diff --git a/recipes-extra/perl-libdbd/libdbi-perl_1.628.bb b/recipes-extra/perl-libdbd/libdbi-perl_1.628.bb new file mode 100644 index 0000000000..38bdf614bb --- /dev/null +++ b/recipes-extra/perl-libdbd/libdbi-perl_1.628.bb @@ -0,0 +1,26 @@ +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 \ +" + +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" From 3f26af624bafd562647d83dcad32fde6e8977a69 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 21 May 2015 18:12:13 +0800 Subject: [PATCH 2/3] perl/json: Add two libraries needed for perl/JSON handling Besides DBI we need the JSON module. As far as I can see JSON can use JSON:XS as a fast encoder/decoder. This is why both libraries need to be provided. --- recipes-extra/perl-json/libjson-perl_2.90.bb | 20 +++++++++++++++++++ .../perl-json/libjson-xs-perl_3.01.bb | 19 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 recipes-extra/perl-json/libjson-perl_2.90.bb create mode 100644 recipes-extra/perl-json/libjson-xs-perl_3.01.bb diff --git a/recipes-extra/perl-json/libjson-perl_2.90.bb b/recipes-extra/perl-json/libjson-perl_2.90.bb new file mode 100644 index 0000000000..e1d78eb6b4 --- /dev/null +++ b/recipes-extra/perl-json/libjson-perl_2.90.bb @@ -0,0 +1,20 @@ +SUMMARY = "The Perl JSON API" +DESCRIPTION = "" +HOMEPAGE = "http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm" +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0+" +RDEPENDS_${PN} = " perl-module-carp \ + libjson-perl-xs \ +" + +LIC_FILES_CHKSUM = "file://MYMETA.yml;md5=0493d966114fbe8a4d6e2013cefa60ca" + +SRC_URI = "http://search.cpan.org/CPAN/authors/id/M/MA/MAKAMAKA/JSON-${PV}.tar.gz" +SRC_URI[md5sum] = "e1512169a623e790a3f69b599cc1d3b9" +SRC_URI[sha256sum] = "4ddbb3cb985a79f69a34e7c26cde1c81120d03487e87366f9a119f90f7bdfe88" + +S = "${WORKDIR}/JSON-${PV}" + +inherit cpan + +BBCLASSEXTEND = "native" diff --git a/recipes-extra/perl-json/libjson-xs-perl_3.01.bb b/recipes-extra/perl-json/libjson-xs-perl_3.01.bb new file mode 100644 index 0000000000..a7b905acbc --- /dev/null +++ b/recipes-extra/perl-json/libjson-xs-perl_3.01.bb @@ -0,0 +1,19 @@ +SUMMARY = "The Perl JSON API" +DESCRIPTION = "" +HOMEPAGE = "http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm" +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0+" +RDEPENDS_${PN} = " perl-module-encoding \ +" + +LIC_FILES_CHKSUM = "file://COPYING;md5=043dba8b278e1db1b0ef93f30140b02b" + +SRC_URI = "http://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/JSON-XS-${PV}.tar.gz" +SRC_URI[md5sum] = "b7be65295baf6dd9233c6494782c1153" +SRC_URI[sha256sum] = "4e8df3256a5aa9ed304ce1bbcd9140737deef31ba847bff9f4c15480c88c71ab" + +S = "${WORKDIR}/JSON-XS-${PV}" + +inherit cpan + +BBCLASSEXTEND = "native" From bbfff1e487037b2a60588d30e2a3851cf2c4be49 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 21 May 2015 18:14:10 +0800 Subject: [PATCH 3/3] task-sysmocom-feed: Build perl and include the new modules We want these modules to be available, specially to determine the real depedencies and then to fix them. --- recipes-apps/tasks/task-sysmocom-feed.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes-apps/tasks/task-sysmocom-feed.bb b/recipes-apps/tasks/task-sysmocom-feed.bb index 46ba06d1de..428f495d8a 100644 --- a/recipes-apps/tasks/task-sysmocom-feed.bb +++ b/recipes-apps/tasks/task-sysmocom-feed.bb @@ -14,4 +14,5 @@ RDEPENDS_${PN} = "\ python-pyserial python-pexpect bridge-utils \ pciutils nfacct logrotate dnsmasq ifupdown \ logrotate python-jsonrpclib iputils \ - packagegroup-sysmobts-sob" + packagegroup-sysmobts-sob \ + perl libdbd-sqlite-perl libdbi-perl libjson-perl"