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
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@ The tool generates `conda` rattler-build recipes to capture all the selected ROS

The repo contains a `vinca` tool that reads a `vinca.yaml` file that contains all its metadata.

For an up-to-date example of how to write a `vinca.yaml`, check the repos of the mantained RoboStack distros:
For an up-to-date example of how to write a `vinca.yaml`, check the repos of the maintained RoboStack distros:
* https://github.com/RoboStack/ros-noetic/
* https://github.com/RoboStack/ros-humble
* https://github.com/RoboStack/ros-jazzy/

## Package naming

The optional `package_name_mode` setting controls the transition from legacy distro-qualified names such as `ros-humble-rclcpp` to ROS-major-version names such as `ros2-rclcpp`:

* `legacy` (default): generate only distro-qualified package names.
* `both`: generate the new names and compatibility packages under the legacy names. Each compatibility package depends on the corresponding new package at the same version.
* `new`: generate only the new names.

Existing configurations remain on `legacy` when this setting is omitted. To start migrating a distribution to the new names, use:

```yaml
package_name_mode: both
```

Once users and downstream projects have migrated, switch to `new` to stop generating the compatibility packages. New ROS 1 package names use the `ros-` prefix; new ROS 2 package names use `ros2-`.
12 changes: 12 additions & 0 deletions vinca/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ def get_release_package_xml(self, pkg_name):
def check_ros1(self):
return self._distribution_type == "ros1"

def get_ros_version(self):
"""Get ROS version number (1 or 2)"""
return "1" if self.check_ros1() else "2"

def get_package_prefix(self):
"""Get the package name prefix (ros for ROS1, ros2 for ROS2)."""
return "ros" if self.check_ros1() else "ros2"

def get_legacy_package_prefix(self):
"""Get the legacy distro-qualified package name prefix."""
return f"ros-{self.name}"

def get_python_version(self):
return self._python_version

Expand Down
8 changes: 3 additions & 5 deletions vinca/generate_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from rich import print

from vinca.utils import get_repodata
from vinca.utils import extract_dependency_names, get_repodata
from vinca.utils import literal_unicode as lu
from vinca.distro import Distro
from vinca.main import (
Expand Down Expand Up @@ -452,11 +452,9 @@ def main():
"host", []
) + pkg["requirements"].get("run", [])

# sort out requirements that are not built in this run
# Normalize direct and conditional requirements to package names.
for pkg_name, reqs in requirements.items():
requirements[pkg_name] = [
r.split()[0] for r in reqs if (isinstance(r, str) and r in reqs)
]
requirements[pkg_name] = extract_dependency_names(reqs)

G = nx.DiGraph()
for pkg, reqs in requirements.items():
Expand Down
12 changes: 3 additions & 9 deletions vinca/generate_gha.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from rich import print

from vinca.utils import get_repodata, NoAliasDumper
from vinca.utils import extract_dependency_names, get_repodata, NoAliasDumper
from vinca.utils import literal_unicode as lu
from vinca.distro import Distro
from vinca.main import (
Expand Down Expand Up @@ -500,15 +500,9 @@ def main():
"host", []
) + req_section.get("run", [])

# sort out requirements that are not built in this run
# Normalize direct and conditional requirements to package names.
for pkg_name, reqs in requirements.items():
requirements[pkg_name] = [
r.split()[0] for r in reqs if (isinstance(r, str) and r in reqs)
]
if platform == "emscripten-wasm32":
# Hot fix to add the only ros package inside a if else statement
if "ros-humble-rmw-wasm-cpp" in str(reqs):
requirements[pkg_name].append("ros-humble-rmw-wasm-cpp")
requirements[pkg_name] = extract_dependency_names(reqs)

G = nx.DiGraph()
for pkg, reqs in requirements.items():
Expand Down
14 changes: 8 additions & 6 deletions vinca/generate_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import sys
import os

from vinca.utils import extract_dependency_names

try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
Expand Down Expand Up @@ -41,26 +43,26 @@ def main():
requirements = {}

for pkg in metas:
requirements[pkg["package"]["name"]] = (
pkg["requirements"]["host"] + pkg["requirements"]["run"]
requirement_section = pkg.get("requirements", {})
requirements[pkg["package"]["name"]] = extract_dependency_names(
requirement_section.get("host", []) + requirement_section.get("run", [])
)

print(requirements)

G = nx.DiGraph()
for pkg, reqs in requirements.items():
G.add_node(pkg)
for r in reqs:
if r.startswith("ros-"):
G.add_edge(pkg, r)
for requirement in reqs:
if requirement.startswith(("ros-", "ros2-")):
G.add_edge(pkg, requirement)

# import matplotlib.pyplot as plt
# nx.draw(G, with_labels=True, font_weight='bold')
# plt.show()

tg = list(reversed(list(nx.topological_sort(G))))
print(tg)
print(requirements["ros-melodic-ros-core"])

stages = []
current_stage = []
Expand Down
Loading
Loading