Squashed 'yocto-poky/' changes from ea562de..7b86c77

7b86c77 bitbake: bitbake: bb.fetch2.git: Import errno module
e993aa6 bitbake: toaster: hide irrelevant builds in the project builds view
5b4e380 bitbake: data_smart: Ensure OVERRIDES dependencies account for contains()
60d019d bitbake: data_smart: Correctly handle OVERRIDE values set using ??=
701ad76 bitbake: data_smart: When considering OVERRIDE dependencies, do so recursively
4325f6f bitbake: data_smart: Expand overrides cache recursively
3a5e46b bitbake: bb.fetch2.{git, hg}: remove tarball if it needs updating
441f04c bitbake: toaster: Simplify redirects when build page parameters are missing
30f9f79 bitbake: toaster: Fix date range pickers on the project builds page
047245f bitbake: toaster: Show correct builds count on project pages
5528f3a bitbake: toaster: hide irrelevant builds in the project builds view
2bb600a bitbake: tests/fetch.py: Fix recursion failure in url mapping
4c3d4ec bitbake: fetch2/__init__.py: uri_replace regex handling
460e4c2 bitbake: toaster: Don't def a function for each call to build_artifact()
b6d1d2a bitbake: toaster: Avoid unnecessary local to local copy of cooker log
8c63d60 bitbake: toaster: Read correct cooker log path from toasterui
013c030 bitbake: toaster: delete multiple builds cleanup
3165af3 bitbake: data_smart: Separate out update_overridevars into separate function
07aef86 bitbake: cache: Handle spaces and colons in directory names for file-checksums
9679500 autotools.bbclass: mkdir ${B} -> mkdir -p ${B}
c30ee2a perf: mkdir ${B} -> mkdir -p ${B}
d18612a recipetool: add 'newappend' sub-command
4727384 oeqa/sstatetests: Add test for nativesdk stamp invariance with MACHINE
56b2c53 glibc: Ensure OVERRIDES doesn't influence sstate checksum
1884550 image.py: Ensure base image size is an integer
ec72426 python: Add python-misc as rdependency to python-modules
c170f35 cryptodev-tests: don't use STAGING_KERNEL_DIR, fix re-packaging in multi-machine builds
2d7fe03 adwaita-icon-theme: RREPLACE gnome-icon-theme
94d280f mkelfimage: fix owner for /usr/sbin/mkelfImage
3323c3f nspr: fix SRC_URI
935a8bd mkefidisk: Create interactive menu for the script
6c05e6a image.bbclass: add do_rootfs vardeps for {COMPRESS, IMAGE}_CMD_*
82be1f3 squashfs-tools: make it be able to be compiled by gcc5 with "-O0"
dc3bc22 linux-firmware: package Broadcom BCM4354 firmware
db8f796 perf: fix the install-python_ext on upstream kernel
bfe2cd1 systemd: fix missing space in SRC_URI append
2515cf2 python: remove --with-wctype-functions configure option
17f5a5a kmod: fix link creation when base_bindir != /bin
e2cfe93 prelink: Move to latest release
32472dc glibc: don't require bash for nscd init script
d8eb9d4 oeqa/decorators: Added decorator to restart the DUT in case of test hang.
5acf99d init-install-efi.sh: Avoid /mnt/mtab creation if already present

git-subtree-dir: yocto-poky
git-subtree-split: 7b86c771c80d0759c2ca0e57c46c4c966f89c49e
diff --git a/scripts/lib/recipetool/newappend.py b/scripts/lib/recipetool/newappend.py
new file mode 100644
index 0000000..77b74cb
--- /dev/null
+++ b/scripts/lib/recipetool/newappend.py
@@ -0,0 +1,111 @@
+# Recipe creation tool - newappend plugin
+#
+# This sub-command creates a bbappend for the specified target and prints the
+# path to the bbappend.
+#
+# Example: recipetool newappend meta-mylayer busybox
+#
+# Copyright (C) 2015 Christopher Larson <kergoth@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# 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, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import argparse
+import errno
+import logging
+import os
+import re
+import sys
+
+
+logger = logging.getLogger('recipetool')
+tinfoil = None
+
+
+def plugin_init(pluginlist):
+    # Don't need to do anything here right now, but plugins must have this function defined
+    pass
+
+
+def tinfoil_init(instance):
+    global tinfoil
+    tinfoil = instance
+
+
+def _provide_to_pn(cooker, provide):
+    """Get the name of the preferred recipe for the specified provide."""
+    import bb.providers
+    filenames = cooker.recipecache.providers[provide]
+    eligible, foundUnique = bb.providers.filterProviders(filenames, provide, cooker.expanded_data, cooker.recipecache)
+    filename = eligible[0]
+    pn = cooker.recipecache.pkg_fn[filename]
+    return pn
+
+
+def _get_recipe_file(cooker, pn):
+    import oe.recipeutils
+    recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
+    if not recipefile:
+        skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
+        if skipreasons:
+            logger.error('\n'.join(skipreasons))
+        else:
+            logger.error("Unable to find any recipe file matching %s" % pn)
+    return recipefile
+
+
+def layer(layerpath):
+    if not os.path.exists(os.path.join(layerpath, 'conf', 'layer.conf')):
+        raise argparse.ArgumentTypeError('{0!r} must be a path to a valid layer'.format(layerpath))
+    return layerpath
+
+
+def newappend(args):
+    import oe.recipeutils
+
+    pn = _provide_to_pn(tinfoil.cooker, args.target)
+    recipe_path = _get_recipe_file(tinfoil.cooker, pn)
+
+    rd = tinfoil.config_data.createCopy()
+    rd.setVar('FILE', recipe_path)
+    append_path, path_ok = oe.recipeutils.get_bbappend_path(rd, args.destlayer, args.wildcard_version)
+    if not append_path:
+        logger.error('Unable to determine layer directory containing %s', recipe_path)
+        return 1
+
+    if not path_ok:
+        logger.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(destlayerdir, 'conf', 'layer.conf'), os.path.dirname(appendpath))
+
+    layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS', True).split()]
+    if not os.path.abspath(args.destlayer) in layerdirs:
+        logger.warn('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active')
+
+    if not os.path.exists(append_path):
+        bb.utils.mkdirhier(os.path.dirname(append_path))
+
+        try:
+            open(append_path, 'a')
+        except (OSError, IOError) as exc:
+            logger.critical(str(exc))
+            return 1
+
+    print(append_path)
+
+
+def register_command(subparsers):
+    parser = subparsers.add_parser('newappend',
+                                   help='Create a bbappend for the specified target in the specified layer')
+    parser.add_argument('-w', '--wildcard-version', help='Use wildcard to make the bbappend apply to any recipe version', action='store_true')
+    parser.add_argument('destlayer', help='Base directory of the destination layer to write the bbappend to', type=layer)
+    parser.add_argument('target', help='Target recipe/provide to append')
+    parser.set_defaults(func=newappend, parserecipes=True)