summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-10-31 16:59:44 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-07 11:04:22 +0000
commit452a1133ddadfb0750e930843d0e284185fca17c (patch)
tree192914886c3b96f38ed0a0ccec5d0257ecbe2e46
parent1655d55764eb0241b71217810500fcf1d4519a1c (diff)
downloadpoky-452a1133ddadfb0750e930843d0e284185fca17c.tar.gz
devtool: add: show recipetool create output
When running devtool add, instead of hiding the recipetool create output, change it so that it's appropriate to show in the devtool context and show it in real-time. This means that you get status output such as when a URL is being fetched (though currently no progress information.) recipetool create now has a hidden --devtool option to enable this display mode. (From OE-Core rev: 219aec8803de4ef04c514c87ecfb15359c9424a6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/devtool/standard.py5
-rw-r--r--scripts/lib/recipetool/create.py25
2 files changed, 22 insertions, 8 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 4eff6f878b..8dfd538332 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -155,7 +155,7 @@ def add(args, config, basepath, workspace):
155 try: 155 try:
156 while True: 156 while True:
157 try: 157 try:
158 stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, tempdir, source, extracmdopts)) 158 stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create --devtool -o %s \'%s\' %s' % (color, tempdir, source, extracmdopts), watch=True)
159 except bb.process.ExecutionError as e: 159 except bb.process.ExecutionError as e:
160 if e.exitcode == 14: 160 if e.exitcode == 14:
161 # FIXME this is a horrible hack that is unfortunately 161 # FIXME this is a horrible hack that is unfortunately
@@ -164,11 +164,12 @@ def add(args, config, basepath, workspace):
164 # with references to it throughout the code, so we have 164 # with references to it throughout the code, so we have
165 # to exit out and come back here to do it. 165 # to exit out and come back here to do it.
166 ensure_npm(config, basepath, args.fixed_setup) 166 ensure_npm(config, basepath, args.fixed_setup)
167 logger.info('Re-running recipe creation process after building nodejs')
167 continue 168 continue
168 elif e.exitcode == 15: 169 elif e.exitcode == 15:
169 raise DevtoolError('Could not auto-determine recipe name, please specify it on the command line') 170 raise DevtoolError('Could not auto-determine recipe name, please specify it on the command line')
170 else: 171 else:
171 raise DevtoolError('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) 172 raise DevtoolError('Command \'%s\' failed' % e.command)
172 break 173 break
173 174
174 recipes = glob.glob(os.path.join(tempdir, '*.bb')) 175 recipes = glob.glob(os.path.join(tempdir, '*.bb'))
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index d427d32062..c1819b6c66 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -32,6 +32,18 @@ logger = logging.getLogger('recipetool')
32tinfoil = None 32tinfoil = None
33plugins = None 33plugins = None
34 34
35def log_error_cond(message, debugonly):
36 if debugonly:
37 logger.debug(message)
38 else:
39 logger.error(message)
40
41def log_info_cond(message, debugonly):
42 if debugonly:
43 logger.debug(message)
44 else:
45 logger.info(message)
46
35def plugin_init(pluginlist): 47def plugin_init(pluginlist):
36 # Take a reference to the list so we can use it later 48 # Take a reference to the list so we can use it later
37 global plugins 49 global plugins
@@ -406,7 +418,7 @@ def create_recipe(args):
406 srctree = tempsrc 418 srctree = tempsrc
407 if fetchuri.startswith('npm://'): 419 if fetchuri.startswith('npm://'):
408 # Check if npm is available 420 # Check if npm is available
409 check_npm(tinfoil.config_data) 421 check_npm(tinfoil.config_data, args.devtool)
410 logger.info('Fetching %s...' % srcuri) 422 logger.info('Fetching %s...' % srcuri)
411 try: 423 try:
412 checksums = scriptutils.fetch_uri(tinfoil.config_data, fetchuri, srctree, srcrev) 424 checksums = scriptutils.fetch_uri(tinfoil.config_data, fetchuri, srctree, srcrev)
@@ -640,7 +652,7 @@ def create_recipe(args):
640 652
641 if not outfile: 653 if not outfile:
642 if not pn: 654 if not pn:
643 logger.error('Unable to determine short program name from source tree - please specify name with -N/--name or output file name with -o/--outfile') 655 log_error_cond('Unable to determine short program name from source tree - please specify name with -N/--name or output file name with -o/--outfile', args.devtool)
644 # devtool looks for this specific exit code, so don't change it 656 # devtool looks for this specific exit code, so don't change it
645 sys.exit(15) 657 sys.exit(15)
646 else: 658 else:
@@ -736,7 +748,7 @@ def create_recipe(args):
736 shutil.move(srctree, args.extract_to) 748 shutil.move(srctree, args.extract_to)
737 if tempsrc == srctree: 749 if tempsrc == srctree:
738 tempsrc = None 750 tempsrc = None
739 logger.info('Source extracted to %s' % args.extract_to) 751 log_info_cond('Source extracted to %s' % args.extract_to, args.devtool)
740 752
741 if outfile == '-': 753 if outfile == '-':
742 sys.stdout.write('\n'.join(outlines) + '\n') 754 sys.stdout.write('\n'.join(outlines) + '\n')
@@ -749,7 +761,7 @@ def create_recipe(args):
749 continue 761 continue
750 f.write('%s\n' % line) 762 f.write('%s\n' % line)
751 lastline = line 763 lastline = line
752 logger.info('Recipe %s has been created; further editing may be required to make it fully functional' % outfile) 764 log_info_cond('Recipe %s has been created; further editing may be required to make it fully functional' % outfile, args.devtool)
753 765
754 if tempsrc: 766 if tempsrc:
755 if args.keep_temp: 767 if args.keep_temp:
@@ -1073,9 +1085,9 @@ def convert_rpm_xml(xmlfile):
1073 return values 1085 return values
1074 1086
1075 1087
1076def check_npm(d): 1088def check_npm(d, debugonly=False):
1077 if not os.path.exists(os.path.join(d.getVar('STAGING_BINDIR_NATIVE', True), 'npm')): 1089 if not os.path.exists(os.path.join(d.getVar('STAGING_BINDIR_NATIVE', True), 'npm')):
1078 logger.error('npm required to process specified source, but npm is not available - you need to build nodejs-native first') 1090 log_error_cond('npm required to process specified source, but npm is not available - you need to build nodejs-native first', debugonly)
1079 sys.exit(14) 1091 sys.exit(14)
1080 1092
1081def register_commands(subparsers): 1093def register_commands(subparsers):
@@ -1093,5 +1105,6 @@ def register_commands(subparsers):
1093 parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') 1105 parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR')
1094 parser_create.add_argument('-a', '--autorev', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") 1106 parser_create.add_argument('-a', '--autorev', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true")
1095 parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') 1107 parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
1108 parser_create.add_argument('--devtool', action="store_true", help=argparse.SUPPRESS)
1096 parser_create.set_defaults(func=create_recipe) 1109 parser_create.set_defaults(func=create_recipe)
1097 1110