mirror of
https://git.yoctoproject.org/poky
synced 2026-02-14 12:43:03 +01:00
Without this patch:
$ bitbake-layers create-layers-setup /home/adrian/temp/poky-clone
NOTE: Starting bitbake server...
Traceback (most recent call last):
File "/home/adrian/projects/poky/bitbake/lib/bb/process.py", line 169, in run
pipe = Popen(cmd, **options)
File "/home/adrian/projects/poky/bitbake/lib/bb/process.py", line 73, in __init__
subprocess.Popen.__init__(self, *args, **options)
File "/usr/lib64/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/adrian/temp/poky-clone'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/adrian/projects/poky/bitbake/bin/bitbake-layers", line 95, in <module>
ret = main()
File "/home/adrian/projects/poky/bitbake/bin/bitbake-layers", line 88, in main
return args.func(args)
File "/home/adrian/projects/poky/meta/lib/bblayers/makesetup.py", line 90, in do_make_setup
p.do_write(self, args)
File "/home/adrian/projects/poky/meta/lib/bblayers/setupwriters/oe-setup-layers.py", line 36, in do_write
repos = parent.make_repo_config(args.destdir, args.include_layer_repo)
File "/home/adrian/projects/poky/meta/lib/bblayers/makesetup.py", line 55, in make_repo_config
destdir_repo = self._get_repo_path(destdir)
File "/home/adrian/projects/poky/meta/lib/bblayers/makesetup.py", line 30, in _get_repo_path
repo_path, _ = bb.process.run('git rev-parse --show-toplevel', cwd=layer_path)
File "/home/adrian/projects/poky/bitbake/lib/bb/process.py", line 172, in run
raise NotFoundError(cmd)
bb.process.NotFoundError: Execution of 'git rev-parse --show-toplevel' failed: command not found
with this patch:
$ bitbake-layers create-layers-setup /home/adrian/temp/poky-clone
NOTE: Starting bitbake server...
NOTE: Created /home/adrian/temp/poky-clone/setup-layers.json
NOTE: Created /home/adrian/temp/poky-clone/setup-layers
(From OE-Core rev: 2da12ccada46443d58dd8fab463156fa763b84cc)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
53 lines
2.0 KiB
Python
53 lines
2.0 KiB
Python
#
|
|
# Copyright OpenEmbedded Contributors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
|
|
import logging
|
|
import os
|
|
import json
|
|
import stat
|
|
|
|
logger = logging.getLogger('bitbake-layers')
|
|
|
|
def plugin_init(plugins):
|
|
return OeSetupLayersWriter()
|
|
|
|
class OeSetupLayersWriter():
|
|
|
|
def __str__(self):
|
|
return "oe-setup-layers"
|
|
|
|
def _write_python(self, input, output):
|
|
with open(input) as f:
|
|
script = f.read()
|
|
with open(output, 'w') as f:
|
|
f.write(script)
|
|
st = os.stat(output)
|
|
os.chmod(output, st.st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
|
|
|
|
def _write_json(self, repos, output):
|
|
with open(output, 'w') as f:
|
|
json.dump(repos, f, sort_keys=True, indent=4)
|
|
|
|
def do_write(self, parent, args):
|
|
""" Writes out a python script and a json config that replicate the directory structure and revisions of the layers in a current build. """
|
|
if not os.path.exists(args.destdir):
|
|
os.makedirs(args.destdir)
|
|
repos = parent.make_repo_config(args.destdir)
|
|
json = {"version":"1.0","sources":repos}
|
|
if not repos:
|
|
raise Exception("Could not determine layer sources")
|
|
output = args.output_prefix or "setup-layers"
|
|
output = os.path.join(os.path.abspath(args.destdir),output)
|
|
self._write_json(json, output + ".json")
|
|
logger.info('Created {}.json'.format(output))
|
|
if not args.json_only:
|
|
self._write_python(os.path.join(os.path.dirname(__file__),'../../../../scripts/oe-setup-layers'), output)
|
|
logger.info('Created {}'.format(output))
|
|
|
|
def register_arguments(self, parser):
|
|
parser.add_argument('--json-only', action='store_true',
|
|
help='When using the oe-setup-layers writer, write only the layer configuruation in json format. Otherwise, also a copy of scripts/oe-setup-layers (from oe-core or poky) is provided, which is a self contained python script that fetches all the needed layers and sets them to correct revisions using the data from the json.')
|