From 412f7b24fd0f18b85b6f0c1a115c615d1579d163 Mon Sep 17 00:00:00 2001 From: "Hunter L. Allen" Date: Tue, 17 Dec 2019 15:28:34 -0500 Subject: [PATCH] Fix #229 (#257) * Only commit packages that were generated successfully with the `only` option Signed-off-by: Hunter L. Allen * Change to set instead of list, as well as fix appending of packages Signed-off-by: Hunter L. Allen * Update to new API for regenerate_pkg Signed-off-by: Hunter L. Allen --- superflore/generators/ebuild/run.py | 31 ++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/superflore/generators/ebuild/run.py b/superflore/generators/ebuild/run.py index 193d1245..866d4c52 100644 --- a/superflore/generators/ebuild/run.py +++ b/superflore/generators/ebuild/run.py @@ -116,6 +116,9 @@ def main(): overlay.repo.get_last_hash() ) ) + missing_depends = set() + to_commit = set() + will_file_pr = False for pkg in args.only: if pkg in skip_keys: warn("Package '%s' is in skip-keys list, skipping..." @@ -123,27 +126,45 @@ def main(): continue info("Regenerating package '%s'..." % pkg) try: - regenerate_pkg( + ebuild, deps, version = regenerate_pkg( overlay, pkg, get_distro(args.ros_distro), preserve_existing ) + if not ebuild: + for dep in deps: + missing_depends.add(dep) except KeyError: err("No package to satisfy key '%s'" % pkg) - sys.exit(1) + continue + if ebuild: + to_commit.add(pkg) + will_file_pr = True + # if no packages succeeded, exit with error + if not will_file_pr: + err("No packages generated successfully, exiting.") + sys.exit(1) # Commit changes and file pull request regen_dict = dict() - regen_dict[args.ros_distro] = args.only + regen_dict[args.ros_distro] = to_commit overlay.regenerate_manifests(regen_dict) overlay.commit_changes(args.ros_distro) if args.dry_run: save_pr( - overlay, args.only, missing_deps=None, comment=pr_comment + overlay, + args.only, + missing_deps=gen_missing_deps_msg(missing_depends), + comment=pr_comment ) sys.exit(0) delta = "Regenerated: '%s'\n" % args.only - file_pr(overlay, delta, '', pr_comment) + file_pr( + overlay, + delta, + gen_missing_deps_msg(missing_depends), + pr_comment + ) ok('Successfully synchronized repositories!') sys.exit(0)