Squashed 'yocto-poky/' content from commit ea562de

git-subtree-dir: yocto-poky
git-subtree-split: ea562de57590c966cd5a75fda8defecd397e6436
diff --git a/meta/recipes-devtools/opkg/opkg-arch-config_1.0.bb b/meta/recipes-devtools/opkg/opkg-arch-config_1.0.bb
new file mode 100644
index 0000000..ace3de4
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg-arch-config_1.0.bb
@@ -0,0 +1,35 @@
+SUMMARY = "Architecture-dependent configuration for opkg"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+PR = "r1"
+
+S = "${WORKDIR}"
+
+do_compile() {
+	mkdir -p ${S}/${sysconfdir}/opkg/
+
+	archconf=${S}/${sysconfdir}/opkg/arch.conf
+
+	rm -f $archconf
+	ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}"
+	priority=1
+	for arch in $ipkgarchs; do 
+		echo "arch $arch $priority" >> $archconf
+		priority=$(expr $priority + 5)
+	done
+}
+
+
+do_install () {
+	install -d ${D}${sysconfdir}/opkg
+	install -m 0644  ${S}/${sysconfdir}/opkg/* ${D}${sysconfdir}/opkg/
+}
+
+FILES_${PN} = "${sysconfdir}/opkg/ "
+
+CONFFILES_${PN} += "${sysconfdir}/opkg/arch.conf"
+
+RREPLACES_${PN} = "opkg-config-base"
+RCONFLICTS_${PN} = "opkg-config-base"
+RPROVIDES_${PN} = "opkg-config-base"
diff --git a/meta/recipes-devtools/opkg/opkg-keyrings_1.0.bb b/meta/recipes-devtools/opkg/opkg-keyrings_1.0.bb
new file mode 100644
index 0000000..18d6abd
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg-keyrings_1.0.bb
@@ -0,0 +1,48 @@
+SUMMARY = "Keyrings for verifying opkg packages and feeds"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+# Distro-specific keys can be added to this package in two ways:
+#
+#   1) In a .bbappend, add .gpg and/or .asc files to SRC_URI and install them to
+#      ${D}${datadir}/opkg/keyrings/ in a do_install_append function. These
+#      files should not be named 'key-$name.gpg' to ensure they don't conflict
+#      with keys exported as per (2).
+#
+#   2) In a .bbappend, distro config or local.conf, override the variable
+#      OPKG_KEYRING_KEYS to contain a space-separated list of key names. For
+#      each name, 'gpg --export $name' will be ran to export the public key to a
+#      file named 'key-$name.gpg'. The public key must therefore be in the gpg
+#      keyrings on the build machine.
+
+OPKG_KEYRING_KEYS ?= ""
+
+do_compile() {
+    for name in ${OPKG_KEYRING_KEYS}; do
+        gpg --export ${name} > ${B}/key-${name}.gpg
+    done
+}
+
+do_install () {
+    install -d ${D}${datadir}/opkg/keyrings/
+    for name in ${OPKG_KEYRING_KEYS}; do
+        install -m 0644 ${B}/key-${name}.gpg ${D}${datadir}/opkg/keyrings/
+    done
+}
+
+FILES_${PN} = "${datadir}/opkg/keyrings"
+
+# We need 'opkg-key' to run the postinst script
+RDEPENDS_${PN} = "opkg"
+
+pkg_postinst_${PN} () {
+#! /bin/sh
+set -e
+
+if [ x"$D" = "x" ]; then
+    # On target
+    opkg-key populate
+else
+    exit 1
+fi
+}
diff --git a/meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch b/meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch
new file mode 100644
index 0000000..dabd196
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch
@@ -0,0 +1,64 @@
+From bd32bb8646459508bb0b0ce54a14bd6fe0e19b75 Mon Sep 17 00:00:00 2001
+From: Alejandro del Castillo <alejandro.delcastillo@ni.com>
+Date: Thu, 27 Aug 2015 15:52:16 -0500
+Subject: [PATCH] opkg_archive: add support for empty compressed files
+
+Regression from 0.2.x: opkg used to support empty Package.gz files.
+
+Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
+
+Upstream-Status: Accepted
+---
+ libopkg/opkg_archive.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c
+index be903e4..7e91e48 100644
+--- a/libopkg/opkg_archive.c
++++ b/libopkg/opkg_archive.c
+@@ -121,6 +121,9 @@ static int copy_to_stream(struct archive *a, FILE * stream)
+     int eof;
+     size_t len = EXTRACT_BUFFER_LEN;
+ 
++    if (archive_format(a) == ARCHIVE_FORMAT_EMPTY)
++        return 0;
++
+     buffer = xmalloc(len);
+ 
+     while (1) {
+@@ -654,6 +657,13 @@ static struct archive *open_compressed_file(const char *filename)
+         goto err_cleanup;
+     }
+ 
++    r = archive_read_support_format_empty(ar);
++    if (r != ARCHIVE_OK) {
++        opkg_msg(ERROR, "Empty format not supported: %s\n",
++                 archive_error_string(ar));
++        goto err_cleanup;
++    }
++
+     /* Open input file and prepare for reading. */
+     r = archive_read_open_filename(ar, filename, EXTRACT_BUFFER_LEN);
+     if (r != ARCHIVE_OK) {
+@@ -723,6 +733,7 @@ struct opkg_ar *ar_open_compressed_file(const char *filename)
+ {
+     struct opkg_ar *ar;
+     struct archive_entry *entry;
++    int eof;
+ 
+     ar = (struct opkg_ar *)xmalloc(sizeof(struct opkg_ar));
+ 
+@@ -737,8 +748,8 @@ struct opkg_ar *ar_open_compressed_file(const char *filename)
+      * header. We skip over this header here so that the caller doesn't need
+      * to know about it.
+      */
+-    entry = read_header(ar->ar, NULL);
+-    if (!entry)
++    entry = read_header(ar->ar, &eof);
++    if (!entry && !eof)
+         goto err_cleanup;
+ 
+     return ar;
+-- 
+1.9.1
+
diff --git a/meta/recipes-devtools/opkg/opkg/opkg-configure.service b/meta/recipes-devtools/opkg/opkg/opkg-configure.service
new file mode 100644
index 0000000..8e74026
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/opkg-configure.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Opkg first boot configure
+DefaultDependencies=no
+After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
+Before=sysinit.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-@SYSCONFDIR@/default/postinst
+ExecStart=-@BASE_BINDIR@/sh -c " if [ $POSTINST_LOGGING = '1' ]; then @BINDIR@/opkg configure > $LOGFILE 2>&1; else @BINDIR@/opkg configure; fi"
+ExecStartPost=@BASE_BINDIR@/systemctl disable opkg-configure.service
+StandardOutput=syslog
+RemainAfterExit=No
+
+[Install]
+WantedBy=basic.target
+WantedBy=sysinit.target
diff --git a/meta/recipes-devtools/opkg/opkg/opkg.conf b/meta/recipes-devtools/opkg/opkg/opkg.conf
new file mode 100644
index 0000000..c2e9e92
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/opkg.conf
@@ -0,0 +1,28 @@
+# Must have one or more source entries of the form:
+#
+#   src <src-name> <source-url>
+#
+# and one or more destination entries of the form:
+#
+#   dest <dest-name> <target-path>
+#
+# where <src-name> and <dest-names> are identifiers that
+# should match [a-zA-Z0-9._-]+, <source-url> should be a
+# URL that points to a directory containing a Familiar
+# Packages file, and <target-path> should be a directory
+# that exists on the target system.
+
+# Proxy Support
+#option http_proxy http://proxy.tld:3128
+#option ftp_proxy http://proxy.tld:3128
+#option proxy_username <username>
+#option proxy_password <password>
+
+# Enable GPGME signature
+# option check_signature 1
+
+# Offline mode (for use in constructing flash images offline)
+#option offline_root target
+
+# Default destination for installed packages
+dest root /
diff --git a/meta/recipes-devtools/opkg/opkg_0.3.0.bb b/meta/recipes-devtools/opkg/opkg_0.3.0.bb
new file mode 100644
index 0000000..f4dbb2d
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg_0.3.0.bb
@@ -0,0 +1,72 @@
+SUMMARY = "Open Package Manager"
+SUMMARY_libopkg = "Open Package Manager library"
+SECTION = "base"
+HOMEPAGE = "http://code.google.com/p/opkg/"
+BUGTRACKER = "http://code.google.com/p/opkg/issues/list"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+                    file://src/opkg.c;beginline=2;endline=21;md5=90435a519c6ea69ef22e4a88bcc52fa0"
+
+DEPENDS = "libarchive"
+
+PE = "1"
+
+SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \
+           file://opkg-configure.service \
+           file://opkg.conf \
+           file://0001-opkg_archive-add-support-for-empty-compressed-files.patch \
+"
+
+SRC_URI[md5sum] = "3412cdc71d78b98facc84b19331ec64e"
+SRC_URI[sha256sum] = "7f735d1cdb8ef3718fb0f9fba44ca0d9a5c90d3a7f014f37a6d2f9474f54988f"
+
+inherit autotools pkgconfig systemd
+
+SYSTEMD_SERVICE_${PN} = "opkg-configure.service"
+
+target_localstatedir := "${localstatedir}"
+OPKGLIBDIR = "${target_localstatedir}/lib"
+
+PACKAGECONFIG ??= ""
+
+PACKAGECONFIG[gpg] = "--enable-gpg,--disable-gpg,gpgme libgpg-error,gnupg"
+PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl"
+PACKAGECONFIG[ssl-curl] = "--enable-ssl-curl,--disable-ssl-curl,curl openssl"
+PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
+PACKAGECONFIG[sha256] = "--enable-sha256,--disable-sha256"
+PACKAGECONFIG[pathfinder] = "--enable-pathfinder,--disable-pathfinder,pathfinder"
+
+do_install_append () {
+	install -d ${D}${sysconfdir}/opkg
+	install -m 0644 ${WORKDIR}/opkg.conf ${D}${sysconfdir}/opkg/opkg.conf
+	echo "option lists_dir ${OPKGLIBDIR}/opkg/lists" >>${D}${sysconfdir}/opkg/opkg.conf
+
+	# We need to create the lock directory
+	install -d ${D}${OPKGLIBDIR}/opkg
+
+	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
+		install -d ${D}${systemd_unitdir}/system
+		install -m 0644 ${WORKDIR}/opkg-configure.service ${D}${systemd_unitdir}/system/
+		sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
+			-e 's,@SYSCONFDIR@,${sysconfdir},g' \
+			-e 's,@BINDIR@,${bindir},g' \
+			-e 's,@SYSTEMD_UNITDIR@,${systemd_unitdir},g' \
+			${D}${systemd_unitdir}/system/opkg-configure.service
+	fi
+}
+
+RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives} opkg-arch-config run-postinsts libarchive"
+RDEPENDS_${PN}_class-native = ""
+RDEPENDS_${PN}_class-nativesdk = ""
+RREPLACES_${PN} = "opkg-nogpg opkg-collateral"
+RCONFLICTS_${PN} = "opkg-collateral"
+RPROVIDES_${PN} = "opkg-collateral"
+
+PACKAGES =+ "libopkg"
+
+FILES_libopkg = "${libdir}/*.so.* ${OPKGLIBDIR}/opkg/"
+FILES_${PN} += "${systemd_unitdir}/system/"
+
+BBCLASSEXTEND = "native nativesdk"
+
+CONFFILES_${PN} = "${sysconfdir}/opkg/opkg.conf"