Yocto 2.5

Move OpenBMC to Yocto 2.5(sumo)

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/liberror-perl_0.17024.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/liberror-perl_0.17025.bb
similarity index 72%
rename from import-layers/yocto-poky/meta/recipes-devtools/perl/liberror-perl_0.17024.bb
rename to import-layers/yocto-poky/meta/recipes-devtools/perl/liberror-perl_0.17025.bb
index 6ae0e7e..f6dc30d 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/liberror-perl_0.17024.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/liberror-perl_0.17025.bb
@@ -13,16 +13,21 @@
 
 SRC_URI = "http://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-${PV}.tar.gz"
 
-SRC_URI[md5sum] = "7e3676a7fb14f65f568f12d4b40a2a72"
-SRC_URI[sha256sum] = "074db7c783a67b0667eca64a4f6a0c3de94998afc92c01d6453163eb04b9150d"
+SRC_URI[md5sum] = "1a2ee7f0dc44f9ee76661a16bbbc0c48"
+SRC_URI[sha256sum] = "6c9f474ad3d4fe0cabff6b6be532cb1dd348245986d4a6b600ad921d5cfdefaf"
 
 S = "${WORKDIR}/Error-${PV}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 do_compile() {
 	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
 	cpan_do_compile
 }
 
+do_install_prepend() {
+	# test requires "-T" (taint) command line option
+	rm -rf ${B}/t/pod-coverage.t
+}
+
 BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb
new file mode 100644
index 0000000..e5ab7a3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb
@@ -0,0 +1,29 @@
+SUMMARY = "Skip tests when modules not available"
+DESCRIPTION = "Skip test scripts if modules are not available. \
+The requested modules will be loaded, and optionally have their versions \
+checked. If the module is missing, the test script will be skipped. Modules \
+that are found but fail to compile will exit with an error rather than skip."
+
+HOMEPAGE = "https://metacpan.org/release/Test-Needs"
+SECTION = "libs"
+LICENSE = "Artistic-1.0 | GPL-1.0+"
+
+CPAN_NAME = "Test-Needs"
+CPAN_AUTHOR = "HAARG"
+
+LIC_FILES_CHKSUM = "file://README;md5=3f3ccd21a0a48aa313db212cc3b1bc09;beginline=81;endline=82"
+
+DEPENDS += "perl"
+
+SRC_URI = "http://www.cpan.org/authors/id/H/HA/${CPAN_AUTHOR}/${CPAN_NAME}-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "356634a56c99282e8059f290f5d534c8"
+SRC_URI[sha256sum] = "5a4f33983586edacdbe00a3b429a9834190140190dab28d0f873c394eb7df399"
+
+S = "${WORKDIR}/${CPAN_NAME}-${PV}"
+
+inherit cpan ptest-perl
+
+RDEPENDS_${PN}-ptest += "perl-module-test-more"
+
+BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/liburi-perl_1.72.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/liburi-perl_1.73.bb
similarity index 70%
rename from import-layers/yocto-poky/meta/recipes-devtools/perl/liburi-perl_1.72.bb
rename to import-layers/yocto-poky/meta/recipes-devtools/perl/liburi-perl_1.73.bb
index a399c10..49238f3 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/liburi-perl_1.72.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/liburi-perl_1.73.bb
@@ -13,18 +13,26 @@
 
 SRC_URI = "http://www.cpan.org/authors/id/E/ET/ETHER/URI-${PV}.tar.gz"
 
-SRC_URI[md5sum] = "cd56d81ed429efaa97e7f3ff08851b48"
-SRC_URI[sha256sum] = "35f14431d4b300de4be1163b0b5332de2d7fbda4f05ff1ed198a8e9330d40a32"
+SRC_URI[md5sum] = "37d44a08e599aa945b32a9434ffe00a5"
+SRC_URI[sha256sum] = "cca7ab4a6f63f3ccaacae0f2e1337e8edf84137e73f18548ec7d659f23efe413"
 
 S = "${WORKDIR}/URI-${PV}"
 
 EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 do_compile() {
 	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
 	cpan_do_compile
 }
 
+do_install_prepend() {
+	# these tests require "-T" (taint) command line option
+	rm -rf ${B}/t/cwd.t
+	rm -rf ${B}/t/file.t
+}
+
+RDEPENDS_${PN}-ptest += "libtest-needs-perl"
+
 BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb
