On Thu, 4 Jan 2024 at 13:35, Jermain Horsman <[email protected]> wrote:
> + parser_setup_layers.add_argument('--update', '-u',
> + action='append',
> + metavar='REPOSITORY',
> + help='Repository to update, this requires a reference to be
> specified.\nThis option can be used multiple times.')
> + parser_setup_layers.add_argument('--reference', '-r',
> + help="Reference to use when updating repositories.\nThe value
> can be any git reference, however it is up to the user to provide a valid
> value.\nThis option is only useful when using '--update'.")
> +
> self.plugins = []
These options should move to the plugin. If/when we have another
plugin, we can consider making them global, until then we can't assume
all plugins would want to handle these.
> 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)
> + output = os.path.join(os.path.abspath(args.destdir), output)
> +
> + if args.update is None:
> + 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")
> + else:
> + json = self._read_repo_config(output + ".json")
> + if not 'sources' in json.keys():
> + raise Exception("File {}.json does not contain valid layer
> sources.".format(output))
> + self._modify_repo_config(json, args)
> +
> self._write_json(json, output + ".json")
> logger.info('Created {}.json'.format(output))
> if not args.json_only:
--update requires that the json file already exists. But why should
it? It's entirely possible to write a new json, but update the
references from command line arguments just before writing the file
out. No?
I also wonder if we can name these two options in a better way. Maybe
'--use-custom-reference repo', instead of --update?
Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193332):
https://lists.openembedded.org/g/openembedded-core/message/193332
Mute This Topic: https://lists.openembedded.org/mt/103521079/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-