Yocto 2.3

Move OpenBMC to Yocto 2.3(pyro).

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I50744030e771f4850afc2a93a10d3507e76d36bc
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Resolves: openbmc/openbmc#2461
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg.inc b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg.inc
index e8d8a9b..fe4732d 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg.inc
+++ b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg.inc
@@ -4,43 +4,39 @@
 
 DEPENDS = "zlib bzip2 perl ncurses"
 DEPENDS_class-native = "bzip2-replacement-native zlib-native virtual/update-alternatives-native gettext-native perl-native"
-RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives} xz run-postinsts perl"
-RDEPENDS_${PN}_class-native = "xz-native"
+RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives} perl"
+RDEPENDS_${PN}_class-native = ""
 
 UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/d/dpkg/"
 
-inherit autotools gettext perlnative pkgconfig systemd
+inherit autotools gettext perlnative pkgconfig systemd perl-version
 
 python () {
     if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
-        pn = d.getVar('PN', True)
+        pn = d.getVar('PN')
         d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'dpkg-configure.service')
 }
 
 export PERL = "${bindir}/perl"
 PERL_class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl"
 
-export PERL_LIBDIR = "${libdir}/perl"
-PERL_LIBDIR_class-native = "${libdir}/perl-native/perl"
+export PERL_LIBDIR = "${libdir}/perl/${@get_perl_version(d)}"
+PERL_LIBDIR_class-native = "${libdir}/perl-native/perl/${@get_perl_version(d)}"
 
 EXTRA_OECONF = "\
 		--disable-dselect \
 		--enable-start-stop-daemon \
-		--with-zlib \
-		--with-bz2 \
-		--without-liblzma \
-		--without-selinux \
+		--with-libz \
+		--with-libbz2 \
+		--without-libselinux \
 		"
 
+PACKAGECONFIG = "liblzma"
+PACKAGECONFIG[liblzma] = "--with-liblzma,--without-liblzma, xz"
+
 EXTRA_OECONF += "TAR=tar"
 EXTRA_OECONF_append_class-target = " DEB_HOST_ARCH=${DPKG_ARCH}"
 
