Hi Juan, On Thursday, 24 August 2017 12:51:09 PM NZST [email protected] wrote: > From: Juan M Cruz Alcaraz <[email protected]> > > A recipe added with "devtool add" requires to be able to take precedence on > recipes > previously defined with PREFERRED_PROVIDER. > > By adding the parameter "--provides" to "devtool add" it is possible to > specify > an element to be provided by the recipe. A devtool recipe can override a > previous > PREFERRED_PROVIDER using the layer configuration file in the workspace. > > E.g. > devtool add my-libgl git@git://my-libgl-repository --provides > virtual/libgl > > [YOCTO #10415] > > Signed-off-by: Juan M Cruz Alcaraz <[email protected]> > --- > scripts/lib/devtool/standard.py | 20 ++++++++++++++++++++ > scripts/lib/recipetool/create.py | 3 +++ > 2 files changed, 23 insertions(+) > > diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py > index ec192238ed..b3d857bbd9 100644 > --- a/scripts/lib/devtool/standard.py > +++ b/scripts/lib/devtool/standard.py > @@ -151,6 +151,8 @@ def add(args, config, basepath, workspace): > extracmdopts += ' --fetch-dev' > if args.mirrors: > extracmdopts += ' --mirrors' > + if args.provides: > + extracmdopts += ' --provides %s' % args.provides > > tempdir = tempfile.mkdtemp(prefix='devtool') > try: > @@ -266,6 +268,23 @@ def add(args, config, basepath, workspace): > f.write(' done\n') > f.write('}\n') > > + # Check if the new layer provides recipes whose priorities have been > + # overriden by PREFERRED_PROVIDER. > + recipe_name = rd.getVar('PN') > + provides = rd.getVar('PROVIDES') > + # Search every item defined in PROVIDES > + for recipe_provided in provides.split(): > + preferred_provider = 'PREFERRED_PROVIDER_' + recipe_provided > + if rd.getVar(preferred_provider): > + if args.fixed_setup: > + #if we are inside the eSDK add the new > PREFERRED_PROVIDER in the workspace layer.conf > + layerconf_file = os.path.join(config.workspace_path, > "conf", "layer.conf") > + with open(layerconf_file, 'a') as f: > + f.write('%s="%s"\n' % (preferred_provider, > recipe_name)) > + else: > + logger.warn('Set \'%s\' in order to use the recipe' % > preferred_provider) > + break > +
I was all set to ack this, and then I realised there are still a few issues: 1) We aren't undoing this change to the workspace layer's layer.conf on reset/finish. Can you please add that? 2) Could you please add spaces around the = in the line we add to layer.conf as well. 3) At the moment you just check if the PREFERRED_PROVIDER is set at all, but we can also skip all of this if it's already set to PN of the recipe we're working on. Thanks, Paul -- Paul Eggleton Intel Open Source Technology Centre -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
