Fix rustpkg install for git repositories

This commit is contained in:
Jakub
2013-09-08 22:59:51 +00:00
parent 248765a746
commit 3d14e82be7
2 changed files with 9 additions and 5 deletions
+7 -5
View File
@@ -18,7 +18,7 @@
use crate::Crate;
use messages::*;
use source_control::{git_clone, git_clone_general};
use path_util::{find_dir_using_rust_path_hack, default_workspace};
use path_util::{find_dir_using_rust_path_hack, default_workspace, make_dir_rwx_recursive};
use util::compile_crate;
use workspace::is_workspace;
use workcache_support;
@@ -166,12 +166,14 @@ pub fn fetch_git(local: &Path, pkgid: &PkgId) -> Option<Path> {
url, clone_target.to_str(), pkgid.version.to_str());
if git_clone_general(url, &clone_target, &pkgid.version) {
// since the operation succeeded, move clone_target to local
if !os::rename_file(&clone_target, local) {
None
// Since the operation succeeded, move clone_target to local.
// First, create all ancestor directories.
if make_dir_rwx_recursive(&local.pop())
&& os::rename_file(&clone_target, local) {
Some(local.clone())
}
else {
Some(local.clone())
None
}
}
else {
+2
View File
@@ -43,6 +43,8 @@ pub fn in_rust_path(p: &Path) -> bool {
/// succeeded.
pub fn make_dir_rwx(p: &Path) -> bool { os::make_dir(p, U_RWX) }
pub fn make_dir_rwx_recursive(p: &Path) -> bool { os::mkdir_recursive(p, U_RWX) }
// n.b. The next three functions ignore the package version right
// now. Should fix that.