-do_configure () {
-    echo >> ${S}/m4/compiler.m4
-    sed -i -e 's#PERL_LIBDIR=.*$#PERL_LIBDIR="${libdir}/perl"#' ${S}/configure
-    autotools_do_configure
-}
-
 do_install_append () {
 	if [ "${PN}" = "dpkg-native" ]; then
 		# update-alternatives doesn't have an offline mode
@@ -71,7 +67,26 @@
 RPROVIDES_update-alternatives-dpkg += "update-alternatives"
 
 PACKAGES += "${PN}-perl"
-FILES_${PN}-perl = "${libdir}/perl"
+FILES_${PN}-perl = "${libdir}/perl/${@get_perl_version(d)}"
+
+RDEPENDS_${PN}-perl += "perl-module-carp perl-module-constant \
+                        perl-module-cwd perl-module-digest \
+                        perl-module-digest-md5 perl-module-errno \
+                        perl-module-exporter perl-module-fcntl \
+                        perl-module-feature perl-module-file-basename \
+                        perl-module-file-compare perl-module-file-copy \
+                        perl-module-file-find perl-module-file-path \
+                        perl-module-file-spec perl-module-file-temp \
+                        perl-module-list-util perl-module-overload \
+                        perl-module-parent perl-module-storable \
+                        perl-module-filehandle perl-module-io \
+                        perl-module-io-handle perl-module-io-seekable \
+                        perl-module-posix perl-module-scalar-util \
+                        perl-module-selectsaver perl-module-symbol \
+                        perl-module-term-ansicolor perl-module-tie-handle \
+                        perl-module-tie-hash perl-module-storable \
+                        perl-module-time-hires perl-module-time-piece \
+                        perl-module-xsloader"
 
 # Split out start-stop-daemon to its own package.  Note that it
 # is installed in a different directory than the one used for
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
index 80504ce..93d8704 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch
@@ -9,27 +9,32 @@
 
 RP 2011/12/07
 ALIMON 2016/05/26
-
+ALIMON 2017/02/21
 ---
- src/script.c | 39 +++------------------------------------
- 1 file changed, 3 insertions(+), 36 deletions(-)
+ src/script.c | 44 +++-----------------------------------------
+ 1 file changed, 3 insertions(+), 41 deletions(-)
 
 diff --git a/src/script.c b/src/script.c
-index 3c88be8..ce66a86 100644
+index 2f252ae..768a9d1 100644
 --- a/src/script.c
 +++ b/src/script.c
-@@ -97,43 +97,10 @@ setexecute(const char *path, struct stat *stab)
+@@ -97,48 +97,10 @@ setexecute(const char *path, struct stat *stab)
  static const char *
  maintscript_pre_exec(struct command *cmd)
  {
 -	const char *admindir = dpkg_db_get_dir();
--	const char *changedir = fc_script_chrootless ? instdir : "/";
--	size_t instdirl = strlen(instdir);
+-	const char *changedir;
+-	size_t instdirlen = strlen(instdir);
 -
--	if (*instdir && !fc_script_chrootless) {
--		if (strncmp(admindir, instdir, instdirl) != 0)
+-	if (instdirlen > 0 && fc_script_chrootless)
+-		changedir = instdir;
+-	else
+-		changedir = "/";
+-
+-	if (instdirlen > 0 && !fc_script_chrootless) {
+-		if (strncmp(admindir, instdir, instdirlen) != 0)
 -			ohshit(_("admindir must be inside instdir for dpkg to work properly"));
--		if (setenv("DPKG_ADMINDIR", admindir + instdirl, 1) < 0)
+-		if (setenv("DPKG_ADMINDIR", admindir + instdirlen, 1) < 0)
 -			ohshite(_("unable to setenv for subprocesses"));
 -		if (setenv("DPKG_ROOT", "", 1) < 0)
 -			ohshite(_("unable to setenv for subprocesses"));
@@ -56,11 +61,11 @@
 -		      args.buf);
 -		varbuf_destroy(&args);
 -	}
--	if (!instdirl || fc_script_chrootless)
+-	if (instdirlen == 0 || fc_script_chrootless)
 -		return cmd->filename;
 -
--	assert(strlen(cmd->filename) >= instdirl);
--	return cmd->filename + instdirl;
+-	assert(strlen(cmd->filename) >= instdirlen);
+-	return cmd->filename + instdirlen;
 +	return cmd->filename;
  }
  
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch
new file mode 100644
index 0000000..8bfaad1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg/0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch
@@ -0,0 +1,40 @@
+From 8659eeeeda74d71e12080121f0b13a88cbdda433 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
+Date: Tue, 21 Feb 2017 11:23:27 -0600
+Subject: [PATCH] dpkg-deb/build.c: Remove usage of --clamp-mtime in tar
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Recently dpkg added --clamp-mtime to tar to create reproducible
+build tarballs [1].
+
+But host tools doesn't support this option because is new on tar
+so disable in our builds.
+
+Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
+
+Upstream-Status: Inappropriate [Configuration]
+
+[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759999#20
+[2] https://lists.gnu.org/archive/html/help-tar/2016-01/msg00000.html
+---
+ dpkg-deb/build.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
+index 655aa55..927f56f 100644
+--- a/dpkg-deb/build.c
++++ b/dpkg-deb/build.c
+@@ -447,7 +447,7 @@ tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder,
+     snprintf(mtime, sizeof(mtime), "@%ld", timestamp);
+ 
+     execlp(TAR, "tar", "-cf", "-", "--format=gnu",
+-                       "--mtime", mtime, "--clamp-mtime",
++                       "--mtime", mtime,
+                        "--null", "--no-unquote",
+                        "--no-recursion", "-T", "-", NULL);
+     ohshite(_("unable to execute %s (%s)"), "tar -cf", TAR);
+-- 
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg_1.18.7.bb b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg_1.18.10.bb
similarity index 69%
rename from import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg_1.18.7.bb
rename to import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg_1.18.10.bb
index 28fdc13..21385af 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg_1.18.7.bb
+++ b/import-layers/yocto-poky/meta/recipes-devtools/dpkg/dpkg_1.18.10.bb
@@ -1,7 +1,7 @@
 require dpkg.inc
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 
-SRC_URI = "http://snapshot.debian.org/archive/debian/20160509T100042Z/pool/main/d/${BPN}/${BPN}_${PV}.tar.xz \
+SRC_URI = "http://snapshot.debian.org/archive/debian/20160731T221931Z/pool/main/d/${BPN}/${BPN}_${PV}.tar.xz \
            file://noman.patch \
            file://remove-tar-no-timestamp.patch \
            file://arch_pm.patch \
@@ -12,8 +12,9 @@
            file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \
            file://0005-dpkg-compiler.m4-remove-Wvla.patch \
            file://0006-add-musleabi-to-known-target-tripets.patch \
+           file://0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch \
            "
 SRC_URI_append_class-native = " file://glibc2.5-sync_file_range.patch "
 
-SRC_URI[md5sum] = "073dbf2129a54b0fc627464bf8af4a1b"
-SRC_URI[sha256sum] = "ace36d3a6dc750a42baf797f9e75ec580a21f92bb9ff96b482100755d6d9b87b"
+SRC_URI[md5sum] = "ccff17730c0964428fc186ded2f2f401"
+SRC_URI[sha256sum] = "025524da41ba18b183ff11e388eb8686f7cc58ee835ed7d48bd159c46a8b6dc5"