summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2018-06-22 02:09:34 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-04 00:02:16 +0100
commitc9812c91febbedb6157e98a8276964616d31e60c (patch)
tree6bf160fe5441061dd677a5b7d110e76dd8496a93 /scripts/lib/recipetool
parentbba7c19eeb22cbbadc5219edf938bec55bbc117a (diff)
downloadpoky-c9812c91febbedb6157e98a8276964616d31e60c.tar.gz
recipetool: add 'edit' subcommand
This edits the recipe and any bbappends for the specified target. (From OE-Core rev: 7aece42c6b4744c54a8eb05ff90bd3bf4fbb14a3) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool')
-rw-r--r--scripts/lib/recipetool/edit.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/lib/recipetool/edit.py b/scripts/lib/recipetool/edit.py
new file mode 100644
index 0000000000..c4789a9994
--- /dev/null
+++ b/scripts/lib/recipetool/edit.py
@@ -0,0 +1,54 @@
1# Recipe creation tool - edit plugin
2#
3# This sub-command edits the recipe and appends for the specified target
4#
5# Example: recipetool edit busybox
6#
7# Copyright (C) 2018 Mentor Graphics Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22import argparse
23import errno
24import logging
25import os
26import re
27import subprocess
28import sys
29import scriptutils
30
31
32logger = logging.getLogger('recipetool')
33tinfoil = None
34
35
36def tinfoil_init(instance):
37 global tinfoil
38 tinfoil = instance
39
40
41def edit(args):
42 import oe.recipeutils
43
44 recipe_path = tinfoil.get_recipe_file(args.target)
45 appends = tinfoil.get_file_appends(recipe_path)
46
47 return scriptutils.run_editor([recipe_path] + appends, logger)
48
49
50def register_commands(subparsers):
51 parser = subparsers.add_parser('edit',
52 help='Edit the recipe and appends for the specified target. This obeys $VISUAL if set, otherwise $EDITOR, otherwise vi.')
53 parser.add_argument('target', help='Target recipe/provide to edit')
54 parser.set_defaults(func=edit, parserecipes=True)