Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit fd141a6

Browse files
authored
replace vcstools with vcstool (#61)
1 parent 8ee2d94 commit fd141a6

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ $ pip install -U Flask
3333
Install the domain (ROS) specific dependencies:
3434
3535
```
36-
$ pip install -U ros_buildfarm rosinstall_generator vcstools
36+
$ pip install -U ros_buildfarm rosinstall_generator vcstool
3737
```
3838
3939
Running Locally

prerelease_website/ajax.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from catkin_pkg.packages import find_packages
1010
import rospkg
11-
import vcstools
11+
from vcstool.commands.import_ import main as vcs_import_main
1212
import yaml
1313

1414
from .models import DryRosDistro
@@ -67,8 +67,10 @@ def get_package_list_for_remote_repo(
6767
logger.info("Cloning '{0}' from '{1}' @ '{2}' with '{3}'...".format(
6868
repo, url, branch, vcs
6969
))
70-
client = vcstools.get_vcs_client(vcs, tmp_dir)
71-
if not client.checkout(url, version=branch, shallow=True):
70+
repos_file = os.path.join(tmp_dir, repo + '.repo')
71+
_write_repos_file(repos_file, repo, vcs, url, branch)
72+
rc = vcs_import_main(['--input', repos_file, '--shallow', tmp_dir])
73+
if rc:
7274
raise RuntimeError(
7375
"Failed to checkout branch '{0}' from '{1}'"
7476
.format(branch, url)
@@ -77,13 +79,28 @@ def get_package_list_for_remote_repo(
7779
pkg_names = [pkg.name for pth, pkg in find_packages(tmp_dir).items()]
7880
if version == 'latest':
7981
# Also consider ignored list
80-
client.update(version='master')
82+
_write_repos_file(repos_file, repo, vcs, url, 'master')
83+
rc = vcs_import_main(['--input', repos_file, '--shallow', tmp_dir])
84+
if rc:
85+
raise RuntimeError(
86+
"Failed to checkout branch 'master' from '{1}'"
87+
.format(branch, url)
88+
)
8189
if os.path.exists(ros_distro + '.ignored'):
8290
with open(ros_distro + '.ignored', 'r') as f:
8391
pkgs_to_ignore = [l.strip() for l in f.read().split() if l]
8492
return [p for p in pkg_names if p not in pkgs_to_ignore]
8593

8694

95+
def _write_repos_file(path, repo, vcs, url, branch):
96+
with open(path, 'w') as h:
97+
h.write('repositories:\n')
98+
h.write(' %s:\n' % repo)
99+
h.write(' type: %s\n' % vcs)
100+
h.write(' url: %s\n' % url)
101+
h.write(' version: %s\n' % branch)
102+
103+
87104
def get_package_list_for_remote_repo_ajax(
88105
request, ros_distro, repo, version, vcs, url, branch, repo_entry_number
89106
):

0 commit comments

Comments
 (0)