Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions create_gz_vendor_pkg/create_vendor_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ def create_cmake_file(src_pkg_xml: Package, extra_params: dict):
if pkg_has_docs(pkg_name_no_version) and not build_docs_deprecated(src_pkg_xml):
params["cmake_args"] = ["-DBUILD_DOCS:BOOL=OFF"]

# CLI11 is not available on ci.ros2.org, which uses a curated list of dependencies instead of rosdep.
# TODO(azeey): Remove this once ros2/ci#825 and ros2/ros2#1745 are merged
if pkg_name_no_version == "gz-utils":
params["cmake_args"].append("-DGZ_UTILS_VENDOR_CLI11=ON")

if pkg_has_pybind11(pkg_name_no_version) and params["versioned_package_name"]:
params["cmake_args"].append("-DSKIP_PYBIND11:BOOL=ON")
if pkg_has_swig(pkg_name_no_version):
Expand Down
70 changes: 70 additions & 0 deletions create_gz_vendor_pkg/gz_vendor_all_libs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import argparse
from os.path import expanduser
import sys
from urllib.request import urlopen
import tempfile
import yaml
import create_vendor_package
from pathlib import Path
from subprocess import run


def clone(path, info):
run(["git", "clone", "--depth", "1", "-b", info["version"], info["url"], path])


def get_collection(release):
collection_url = f"https://github.com/gazebo-tooling/gazebodistro/raw/master/collection-{release}.yaml" # noqa
collection_yaml = urlopen(url=collection_url)
return yaml.full_load(collection_yaml)


def get_collection_local(release):
with open(expanduser(f"~/ws/{release}/src/collection-{release}.yaml"), "r") as f:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this path is a bit hard-coded

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a workaround for getting rate limited. Normally, the get_collection function should be used to download the collection from Github. I've left this for now and made a change at the callsite to use get_collection.

return yaml.full_load(f.read())


def main(argv=sys.argv[1:]):
parser = argparse.ArgumentParser(
description="Update all packages for a given Gazebo release",
)

parser.add_argument(
"gazebo_release",
type=str,
help="Name of Gazebo release to use",
)
parser.add_argument(
"--output_dir",
type=str,
help="Output directory",
)
args, unknown_args = parser.parse_known_args(argv)
collection = get_collection(args.gazebo_release)

# Sparse clone all the repos first
with tempfile.TemporaryDirectory(prefix="gz_vendor_") as libs_path:
for name, info in collection["repositories"].items():
lib_path = Path(libs_path) / name
clone(lib_path, info)

package_xml_path = Path(lib_path) / "package.xml"
print(package_xml_path)

output_dir_args = []
if args.output_dir != "":
vendor_name = name.replace('-', '_') + '_vendor'
output_path = str(Path(args.output_dir) / vendor_name)
output_dir_args.append("--output_dir")
output_dir_args.append(output_path)

try:
create_vendor_package.main([str(package_xml_path), *output_dir_args, *unknown_args])
except Exception as e:
print("Error: ", e)
import traceback
traceback.print_exc()


if __name__ == "__main__":
main()