ros-tooling/action-ros-ci

Action fails to remove duplicate repos on Windows

christophebedard opened this issue · 1 comments

Description

If the repo being tested is included in an imported repos file (e.g. ros2.repos), then the duplicate repo (i.e. @ master) is removed to avoid having two packages with the same name.

// If the package under tests is part of ros.repos, remove it first.
// We do not want to allow the "default" head state of the package to
// to be present in the workspace, and colcon will fail stating it found twice
// a package with an identical name.
const posixRosWorkspaceDir = isWindows
? rosWorkspaceDir.replace(/\\/g, "/")
: rosWorkspaceDir;
await execBashCommand(
`vcs diff -s --repos ${posixRosWorkspaceDir} | cut -d ' ' -f 1 | grep "${repo["repo"]}$" | xargs rm -rf`
);

Expected Behavior

The duplicate package is deleted. The repo being tested is kept.

Actual Behavior

It doesn't work on Windows. We get two packages with the same name.

For example: this Windows job for rmw_cyclonedds: https://github.com/ros2/rmw_cyclonedds/runs/2095238677#step:6:1136

To Reproduce

See above.

System (please complete the following information)

  • Windows
  • Rolling (in this case; shouldn't really make any difference)

Additional context

I've been investigating, and, on Windows, the duplicate repo obviously isn't removed. From what I can tell, the problem is that the paths returned by vcs diff -s --repos ${posixRosWorkspaceDir} contain a mix of forward slashes and backslashes, e.g.:

... vcs diff -s --repos D:/a/rmw_cyclonedds/rmw_cyclonedds/ros_ws | cut -d ' ' -f 1

D:/a/rmw_cyclonedds/rmw_cyclonedds/ros_ws\src\ament\ament_cmake

Removing the -f flag from rm -rf confirms that this path is invalid/unexpected:

... "vcs diff -s --repos D:/a/rmw_cyclonedds/rmw_cyclonedds/ros_ws | cut -d ' ' -f 1 | grep \"rmw_cyclonedds$\" | xargs rm -r"

rm: cannot remove 'D:/a/rmw_cyclonedds/rmw_cyclonedds/ros_wssrcros2rmw_cyclonedds': No such file or directory

Related vcstool issue: dirk-thomas/vcstool#202

In the meantime, we have #579