diff options
author | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
---|---|---|
committer | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
commit | 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch) | |
tree | cd70a267a5ef105ba32f200aa088e281fbd85747 /external/poky/bitbake/lib/bblayers | |
parent | 4204309872da5cb401cbb2729d9e2d4869a87f42 (diff) |
basesystem-jjsandbox/ToshikazuOhiwa/master-jj
recipes
Diffstat (limited to 'external/poky/bitbake/lib/bblayers')
-rw-r--r-- | external/poky/bitbake/lib/bblayers/__init__.py | 4 | ||||
-rw-r--r-- | external/poky/bitbake/lib/bblayers/action.py | 4 | ||||
-rw-r--r-- | external/poky/bitbake/lib/bblayers/common.py | 6 | ||||
-rw-r--r-- | external/poky/bitbake/lib/bblayers/layerindex.py | 21 | ||||
-rw-r--r-- | external/poky/bitbake/lib/bblayers/query.py | 57 |
5 files changed, 68 insertions, 24 deletions
diff --git a/external/poky/bitbake/lib/bblayers/__init__.py b/external/poky/bitbake/lib/bblayers/__init__.py index 3ad9513f..4e7c09da 100644 --- a/external/poky/bitbake/lib/bblayers/__init__.py +++ b/external/poky/bitbake/lib/bblayers/__init__.py @@ -1,2 +1,6 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# + from pkgutil import extend_path __path__ = extend_path(__path__, __name__) diff --git a/external/poky/bitbake/lib/bblayers/action.py b/external/poky/bitbake/lib/bblayers/action.py index a3f658f9..d6459d66 100644 --- a/external/poky/bitbake/lib/bblayers/action.py +++ b/external/poky/bitbake/lib/bblayers/action.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# + import fnmatch import logging import os diff --git a/external/poky/bitbake/lib/bblayers/common.py b/external/poky/bitbake/lib/bblayers/common.py index 98515ced..6c76ef35 100644 --- a/external/poky/bitbake/lib/bblayers/common.py +++ b/external/poky/bitbake/lib/bblayers/common.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# + import argparse import logging import os @@ -13,7 +17,7 @@ class LayerPlugin(): def tinfoil_init(self, tinfoil): self.tinfoil = tinfoil self.bblayers = (self.tinfoil.config_data.getVar('BBLAYERS') or "").split() - layerconfs = self.tinfoil.config_data.varhistory.get_variable_items_files('BBFILE_COLLECTIONS', self.tinfoil.config_data) + layerconfs = self.tinfoil.config_data.varhistory.get_variable_items_files('BBFILE_COLLECTIONS') self.bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.items()} @staticmethod diff --git a/external/poky/bitbake/lib/bblayers/layerindex.py b/external/poky/bitbake/lib/bblayers/layerindex.py index b2ff2268..95b67a66 100644 --- a/external/poky/bitbake/lib/bblayers/layerindex.py +++ b/external/poky/bitbake/lib/bblayers/layerindex.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# + import layerindexlib import argparse @@ -20,7 +24,7 @@ class LayerIndexPlugin(ActionPlugin): This class inherits ActionPlugin to get do_add_layer. """ - def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer): + def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer, branch, shallow=False): layername = self.get_layer_name(url) if os.path.splitext(layername)[1] == '.git': layername = os.path.splitext(layername)[0] @@ -28,9 +32,15 @@ class LayerIndexPlugin(ActionPlugin): layerdir = os.path.join(repodir, subdir) if not os.path.exists(repodir): if fetch_layer: - result = subprocess.call(['git', 'clone', url, repodir]) + cmd = ['git', 'clone'] + if shallow: + cmd.extend(['--depth', '1']) + if branch: + cmd.extend(['-b' , branch]) + cmd.extend([url, repodir]) + result = subprocess.call(cmd) if result: - logger.error("Failed to download %s" % url) + logger.error("Failed to download %s (%s)" % (url, branch)) return None, None, None else: return subdir, layername, layerdir @@ -167,7 +177,9 @@ class LayerIndexPlugin(ActionPlugin): subdir, name, layerdir = self.get_fetch_layer(fetchdir, layerBranch.layer.vcs_url, layerBranch.vcs_subdir, - not args.show_only) + not args.show_only, + layerBranch.actual_branch, + args.shallow) if not name: # Error already shown return 1 @@ -200,6 +212,7 @@ class LayerIndexPlugin(ActionPlugin): parser_layerindex_fetch = self.add_command(sp, 'layerindex-fetch', self.do_layerindex_fetch, parserecipes=False) parser_layerindex_fetch.add_argument('-n', '--show-only', help='show dependencies and do nothing else', action='store_true') parser_layerindex_fetch.add_argument('-b', '--branch', help='branch name to fetch') + parser_layerindex_fetch.add_argument('-s', '--shallow', help='do only shallow clones (--depth=1)', action='store_true') parser_layerindex_fetch.add_argument('-i', '--ignore', help='assume the specified layers do not need to be fetched/added (separate multiple layers with commas, no spaces)', metavar='LAYER') parser_layerindex_fetch.add_argument('layername', nargs='+', help='layer to fetch') diff --git a/external/poky/bitbake/lib/bblayers/query.py b/external/poky/bitbake/lib/bblayers/query.py index 9294dfa8..e2cc3105 100644 --- a/external/poky/bitbake/lib/bblayers/query.py +++ b/external/poky/bitbake/lib/bblayers/query.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# + import collections import fnmatch import logging @@ -42,7 +46,7 @@ layer, with the preferred version first. Note that skipped recipes that are overlayed will also be listed, with a " (skipped)" suffix. """ - items_listed = self.list_recipes('Overlayed recipes', None, True, args.same_version, args.filenames, True, None) + items_listed = self.list_recipes('Overlayed recipes', None, True, args.same_version, args.filenames, False, True, None, False, None, args.mc) # Check for overlayed .bbclass files classes = collections.defaultdict(list) @@ -108,9 +112,9 @@ skipped recipes will also be listed, with a " (skipped)" suffix. title = 'Matching recipes:' else: title = 'Available recipes:' - self.list_recipes(title, args.pnspec, False, False, args.filenames, args.multiple, inheritlist) + self.list_recipes(title, args.pnspec, False, False, args.filenames, args.recipes_only, args.multiple, args.layer, args.bare, inheritlist, args.mc) - def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_multi_provider_only, inherits): + def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_recipes_only, show_multi_provider_only, selected_layer, bare, inherits, mc): if inherits: bbpath = str(self.tinfoil.config_data.getVar('BBPATH')) for classname in inherits: @@ -119,14 +123,18 @@ skipped recipes will also be listed, with a " (skipped)" suffix. logger.error('No class named %s found in BBPATH', classfile) sys.exit(1) - pkg_pn = self.tinfoil.cooker.recipecaches[''].pkg_pn - (latest_versions, preferred_versions) = self.tinfoil.find_providers() - allproviders = self.tinfoil.get_all_providers() + pkg_pn = self.tinfoil.cooker.recipecaches[mc].pkg_pn + (latest_versions, preferred_versions) = self.tinfoil.find_providers(mc) + allproviders = self.tinfoil.get_all_providers(mc) # Ensure we list skipped recipes # We are largely guessing about PN, PV and the preferred version here, # but we have no choice since skipped recipes are not fully parsed skiplist = list(self.tinfoil.cooker.skiplist.keys()) + mcspec = 'mc:%s:' % mc + if mc: + skiplist = [s[len(mcspec):] for s in skiplist if s.startswith(mcspec)] + for fn in skiplist: recipe_parts = os.path.splitext(os.path.basename(fn))[0].split('_') p = recipe_parts[0] @@ -140,24 +148,30 @@ skipped recipes will also be listed, with a " (skipped)" suffix. preferred_versions[p] = (ver, fn) def print_item(f, pn, ver, layer, ispref): - if f in skiplist: - skipped = ' (skipped)' - else: - skipped = '' - if show_filenames: - if ispref: - logger.plain("%s%s", f, skipped) + if not selected_layer or layer == selected_layer: + if not bare and f in skiplist: + skipped = ' (skipped)' else: - logger.plain(" %s%s", f, skipped) - else: - if ispref: - logger.plain("%s:", pn) - logger.plain(" %s %s%s", layer.ljust(20), ver, skipped) + skipped = '' + if show_filenames: + if ispref: + logger.plain("%s%s", f, skipped) + else: + logger.plain(" %s%s", f, skipped) + elif show_recipes_only: + if pn not in show_unique_pn: + show_unique_pn.append(pn) + logger.plain("%s%s", pn, skipped) + else: + if ispref: + logger.plain("%s:", pn) + logger.plain(" %s %s%s", layer.ljust(20), ver, skipped) global_inherit = (self.tinfoil.config_data.getVar('INHERIT') or "").split() cls_re = re.compile('classes/') preffiles = [] + show_unique_pn = [] items_listed = False for p in sorted(pkg_pn): if pnspec: @@ -177,7 +191,7 @@ skipped recipes will also be listed, with a " (skipped)" suffix. # We only display once per recipe, we should prefer non extended versions of the # recipe if present (so e.g. in OpenEmbedded, openssl rather than nativesdk-openssl # which would otherwise sort first). - if realfn[1] and realfn[0] in self.tinfoil.cooker.recipecaches[''].pkg_fn: + if realfn[1] and realfn[0] in self.tinfoil.cooker.recipecaches[mc].pkg_fn: continue if inherits: @@ -486,11 +500,16 @@ NOTE: .bbappend files can impact the dependencies. parser_show_overlayed = self.add_command(sp, 'show-overlayed', self.do_show_overlayed) parser_show_overlayed.add_argument('-f', '--filenames', help='instead of the default formatting, list filenames of higher priority recipes with the ones they overlay indented underneath', action='store_true') parser_show_overlayed.add_argument('-s', '--same-version', help='only list overlayed recipes where the version is the same', action='store_true') + parser_show_overlayed.add_argument('--mc', help='use specified multiconfig', default='') parser_show_recipes = self.add_command(sp, 'show-recipes', self.do_show_recipes) parser_show_recipes.add_argument('-f', '--filenames', help='instead of the default formatting, list filenames of higher priority recipes with the ones they overlay indented underneath', action='store_true') + parser_show_recipes.add_argument('-r', '--recipes-only', help='instead of the default formatting, list recipes only', action='store_true') parser_show_recipes.add_argument('-m', '--multiple', help='only list where multiple recipes (in the same layer or different layers) exist for the same recipe name', action='store_true') parser_show_recipes.add_argument('-i', '--inherits', help='only list recipes that inherit the named class(es) - separate multiple classes using , (without spaces)', metavar='CLASS', default='') + parser_show_recipes.add_argument('-l', '--layer', help='only list recipes from the selected layer', default='') + parser_show_recipes.add_argument('-b', '--bare', help='output just names without the "(skipped)" marker', action='store_true') + parser_show_recipes.add_argument('--mc', help='use specified multiconfig', default='') parser_show_recipes.add_argument('pnspec', nargs='*', help='optional recipe name specification (wildcards allowed, enclose in quotes to avoid shell expansion)') parser_show_appends = self.add_command(sp, 'show-appends', self.do_show_appends) |