From 8261618bb8b95bd9bc44111198c0c0703601bc81 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Mon, 3 Feb 2020 19:35:04 -0800 Subject: [PATCH] bitbake/run.py: Require --dry-run * There are usually are some changes needed to manually adjust the .bbappends to build everything correctly with updated recipes. Prevent people from accidentally creating pull requests on GitHub before this is done by requiring that --dry-run be specified. Signed-off-by: Martin Jansa --- README.md | 10 +++++++--- superflore/generators/bitbake/run.py | 8 +++----- superflore/parser.py | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8dcf828a..cbe5ce9f 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ should be followed to generate the OpenEmbedded recipes for `meta-ros`. $ superflore-gen-oe-recipes --help usage: Deploy ROS packages into OpenEmbedded Linux [-h] [--ros-distro ROS_DISTRO] - [--dry-run] [--pr-only] [--no-branch] + --dry-run [--pr-only] [--no-branch] [--output-repository-path OUTPUT_REPOSITORY_PATH] [--only ONLY [ONLY ...]] [--pr-comment PR_COMMENT] @@ -189,8 +189,12 @@ This command will clone the `ros/meta-ros` repo into a subfolder under distro, commit them, and issue a pull request for `ros/meta-ros`. The `--ros-distro` flag must be supplied. -If you don't want to issue a PR for `ros/meta-ros`, you should add -the `--dry-run` flag. You can issue the PR later by using the `--pr-only` flag. +Generating bitbake recipes without specifying `--dry-run` is not +supported. This is because it is almost inevitable that +changes to the metadata under recipes-bbappend will be required. +Only when these have been made and the images build and pass +the sanity test should a pull request be created. +You can issue the PR later by using the `--pr-only` flag. If you want to use an existing repo instead of cloning one, specify `--output-repository-path OUTPUT_REPOSITORY_PATH`. diff --git a/superflore/generators/bitbake/run.py b/superflore/generators/bitbake/run.py index abd95bf3..ae5b1fe5 100644 --- a/superflore/generators/bitbake/run.py +++ b/superflore/generators/bitbake/run.py @@ -17,7 +17,6 @@ from rosinstall_generator.distro import get_distro from superflore.CacheManager import CacheManager -from superflore.exceptions import NoGitHubAuthToken from superflore.generate_installers import generate_installers from superflore.generators.bitbake.gen_packages import regenerate_pkg from superflore.generators.bitbake.ros_meta import RosMeta @@ -45,7 +44,9 @@ def main(): overlay = None preserve_existing = True parser = get_parser( - 'Deploy ROS packages into OpenEmbedded Linux', exclude_all=True) + 'Deploy ROS packages into OpenEmbedded Linux', + exclude_all=True, + require_dryrun=True) parser.add_argument( '--tar-archive-dir', help='location to store archived packages', @@ -55,9 +56,6 @@ def main(): pr_comment = args.pr_comment skip_keys = set(args.skip_keys) if args.skip_keys else set() selected_targets = None - if not args.dry_run: - if 'SUPERFLORE_GITHUB_TOKEN' not in os.environ: - raise NoGitHubAuthToken() if args.pr_only: if args.dry_run: parser.error('Invalid args! cannot dry-run and file PR') diff --git a/superflore/parser.py b/superflore/parser.py index 9f6d5ba3..750d09e0 100644 --- a/superflore/parser.py +++ b/superflore/parser.py @@ -16,7 +16,9 @@ # set up a parser and return it -def get_parser(tool_tip, is_generator=True, exclude_all=False): +def get_parser( + tool_tip, is_generator=True, exclude_all=False, require_dryrun=False +): parser = argparse.ArgumentParser(tool_tip) if is_generator: parser.add_argument( @@ -33,6 +35,7 @@ def get_parser(tool_tip, is_generator=True, exclude_all=False): parser.add_argument( '--dry-run', help='run without filing a PR to remote', + required=require_dryrun, action="store_true" ) parser.add_argument(