meta-agl-basesystem: add libxml-xpath-perl 41/25841/2
authorScott Murray <scott.murray@konsulko.com>
Sat, 19 Dec 2020 21:13:15 +0000 (16:13 -0500)
committerScott Murray <scott.murray@konsulko.com>
Mon, 21 Dec 2020 14:41:02 +0000 (09:41 -0500)
Add libxml-xpath-perl recipe and recipes for its required dependencies
libscalar-list-utils-perl and libpath-tiny-perl.  This should enable
using the xpath utility in the basesystem build by DEPENDing on
libxml-xpath-perl-native.

Note that the libscalar-list-utils-perl recipe has been adapted from
the one present in meta-cpan (https://github.com/meta-cpan/meta-cpan)
as of commit 2f6ecfa.  This was viewed as preferable to pulling in
meta-cpan as an AGL dependency.  Additionally, the recipe has been
updated to enable ptest support, and all tests have been confirmed to
pass.  The same is true of the libxml-xpath-perl and libpath-tiny-perl
ptests.

Bug-AGL: SPEC-3670

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Icd25cbb4498636c5a6a384818535e3c3372b5b29

meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libpath-tiny-perl_0.114.bb [new file with mode: 0644]
meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libscalar-list-utils-perl_1.55.bb [new file with mode: 0644]
meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libxml-xpath-perl/adjust-load-test-for-ptest.patch [new file with mode: 0644]
meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libxml-xpath-perl_1.44.bb [new file with mode: 0644]

diff --git a/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libpath-tiny-perl_0.114.bb b/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libpath-tiny-perl_0.114.bb
new file mode 100644 (file)
index 0000000..3f7af7a
--- /dev/null
@@ -0,0 +1,24 @@
+SUMMARY = "Path::Tiny - File path utility"
+DESCRIPTION = "This module provides a small, fast utility for working with \
+file paths. It is friendlier to use than File::Spec and provides easy access \
+to functions from several other core file handling modules"
+HOMEPAGE = "https://github.com/dagolden/Path-Tiny"
+SECTION = "libs"
+LICENSE = "Apache-2.0"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/Path-Tiny-${PV}.tar.gz"
+SRC_URI[sha256sum] = "cd0f88f37a58fc3667ec065767fe01e73ee6efa18a112bfd3508cf6579ca00e1"
+
+S = "${WORKDIR}/Path-Tiny-${PV}"
+
+inherit cpan ptest-perl
+
+RDEPENDS_${PN} += " \
+    perl-module-file-spec \
+    perl-module-file-temp \
+    perl-module-test-more \
+"
+
+BBCLASSEXTEND = "native"
diff --git a/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libscalar-list-utils-perl_1.55.bb b/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libscalar-list-utils-perl_1.55.bb
new file mode 100644 (file)
index 0000000..d81f18f
--- /dev/null
@@ -0,0 +1,26 @@
+SUMMARY = "Perl scalar list modules"
+DESCRIPTION = ""List::Util" contains a selection of subroutines that people have expressed \
+would be nice to have in the perl core, but the usage would not really be \
+high enough to warrant the use of a keyword, and the size so small such \
+that being individual extensions would be wasteful."
+HOMEPAGE = "https://metacpan.org/release/Scalar-List-Utils"
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+                    file://${COMMON_LICENSE_DIR}/GPL-1.0;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Scalar-List-Utils-${PV}.tar.gz"
+SRC_URI[md5sum] = "7988f5111e33ba47e175cf3e86b0d93f"
+SRC_URI[sha256sum] = "4d2bdc1c72a7bc4d69d6a5cc85bc7566497c3b183c6175b832784329d58feb4b"
+
+S = "${WORKDIR}/Scalar-List-Utils-${PV}"
+
+inherit cpan ptest-perl
+
+do_install_prepend() {
+    # requires "-T" (taint) command line option
+    rm -rf ${B}/t/tainted.t
+}
+
+BBCLASSEXTEND = "native"
diff --git a/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libxml-xpath-perl/adjust-load-test-for-ptest.patch b/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libxml-xpath-perl/adjust-load-test-for-ptest.patch
new file mode 100644 (file)
index 0000000..23e6569
--- /dev/null
@@ -0,0 +1,51 @@
+t/00load.t: Adjust for ptest
+
+Change load test to look for installed location in @INC as base for
+modules instead of locally in 'lib' directory as when run inside the
+source tree.
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ t/00load.t | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/t/00load.t b/t/00load.t
+index abc8c58..88a5545 100644
+--- a/t/00load.t
++++ b/t/00load.t
+@@ -5,21 +5,29 @@ use strict;
+ use warnings FATAL => 'all';
+ use Test::More tests => 22;
+-use lib 'lib';
+ use Path::Tiny;
+-my $dir  = path('lib/');
++my $installdir = "";
++foreach (@INC) {
++    if (-d "$_/XML/XPath") {
++      $installdir = "$_/XML/XPath";
++      last;
++    }
++}
++my $dir  = path($installdir);
+ my $iter = $dir->iterator({
+     recurse         => 1,
+     follow_symlinks => 0,
+ });
++BAIL_OUT( "XML::XPath does not compile" ) unless require_ok("XML::XPath");
++
+ while (my $path = $iter->()) {
+     next if $path->is_dir || $path !~ /\.pm$/;
+     my $module = $path->relative;
+-    $module =~ s/(?:^lib\/|\.pm$)//g;
++    $module =~ s/(?:^.*XML\/|\.pm$)//g;
+     $module =~ s/\//::/g;
+-    BAIL_OUT( "$module does not compile" ) unless require_ok($module);
++    BAIL_OUT( "$module does not compile" ) unless require_ok("XML::$module");
+ }
+ diag( "Testing XML::XPath $XML::XPath::VERSION, Perl $], $^X" );
diff --git a/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libxml-xpath-perl_1.44.bb b/meta-oem-production-readiness/meta-agl-basesystem/recipes-devtools/perl/libxml-xpath-perl_1.44.bb
new file mode 100644 (file)
index 0000000..3f13055
--- /dev/null
@@ -0,0 +1,45 @@
+SUMMARY = "Perl modules for parsing and evaluating XPath statements"
+HOMEPAGE = "https://metacpan.org/release/XML-XPath"
+SECTION = "libs"
+LICENSE = "Artistic-2.0 & (Artistic-1.0 | GPL-1.0+)"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b5714f72ee964281c4a38b1f0db4213e \
+                    file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+                    file://${COMMON_LICENSE_DIR}/GPL-1.0;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/M/MA/MANWAR/XML-XPath-${PV}.tar.gz \
+           file://adjust-load-test-for-ptest.patch"
+SRC_URI[sha256sum] = "1cc9110705165dc09dd09974dd7c0b6709c9351d6b6b1cef5a711055f891dd0f"
+
+S = "${WORKDIR}/XML-XPath-${PV}"
+
+inherit cpan ptest-perl
+
+do_install_append_class-native() {
+    # Fix xpath script shebang to work inside native environment
+    sed -i 's|#!.*/perl|#!/usr/bin/env perl|' ${D}${bindir}/xpath
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/examples
+    install -m 0644 ${S}/examples/test.xml ${D}${PTEST_PATH}/examples/
+}
+
+RDEPENDS_${PN} += " \
+    perl-module-carp \
+    perl-module-data-dumper \
+    perl-module-file-spec \
+    perl-module-io-file \
+    perl-module-open \
+    perl-module-overload \
+    perl-module-perlio \
+    perl-module-perlio-encoding \
+    perl-module-utf8 \
+    libxml-parser-perl \
+    libscalar-list-utils-perl \
+"
+
+RDEPENDS_${PN}-ptest += " \
+    libpath-tiny-perl \
+"
+
+BBCLASSEXTEND = "native"