Skip to content

Commit 3d14e82

Browse files
author
Jakub
committed
Fix rustpkg install for git repositories
1 parent 248765a commit 3d14e82

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/librustpkg/package_source.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use context::*;
1818
use crate::Crate;
1919
use messages::*;
2020
use source_control::{git_clone, git_clone_general};
21-
use path_util::{find_dir_using_rust_path_hack, default_workspace};
21+
use path_util::{find_dir_using_rust_path_hack, default_workspace, make_dir_rwx_recursive};
2222
use util::compile_crate;
2323
use workspace::is_workspace;
2424
use workcache_support;
@@ -166,12 +166,14 @@ impl PkgSrc {
166166
url, clone_target.to_str(), pkgid.version.to_str());
167167

168168
if git_clone_general(url, &clone_target, &pkgid.version) {
169-
// since the operation succeeded, move clone_target to local
170-
if !os::rename_file(&clone_target, local) {
171-
None
169+
// Since the operation succeeded, move clone_target to local.
170+
// First, create all ancestor directories.
171+
if make_dir_rwx_recursive(&local.pop())
172+
&& os::rename_file(&clone_target, local) {
173+
Some(local.clone())
172174
}
173175
else {
174-
Some(local.clone())
176+
None
175177
}
176178
}
177179
else {

src/librustpkg/path_util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ pub static U_RWX: i32 = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
4343
/// succeeded.
4444
pub fn make_dir_rwx(p: &Path) -> bool { os::make_dir(p, U_RWX) }
4545

46+
pub fn make_dir_rwx_recursive(p: &Path) -> bool { os::mkdir_recursive(p, U_RWX) }
47+
4648
// n.b. The next three functions ignore the package version right
4749
// now. Should fix that.
4850

0 commit comments

Comments
 (0)