8
8
9
9
from catkin_pkg .packages import find_packages
10
10
import rospkg
11
- import vcstools
11
+ from vcstool . commands . import_ import main as vcs_import_main
12
12
import yaml
13
13
14
14
from .models import DryRosDistro
@@ -67,8 +67,10 @@ def get_package_list_for_remote_repo(
67
67
logger .info ("Cloning '{0}' from '{1}' @ '{2}' with '{3}'..." .format (
68
68
repo , url , branch , vcs
69
69
))
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 :
72
74
raise RuntimeError (
73
75
"Failed to checkout branch '{0}' from '{1}'"
74
76
.format (branch , url )
@@ -77,13 +79,28 @@ def get_package_list_for_remote_repo(
77
79
pkg_names = [pkg .name for pth , pkg in find_packages (tmp_dir ).items ()]
78
80
if version == 'latest' :
79
81
# 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
+ )
81
89
if os .path .exists (ros_distro + '.ignored' ):
82
90
with open (ros_distro + '.ignored' , 'r' ) as f :
83
91
pkgs_to_ignore = [l .strip () for l in f .read ().split () if l ]
84
92
return [p for p in pkg_names if p not in pkgs_to_ignore ]
85
93
86
94
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
+
87
104
def get_package_list_for_remote_repo_ajax (
88
105
request , ros_distro , repo , version , vcs , url , branch , repo_entry_number
89
106
):
0 commit comments