Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make building of new versions optional #37

Merged
merged 1 commit into from
Oct 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions vinca/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ def parse_command_line(argv):
default=False,
help="Create one recipe for package.",
)
parser.add_argument(
"-n",
"--trigger-new-versions",
dest="trigger_new_versions",
action="store_const",
const=True,
default=False,
help="Trigger the build of packages that have new versions available.",
)
parser.add_argument(
"--source",
dest="source",
Expand Down Expand Up @@ -208,8 +217,12 @@ def generate_output(pkg_shortname, vinca_conf, distro, version, all_pkgs=None):
if not pkg_names:
return None

if (pkg_names[0], version) in vinca_conf["skip_built_packages"]:
return None
if vinca_conf["trigger_new_versions"]:
if (pkg_names[0], version) in vinca_conf["skip_built_packages"]:
return None
else:
if pkg_names[0] in vinca_conf["skip_built_packages"]:
return None

# TODO: Remove hardcoded cmake version after building new versions of ament_cmake_export_target
# see: https://github.com/ament/ament_cmake/commit/796cef7d7df2ddb806f774a9889e608cc82285d3
Expand Down Expand Up @@ -568,8 +581,12 @@ def generate_source(distro, vinca_conf):
print("Checking ", pkg_shortname, pkg_version)
if not pkg_names:
continue
if (pkg_names[0], pkg_version) in vinca_conf["skip_built_packages"]:
continue
if vinca_conf["trigger_new_versions"]:
if (pkg_names[0], pkg_version) in vinca_conf["skip_built_packages"]:
continue
else:
if pkg_names[0] in vinca_conf["skip_built_packages"]:
continue
pkg_name = pkg_names[0]
entry["folder"] = "%s/src/work" % pkg_name

Expand Down Expand Up @@ -611,11 +628,15 @@ def generate_source_version(distro, vinca_conf):
entry["git_url"] = url
entry["git_rev"] = version
pkg_names = resolve_pkgname(pkg_shortname, vinca_conf, distro)
if (
not pkg_names
or (pkg_names[0], version) in vinca_conf["skip_built_packages"]
):
continue
if vinca_conf["trigger_new_versions"]:
if (
not pkg_names
or (pkg_names[0], version) in vinca_conf["skip_built_packages"]
):
continue
else:
if not pkg_names or pkg_names[0] in vinca_conf["skip_built_packages"]:
continue
pkg_name = pkg_names[0]
entry["folder"] = "%s/src/work" % pkg_name

Expand Down Expand Up @@ -871,6 +892,9 @@ def main():
generate_bld_colcon_merge()
generate_bld_catkin_merge()
generate_activate_hook()

if arguments.trigger_new_versions:
vinca_conf["trigger_new_versions"] = True

if arguments.package:
pkg_files = glob.glob(arguments.package)
Expand Down Expand Up @@ -968,7 +992,10 @@ def main():

if is_built:
print(f"Skipping {pkg['name']}")
skip_built_packages.add((pkg["name"], pkg["version"]))
if vinca_conf["trigger_new_versions"]:
skip_built_packages.add((pkg["name"], pkg["version"]))
else:
skip_built_packages.add(pkg["name"])

vinca_conf["skip_built_packages"] = skip_built_packages
else:
Expand Down