summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/setvar.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
commit8c22ff0d8b70d9b12f0487ef696a7e915b9e3173 (patch)
treeefdc32587159d0050a69009bdf2330a531727d95 /scripts/lib/recipetool/setvar.py
parentd412d2747595c1cc4a5e3ca975e3adc31b2f7891 (diff)
downloadpoky-8c22ff0d8b70d9b12f0487ef696a7e915b9e3173.tar.gz
The poky repository master branch is no longer being updated.
You can either: a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs b) use the new bitbake-setup You can find information about either approach in our documentation: https://docs.yoctoproject.org/ Note that "poky" the distro setting is still available in meta-yocto as before and we continue to use and maintain that. Long live Poky! Some further information on the background of this change can be found in: https://lists.openembedded.org/g/openembedded-architecture/message/2179 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/setvar.py')
-rw-r--r--scripts/lib/recipetool/setvar.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/scripts/lib/recipetool/setvar.py b/scripts/lib/recipetool/setvar.py
deleted file mode 100644
index b5ad335cae..0000000000
--- a/scripts/lib/recipetool/setvar.py
+++ /dev/null
@@ -1,66 +0,0 @@
1# Recipe creation tool - set variable plugin
2#
3# Copyright (C) 2015 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7
8import sys
9import os
10import argparse
11import glob
12import fnmatch
13import re
14import logging
15import scriptutils
16
17logger = logging.getLogger('recipetool')
18
19tinfoil = None
20plugins = None
21
22def tinfoil_init(instance):
23 global tinfoil
24 tinfoil = instance
25
26def setvar(args):
27 import oe.recipeutils
28
29 if args.delete:
30 if args.value:
31 logger.error('-D/--delete and specifying a value are mutually exclusive')
32 return 1
33 value = None
34 else:
35 if args.value is None:
36 logger.error('You must specify a value if not using -D/--delete')
37 return 1
38 value = args.value
39 varvalues = {args.varname: value}
40
41 if args.recipe_only:
42 patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)]
43 else:
44 rd = tinfoil.parse_recipe_file(args.recipefile, False)
45 if not rd:
46 return 1
47 patches = oe.recipeutils.patch_recipe(rd, args.recipefile, varvalues, patch=args.patch)
48 if args.patch:
49 for patch in patches:
50 for line in patch:
51 sys.stdout.write(line)
52 tinfoil.modified_files()
53 return 0
54
55
56def register_commands(subparsers):
57 parser_setvar = subparsers.add_parser('setvar',
58 help='Set a variable within a recipe',
59 description='Adds/updates the value a variable is set to in a recipe')
60 parser_setvar.add_argument('recipefile', help='Recipe file to update')
61 parser_setvar.add_argument('varname', help='Variable name to set')
62 parser_setvar.add_argument('value', nargs='?', help='New value to set the variable to')
63 parser_setvar.add_argument('--recipe-only', '-r', help='Do not set variable in any include file if present', action='store_true')
64 parser_setvar.add_argument('--patch', '-p', help='Create a patch to make the change instead of modifying the recipe', action='store_true')
65 parser_setvar.add_argument('--delete', '-D', help='Delete the specified value instead of setting it', action='store_true')
66 parser_setvar.set_defaults(func=setvar)