mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
auto merge of #9148 : jakub-/rust/rustpkg-install-mkdir-p, r=catamorphism
Testing this is a little tricky as an intermediate temporary directory is only used for remote git repositories and therefore that path cannot be reliably exercised in the tests.
This commit is contained in:
commit
fd39bd169c
@ -18,7 +18,7 @@ use context::*;
|
||||
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;
|
||||
@ -197,12 +197,14 @@ impl PkgSrc {
|
||||
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 {
|
||||
|
@ -43,6 +43,8 @@ pub static U_RWX: i32 = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
|
||||
/// 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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user