index cc3a660..c5e0ae6 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb
@@ -14,7 +14,7 @@
 
 EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR} CC='${CC}' LD='${CCLD}' FULL_AR='${AR}'"
 
-inherit cpan
+inherit cpan ptest-perl
 
 # fix up sub MakeMaker project as arguments don't get propagated though
 # see https://rt.cpan.org/Public/Bug/Display.html?id=28632
@@ -34,4 +34,13 @@
 	cpan_do_compile
 }
 
+do_install_ptest() {
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/xmlstats
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/xmlfilter
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/xmlcomments
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/canonical
+	cp -r ${B}/samples ${D}${PTEST_PATH}
+	chown -R root:root ${D}${PTEST_PATH}/samples
+}
+
 BBCLASSEXTEND="native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-perl_0.08.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-perl_0.08.bb
index 0478427..0f60998 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-perl_0.08.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-perl_0.08.bb
@@ -19,7 +19,7 @@
 
 EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 do_compile() {
 	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb
index 0cf2eeb..f9d00d2 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb
@@ -19,6 +19,6 @@
 
 EXTRA_PERLFLAGS = "-I ${PERLHOSTLIB}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-native_5.24.1.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-native_5.24.1.bb
index 6c56a7d..71f4589 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-native_5.24.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-native_5.24.1.bb
@@ -1,8 +1,7 @@
 require perl.inc
 
 # We need gnugrep (for -I)
-DEPENDS = "virtual/db-native grep-native"
-DEPENDS += "gdbm-native zlib-native"
+DEPENDS = "db-native grep-native gdbm-native zlib-native"
 
 EXTRA_OEMAKE = "-e MAKEFLAGS="
 
@@ -16,6 +15,7 @@
            file://dynaloaderhack.patch \
            file://perl-PathTools-don-t-filter-out-blib-from-INC.patch \
            file://0001-Configure-Remove-fstack-protector-strong-for-native-.patch \
+           file://perl-5.26.1-guard_old_libcrypt_fix.patch \
           "
 
 SRC_URI[md5sum] = "af6a84c7c3e2b8b269c105a5db2f6d53"
@@ -135,3 +135,5 @@
 
 # Fix the path in sstate
 SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
+PACKAGES_DYNAMIC_class-native += "^perl-module-.*native$"
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-ptest.inc b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-ptest.inc
index 1f549af..6a7a2d7 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-ptest.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl-ptest.inc
@@ -2,31 +2,43 @@
 
 SRC_URI += "file://run-ptest \
            "
-
 do_install_ptest () {
 	mkdir -p ${D}${PTEST_PATH}
 	sed -e "s:\/usr\/local:${bindir}:g" -i cpan/version/t/*
 	sed -e "s:\/opt:\/usr:" -i Porting/add-package.pl
 	sed -e "s:\/local\/gnu\/:\/:" -i hints/cxux.sh
-	tar -c --exclude=\*.o --exclude=libperl.so --exclude=Makefile --exclude=makefile --exclude=hostperl \
+	tar -c --exclude='*.o' --exclude=libperl.so --exclude=Makefile --exclude=makefile --exclude=hostperl \
+	    --exclude=cygwin --exclude=os2 --exclude=djgpp --exclude=qnx --exclude=symbian --exclude=haiku \
+	    --exclude=vms --exclude=vos --exclude=NetWare --exclude=amigaos4  --exclude=buildcustomize.pl \
+	    --exclude='win32/config.*' --exclude=plan9 --exclude=README.plan9 --exclude=perlplan9.pod --exclude=Configure \
+	    --exclude=veryclean.sh --exclude=realclean.sh  --exclude=getioctlsizes \
+	    --exclude=dl_aix.xs --exclude=sdbm.3 --exclude='cflags.SH' --exclude=makefile.old \
 		--exclude=miniperl --exclude=generate_uudmap --exclude=patches * | ( cd ${D}${PTEST_PATH} && tar -x )
 
-	sed -i -e "s,${D},,g" \
+	ln -sf ${bindir}/perl ${D}${PTEST_PATH}/t/perl
+
+	# Remove build host references from various scattered files...
+	find "${D}${PTEST_PATH}" \
+	     \( -name '*.PL' -o -name 'myconfig' -o -name 'cflags' -o -name '*.pl' -o -name '*.sh' -o -name '*.pm' \
+	     -o -name 'h2xs' -o -name 'h2ph' \
+	     -o -name '*.h' -o -name 'config.sh-*' -o -name 'pod2man'  -o -name 'pod2text' \) \
+	    -type f -exec sed -i \
+	       -e "s,${D},,g" \
 	       -e "s,--sysroot=${STAGING_DIR_HOST},,g" \
 	       -e "s,-isystem${STAGING_INCDIR} ,,g" \
+	       -e 's|${DEBUG_PREFIX_MAP}||g' \
+	       -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
 	       -e "s,${STAGING_LIBDIR},${libdir},g" \
 	       -e "s,${STAGING_BINDIR},${bindir},g" \
 	       -e "s,${STAGING_INCDIR},${includedir},g" \
-	       -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
 	       -e "s,${STAGING_BINDIR_NATIVE}/,,g" \
 	       -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
-	    ${D}${PTEST_PATH}/lib/Config.pm \
-	    ${D}${PTEST_PATH}/cpan/podlators/scripts/pod2man \
-	    ${D}${PTEST_PATH}/cpan/podlators/scripts/pod2text
+	       -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
+	       -e 's:${RECIPE_SYSROOT}::g' \
+	        {} +
 
-	ln -sf ${bindir}/perl ${D}${PTEST_PATH}/t/perl
-	# Remove plan9 related stuff
-	rm -rf ${D}${PTEST_PATH}/plan9 ${D}${PTEST_PATH}/README.plan9 ${D}${PTEST_PATH}/pod/perlplan9.pod
+	 # Remove a useless timestamp...
+	 sed -i -e '/Autogenerated starting on/d' ${D}${PTEST_PATH}/lib/unicore/mktables.lst
 }
 
 python populate_packages_prepend() {
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/CVE-2017-12837.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/CVE-2017-12837.patch
new file mode 100644
index 0000000..0b59fcd
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/CVE-2017-12837.patch
@@ -0,0 +1,32 @@
+From 73d7247ecab863ef26b5687a37ccc75d6144ad0f Mon Sep 17 00:00:00 2001
+From: Karl Williamson <khw@cpan.org>
+Date: Tue, 17 Oct 2017 13:49:14 +0800
+Subject: [PATCH] fix CVE-2017-12837
+
+Signed-off-by: Karl Williamson <khw@cpan.org>
+Signed-off-by: Steve Hay <steve.m.hay@googlemail.com>
+
+CVE: CVE-2017-12837
+Upstream-Status: Backport
+https://perl5.git.perl.org/perl.git/commitdiff/96c83ed78aeea1a0496dd2b2d935869a822dc8a5
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ regcomp.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/regcomp.c b/regcomp.c
+index 5498d14..31ec383 100644
+--- a/regcomp.c
++++ b/regcomp.c
+@@ -13021,6 +13021,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
+                             goto loopdone;
+                         }
+                         p = RExC_parse;
++                        RExC_parse = parse_start;
+                         if (ender > 0xff) {
+                             REQUIRE_UTF8(flagp);
+                         }
+-- 
+1.8.3.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/CVE-2017-12883.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/CVE-2017-12883.patch
new file mode 100644
index 0000000..5c1805f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/CVE-2017-12883.patch
@@ -0,0 +1,44 @@
+From 40b3cdad3649334585cee8f4630ec9a025e62be6 Mon Sep 17 00:00:00 2001
+From: Karl Williamson <khw@cpan.org>
+Date: Fri, 25 Aug 2017 11:33:58 -0600
+Subject: [PATCH] PATCH: [perl #131598]
+
+The cause of this is that the vFAIL macro uses RExC_parse, and that
+variable has just been changed in preparation for code after the vFAIL.
+The solution is to not change RExC_parse until after the vFAIL.
+
+This is a case where the macro hides stuff that can bite you.
+
+(cherry picked from commit 2be4edede4ae226e2eebd4eff28cedd2041f300f)
+
+Upstream-Status: Backport
+CVE: CVE-2017-12833
+Signed-off-by: Armin Kuster <akuster@mvista.com>
+
+---
+ regcomp.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+Index: perl-5.24.1/regcomp.c
+===================================================================
+--- perl-5.24.1.orig/regcomp.c
++++ perl-5.24.1/regcomp.c
+@@ -11918,14 +11918,16 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pREx
+ 	}
+         sv_catpv(substitute_parse, ")");
+ 
+-        RExC_parse = RExC_start = RExC_adjusted_start = SvPV(substitute_parse,
+-                                                             len);
++        len = SvCUR(substitute_parse);
+ 
+ 	/* Don't allow empty number */
+ 	if (len < (STRLEN) 8) {
+             RExC_parse = endbrace;
+ 	    vFAIL("Invalid hexadecimal number in \\N{U+...}");
+ 	}
++
++        RExC_parse = RExC_start = RExC_adjusted_start
++                                              = SvPV_nolen(substitute_parse);
+ 	RExC_end = RExC_parse + len;
+ 
+         /* The values are Unicode, and therefore not subject to recoding, but
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/Makefile.SH.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/Makefile.SH.patch
index fd8237f..c1db335 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/Makefile.SH.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/Makefile.SH.patch
@@ -12,10 +12,10 @@
  Makefile.SH | 147 ++++++++++++++++++++++++++++--------------------------------
  1 file changed, 68 insertions(+), 79 deletions(-)
 
-diff --git a/Makefile.SH b/Makefile.SH
-index 916b332..b143d46 100755
---- a/Makefile.SH
-+++ b/Makefile.SH
+Index: perl-5.24.1/Makefile.SH
+===================================================================
+--- perl-5.24.1.orig/Makefile.SH
++++ perl-5.24.1/Makefile.SH
 @@ -48,10 +48,10 @@ case "$useshrplib" in
  true)
  	# Prefix all runs of 'miniperl' and 'perl' with
@@ -74,6 +74,10 @@
 -all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT)
 -	@echo " ";
 -	@echo "	Everything is up to date. Type '$(MAKE) test' to run test suite."
+-
+-$(MANIFEST_SRT):	MANIFEST $(PERL_EXE)
+-	@$(RUN_PERL) Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \
+-	    $(RUN_PERL) Porting/manisort -q -o MANIFEST; sh -c true)
 +#all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT)
 +#	@echo " ";
 +#	@echo "	Everything is up to date. Type '$(MAKE) test' to run test suite."
@@ -83,10 +87,7 @@
 +more: $(generated_pods) $(private) $(public)
 +
 +more2: $(dynamic_ext)
- 
--$(MANIFEST_SRT):	MANIFEST $(PERL_EXE)
--	@$(RUN_PERL) Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \
--	    $(RUN_PERL) Porting/manisort -q -o MANIFEST; sh -c true)
++
 +more3: $(nonxs_ext)
 +
 +more4: extras.make $(MANIFEST_SRT)
@@ -151,7 +152,7 @@
  	./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def
  
  !NO!SUBS!
-@@ -878,7 +878,7 @@ $(LIBPERL): $& $(perllib_objs) $(DYNALOADER) $(LIBPERLEXPORT)
+@@ -878,7 +878,7 @@ $(LIBPERL): $& $(perllib_objs) $(DYNALOA
  	true)
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  	rm -f $@
@@ -160,7 +161,7 @@
  !NO!SUBS!
  		case "$osname" in
  		aix)
-@@ -936,15 +936,19 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
+@@ -936,15 +936,19 @@ lib/buildcustomize.pl: $& $(miniperl_obj
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(miniperl_objs)
  	$(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(miniperl_objs) $(libs)
@@ -183,7 +184,7 @@
  	$(MINIPERL) -f write_buildcustomize.pl    
  !NO!SUBS!
  		;;
-@@ -966,7 +970,9 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
+@@ -966,7 +970,9 @@ lib/buildcustomize.pl: $& $(miniperl_obj
  	-@rm -f miniperl.xok
  	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
@@ -194,7 +195,7 @@
  	$(MINIPERL) -f write_buildcustomize.pl
  !NO!SUBS!
  		;;
-@@ -977,7 +983,9 @@ lib/buildcustomize.pl: \$& \$(miniperl_objs) write_buildcustomize.pl
+@@ -977,7 +983,9 @@ lib/buildcustomize.pl: \$& \$(miniperl_o
  	-@rm -f miniperl.xok
  	-@rm \$(MINIPERL_EXE)
  	\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
@@ -205,7 +206,7 @@
  	\$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
  !GROK!THIS!
  		else
-@@ -986,7 +994,9 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
+@@ -986,7 +994,9 @@ lib/buildcustomize.pl: $& $(miniperl_obj
  	-@rm -f miniperl.xok
  	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
@@ -225,7 +226,7 @@
  	-@for f in Makefile.PL PPPort_pm.PL PPPort_xs.PL ppport_h.PL; do \
  	(cd ext/Devel-PPPort && `pwd`/run.sh ../../$(MINIPERL_EXE) -I../../lib \$\$f); \
  	done
-@@ -1046,7 +1056,7 @@ makeppport: \$(MINIPERL_EXE) \$(CONFIGPM)
+@@ -1046,7 +1056,7 @@ makeppport: \$(MINIPERL_EXE) \$(CONFIGPM
  *)
  $spitshell >>$Makefile <<'!NO!SUBS!'
  .PHONY: makeppport
@@ -254,7 +255,7 @@
  	$(MINIPERL) lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
  #	Commented out so always runs, mktables looks at far more files than we
  #	can in this makefile to decide if needs to run or not
-@@ -1074,12 +1084,12 @@ uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
+@@ -1074,12 +1084,12 @@ uni.data: $(MINIPERL_EXE) $(CONFIGPM) li
  # $(PERL_EXE) and ext because pod_lib.pl needs Digest::MD5
  # But also this ensures that all extensions are built before we try to scan
  # them, which picks up Devel::PPPort's documentation.
@@ -270,9 +271,9 @@
  	$(MINIPERL) autodoc.pl
  
  pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
-@@ -1089,7 +1099,7 @@ pod/perl5240delta.pod: pod/perldelta.pod
- 	$(RMS) pod/perl5240delta.pod
- 	$(LNS) perldelta.pod pod/perl5240delta.pod
+@@ -1089,7 +1099,7 @@ pod/perl5241delta.pod: pod/perldelta.pod
+ 	$(RMS) pod/perl5241delta.pod
+ 	$(LNS) perldelta.pod pod/perl5241delta.pod
  
 -extra.pods: $(MINIPERL_EXE)
 +extra.pods:
@@ -345,7 +346,7 @@
  	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
  
  n_dummy $(nonxs_ext):	$(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE
-@@ -1479,14 +1468,14 @@ test_prep_pre: preplibrary utilities $(nonxs_ext)
+@@ -1479,14 +1468,14 @@ test_prep_pre: preplibrary utilities $(n
  
  case "$targethost" in
  '') $spitshell >>$Makefile <<'!NO!SUBS!'
@@ -362,7 +363,7 @@
  	\$(dynamic_ext) \$(TEST_PERL_DLL) runtests \
  	\$(generated_pods)
  	$to libperl.*
-@@ -1539,7 +1528,7 @@ test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE
+@@ -1539,7 +1528,7 @@ test_prep test-prep: test_prep_pre \$(MI
  esac
  
  $spitshell >>$Makefile <<'!NO!SUBS!'
@@ -380,6 +381,3 @@
  	- cd t && $(RUN_PERL) TEST $(MINITEST_TESTS) <$(devtty)
  
  minitest-notty minitest_notty: $(MINIPERL_EXE) minitest_prep
--- 
-2.1.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/config.sh b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/config.sh
index 4657673..ac0484c 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/config.sh
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/config.sh
@@ -361,7 +361,7 @@
 d_ldexpl='define'
 d_lgamma='define'
 d_lgamma_r='define'
-d_libm_lib_version='define'
+d_libm_lib_version='undef'
 d_libname_unique='undef'
 d_link='define'
 d_llrint='define'
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/cross-generate_uudmap.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/cross-generate_uudmap.patch
index a00ad61..33e2222 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/cross-generate_uudmap.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/cross-generate_uudmap.patch
@@ -1,15 +1,15 @@
 Upstream-Status:Inappropriate [embedded specific]
 
-Index: perl-5.14.2/Makefile.SH
+Index: perl-5.24.1/Makefile.SH
 ===================================================================
---- perl-5.14.2.orig/Makefile.SH
-+++ perl-5.14.2/Makefile.SH
-@@ -622,7 +622,7 @@ bitcount.h: generate_uudmap$(HOST_EXE_EX
- 	$(RUN) ./generate_uudmap$(HOST_EXE_EXT) uudmap.h bitcount.h
+--- perl-5.24.1.orig/Makefile.SH
++++ perl-5.24.1/Makefile.SH
+@@ -710,7 +710,7 @@ bitcount.h: generate_uudmap\$(HOST_EXE_E
  
+ $spitshell >>$Makefile <<'!NO!SUBS!'
  generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
 -	$(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
 +	$(BUILD_CC) -o generate_uudmap$(EXE_EXT) generate_uudmap.c
  
- miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
- 	$(CCCMD) $(PLDLFLAGS) $*.c
+ !NO!SUBS!
+ ;;
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/fix_bad_rpath.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/fix_bad_rpath.patch
index 7650128..49efcbe 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/fix_bad_rpath.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/fix_bad_rpath.patch
@@ -10,15 +10,15 @@
 It is a fix to MakeMaker within perl, so all such perl recipes will get 
 fixed with this perl fix.
 
-Index: perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+Index: perl-5.24.1/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
 ===================================================================
---- perl-5.14.2.orig/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
-+++ perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
-@@ -55,6 +55,7 @@ sub _unix_os2_ext {
-     my($found) = 0;
+--- perl-5.24.1.orig/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
++++ perl-5.24.1/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+@@ -57,6 +57,7 @@ sub _unix_os2_ext {
+     my ( $found ) = 0;
  
      # Debian-specific: don't use LD_RUN_PATH for standard dirs
 +    push(@libpath, "SYSROOTLIB");
      $ld_run_path_seen{$_}++ for @libpath;
  
-     foreach my $thislib (split ' ', $potential_libs) {
+     foreach my $thislib ( split ' ', $potential_libs ) {
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/installperl.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/installperl.patch
index 4560123..7fd1f50 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/installperl.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/installperl.patch
@@ -1,12 +1,12 @@
 Upstream-Status:Inappropriate [embedded specific]
 
-Index: perl-5.12.3/installperl
+Index: perl-5.24.1/installperl
 ===================================================================
---- perl-5.12.3.orig/installperl
-+++ perl-5.12.3/installperl
-@@ -3,8 +3,8 @@
+--- perl-5.24.1.orig/installperl
++++ perl-5.24.1/installperl
+@@ -2,8 +2,8 @@
+ 
  BEGIN {
-     require 5.004;
      chdir '..' if !-d 'lib' and -d '../lib';
 -    @INC = 'lib';
 -    $ENV{PERL5LIB} = 'lib';
@@ -14,4 +14,4 @@
 +#    $ENV{PERL5LIB} = 'lib';
  
      # This needs to be at BEGIN time, before any use of Config
-     require './install_lib.pl';
+     # install_lib itself loads and imports Config into main::
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/make_ext.pl-fix-regenerate-makefile-failed-while-cc-.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/make_ext.pl-fix-regenerate-makefile-failed-while-cc-.patch
index de6f652..b2c5979 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/make_ext.pl-fix-regenerate-makefile-failed-while-cc-.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/make_ext.pl-fix-regenerate-makefile-failed-while-cc-.patch
@@ -10,10 +10,10 @@
  make_ext.pl | 4 ++++
  1 file changed, 4 insertions(+)
 
-diff --git a/make_ext.pl b/make_ext.pl
-index b433762..9fc1a36 100644
---- a/make_ext.pl
-+++ b/make_ext.pl
+Index: perl-5.24.1/make_ext.pl
+===================================================================
+--- perl-5.24.1.orig/make_ext.pl
++++ perl-5.24.1/make_ext.pl
 @@ -335,6 +335,10 @@ sub build_extension {
                  print "Deleting non-Cross makefile\n";
                  close $mfh or die "close $makefile: $!";
@@ -24,7 +24,4 @@
 +                }
              }
          }
-     }
--- 
-1.8.1.2
-
+     } else {
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-5.26.1-guard_old_libcrypt_fix.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-5.26.1-guard_old_libcrypt_fix.patch
new file mode 100644
index 0000000..ff3d6dc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-5.26.1-guard_old_libcrypt_fix.patch
@@ -0,0 +1,28 @@
+commit 13e70b397dcb0d1bf4a869b670f041c1d7b730d0
+Author: Bjรถrn Esser <besser82@fedoraproject.org>
+Date:   Sat Jan 20 20:22:53 2018 +0100
+
+    pp: Guard fix for really old bug in glibc libcrypt
+
+Upstream-Status: Pending
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+
+diff --git a/pp.c b/pp.c
+index d50ad7ddbf..6510c7b15c 100644
+--- a/pp.c
++++ b/pp.c
+@@ -3650,8 +3650,12 @@ PP(pp_crypt)
+ #if defined(__GLIBC__) || defined(__EMX__)
+ 	if (PL_reentrant_buffer->_crypt_struct_buffer) {
+ 	    PL_reentrant_buffer->_crypt_struct_buffer->initialized = 0;
+-	    /* work around glibc-2.2.5 bug */
++#if (defined(__GLIBC__) && __GLIBC__ == 2) && \
++    (defined(__GLIBC_MINOR__) && __GLIBC_MINOR__ >= 2 && __GLIBC_MINOR__ < 4)
++	    /* work around glibc-2.2.5 bug, has been fixed at some
++	     * time in glibc-2.3.X */
+ 	    PL_reentrant_buffer->_crypt_struct_buffer->current_saltbits = 0;
++#endif
+ 	}
+ #endif
+     }
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-archlib-exp.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-archlib-exp.patch
index d912d00..37bf523 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-archlib-exp.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-archlib-exp.patch
@@ -25,16 +25,16 @@
 
 Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
 
-Index: perl-5.14.2/config_h.SH
+Index: perl-5.24.1/config_h.SH
 ===================================================================
---- perl-5.14.2.orig/config_h.SH
-+++ perl-5.14.2/config_h.SH
-@@ -996,7 +996,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#und
+--- perl-5.24.1.orig/config_h.SH
++++ perl-5.24.1/config_h.SH
+@@ -1434,7 +1434,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#und
   *	in programs that are not prepared to deal with ~ expansion at run-time.
   */
  #$d_archlib ARCHLIB "$archlib"		/**/
 -#$d_archlib ARCHLIB_EXP "$archlibexp"		/**/
 +#$d_archlib ARCHLIB_EXP "$archlib_exp"		/**/
  
- /* ARCHNAME:
-  *	This symbol holds a string representing the architecture name.
+ /* BIN:
+  *	This symbol holds the path of the bin directory where the package will
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-dynloader.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-dynloader.patch
index 035beba..2572067 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-dynloader.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-dynloader.patch
@@ -7,13 +7,13 @@
 
 Update by Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/21
 
-Index: perl-5.14.2/dist/XSLoader/XSLoader_pm.PL
+Index: perl-5.24.1/dist/XSLoader/XSLoader_pm.PL
 ===================================================================
---- perl-5.14.2.orig/dist/XSLoader/XSLoader_pm.PL
-+++ perl-5.14.2/dist/XSLoader/XSLoader_pm.PL
-@@ -28,6 +28,20 @@ sub load {
- 
-     my ($module, $modlibname) = caller();
+--- perl-5.24.1.orig/dist/XSLoader/XSLoader_pm.PL
++++ perl-5.24.1/dist/XSLoader/XSLoader_pm.PL
+@@ -52,6 +52,20 @@ sub load {
+     my ($caller, $modlibname) = caller();
+     my $module = $caller;
  
 +    # OE: Allow env to form dynamic loader to look in a different place
 +    # This is so it finds the host .so files, not the targets
@@ -30,5 +30,5 @@
 +    }
 +
      if (@_) {
- 	$module = $_[0];
+         $module = $_[0];
      } else {
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-enable-gdbm.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-enable-gdbm.patch
deleted file mode 100644
index aa83fca..0000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-enable-gdbm.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Upstream-Status:Inappropriate [embedded specific]
-
-Index: perl-5.8.8/config_h.SH
-===================================================================
---- perl-5.8.8.orig/config_h.SH	2005-11-01 02:13:05.000000000 +0800
-+++ perl-5.8.8/config_h.SH	2010-11-01 17:06:07.215219738 +0800
-@@ -709,6 +709,12 @@
-  */
- #$i_float I_FLOAT		/**/
- 
-+/* I_GDBM:
-+ *      This symbol, if defined, indicates that <gdbm.h> exists and should
-+ *      be included.
-+ */
-+#$i_gdbm I_GDBM /**/
-+
- /* I_LIMITS:
-  *	This symbol, if defined, indicates to the C program that it should
-  *	include <limits.h> to get definition of symbols like WORD_BIT or
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-test-customized.patch b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-test-customized.patch
index 90e4dcd..1d9a56d 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-test-customized.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl/perl-test-customized.patch
@@ -32,7 +32,7 @@
  ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm 0e1e4c25eddb999fec6c4dc66593f76db34cfd16
 -ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm bfd2aa00ca4ed251f342e1d1ad704abbaf5a615e
 -ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 5529ae3064365eafd99536621305d52f4ab31b45
-+ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm d593d8fdc5c0ebcb6d3701c70fc6640c50d93455
++ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm f1ca5ec247eb69ba13a269f34dc205da37b61244
 +ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm bf9174c70a0e50ff2fee4552c7df89b37d292da1
  ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm bc88b275af73b8faac6abd59a9aad3f625925810
  ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod 062e5d14a803fbbec8d61803086a3d7997e8a473
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl_5.24.1.bb b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl_5.24.1.bb
index b55d222..91f310d 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/perl/perl_5.24.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/perl/perl_5.24.1.bb
@@ -1,8 +1,7 @@
 require perl.inc
 
 # We need gnugrep (for -I)
-DEPENDS = "virtual/db grep-native"
-DEPENDS += "gdbm zlib"
+DEPENDS = "db grep-native gdbm zlib virtual/crypt"
 
 # Pick up patches from debian
 # http://ftp.de.debian.org/debian/pool/main/p/perl/perl_5.22.0-1.debian.tar.xz
@@ -46,7 +45,6 @@
         file://letgcc-find-errno.patch \
         file://generate-sh.patch \
         file://native-perlinc.patch \
-        file://perl-enable-gdbm.patch \
         file://cross-generate_uudmap.patch \
         file://fix_bad_rpath.patch \
         file://dynaloaderhack.patch \
@@ -65,6 +63,9 @@
         file://perl-errno-generation-gcc5.patch \
         file://perl-fix-conflict-between-skip_all-and-END.patch \
         file://perl-test-customized.patch \
+        file://perl-5.26.1-guard_old_libcrypt_fix.patch \
+        file://CVE-2017-12883.patch \
+        file://CVE-2017-12837.patch \
 "
 
 # Fix test case issues
@@ -189,6 +190,19 @@
         oe_runmake perl LD="${CCLD}"
 }
 
+do_compile_append_class-target() {
+        # Remove build host references from numerous comments...
+        find "${S}/cpan/Encode" -type f \
+            \( -name '*.exh' -o -name '*.c' -o -name '*.h' \)\
+            -exec sed -i -e 's:${RECIPE_SYSROOT_NATIVE}::g' {} +
+        sed -i -e 's:${RECIPE_SYSROOT}::g' ${S}/perl.h ${S}/pp.h
+        sed -i -e 's:${RECIPE_SYSROOT_NATIVE}/usr/bin/perl-native/perl${PV}.real:/usr/bin/perl${PV}:g'  \
+            ${S}/cpan/Compress-Raw-Bzip2/constants.h \
+            ${S}/cpan/Compress-Raw-Zlib/constants.h \
+            ${S}/cpan/IPC-SysV/const-c.inc \
+            ${S}/dist/Time-HiRes/const-c.inc
+}
+
 do_install() {
 	#export hostperl="${STAGING_BINDIR_NATIVE}/perl-native/perl${PV}"
 	oe_runmake install DESTDIR=${D}
@@ -232,6 +246,7 @@
                -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
                -e "s,${STAGING_BINDIR_NATIVE}/,,g" \
                -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
+               -e 's:${RECIPE_SYSROOT}::g' \
             ${PKGD}${bindir}/h2xs \
             ${PKGD}${bindir}/h2ph \
             ${PKGD}${bindir}/pod2man \
@@ -267,6 +282,7 @@
 FILES_${PN}-lib = "${libdir}/libperl.so* \
                    ${libdir}/perl5 \
                    ${libdir}/perl/config.sh \
+		   ${libdir}/perl/${PV}/Config_git.pl \
                    ${libdir}/perl/${PV}/Config_heavy.pl \
                    ${libdir}/perl/${PV}/Config_heavy-target.pl"
 FILES_${PN}-pod = "${libdir}/perl/${PV}/pod \
@@ -324,7 +340,7 @@
     d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
 }
 
-PACKAGES_DYNAMIC += "^perl-module-.*"
+PACKAGES_DYNAMIC += "^perl-module-.*(?<!\-native)$"
 PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
 
 RPROVIDES_perl-lib = "perl-lib"