rustpkg: Remove uses of fmt!
This commit is contained in:
parent
a7f19f36be
commit
da24c0d32f
@ -52,7 +52,7 @@ fn binary_is_fresh(path: &str, in_hash: &str) -> bool {
|
||||
|
||||
pub fn new_workcache_context(p: &Path) -> workcache::Context {
|
||||
let db_file = p.push("rustpkg_db.json"); // ??? probably wrong
|
||||
debug!("Workcache database file: %s", db_file.to_str());
|
||||
debug2!("Workcache database file: {}", db_file.to_str());
|
||||
let db = RWArc::new(Database::new(db_file));
|
||||
let lg = RWArc::new(Logger::new());
|
||||
let cfg = Arc::new(TreeMap::new());
|
||||
|
@ -150,7 +150,7 @@ impl Context {
|
||||
/// rustpkg from a Rust target directory. This is part of a
|
||||
/// kludgy hack used to adjust the sysroot.
|
||||
pub fn in_target(sysroot: &Path) -> bool {
|
||||
debug!("Checking whether %s is in target", sysroot.to_str());
|
||||
debug2!("Checking whether {} is in target", sysroot.to_str());
|
||||
os::path_is_dir(&sysroot.pop().pop().push("rustc"))
|
||||
}
|
||||
|
||||
@ -214,8 +214,8 @@ pub fn flags_ok_for_cmd(flags: &RustcFlags,
|
||||
cfgs: &[~str],
|
||||
cmd: &str, user_supplied_opt_level: bool) -> bool {
|
||||
let complain = |s| {
|
||||
io::println(fmt!("The %s option can only be used with the build command:
|
||||
rustpkg [options..] build %s [package-ID]", s, s));
|
||||
println!("The {} option can only be used with the build command:
|
||||
rustpkg [options..] build {} [package-ID]", s, s);
|
||||
};
|
||||
|
||||
if flags.linker.is_some() && cmd != "build" && cmd != "install" {
|
||||
|
@ -28,15 +28,15 @@ pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool {
|
||||
let libfiles = os::list_dir(&p.push("lib"));
|
||||
for lib in libfiles.iter() {
|
||||
let lib = Path(*lib);
|
||||
debug!("Full name: %s", lib.to_str());
|
||||
debug2!("Full name: {}", lib.to_str());
|
||||
match has_library(&lib) {
|
||||
Some(basename) => {
|
||||
debug!("parent = %s, child = %s",
|
||||
p.push("lib").to_str(), lib.to_str());
|
||||
debug2!("parent = {}, child = {}",
|
||||
p.push("lib").to_str(), lib.to_str());
|
||||
let rel_p = p.push("lib/").get_relative_to(&lib);
|
||||
debug!("Rel: %s", rel_p.to_str());
|
||||
debug2!("Rel: {}", rel_p.to_str());
|
||||
let rel_path = rel_p.push(basename).to_str();
|
||||
debug!("Rel name: %s", rel_path);
|
||||
debug2!("Rel name: {}", rel_path);
|
||||
f(&PkgId::new(rel_path));
|
||||
}
|
||||
None => ()
|
||||
|
@ -66,7 +66,7 @@ impl PkgId {
|
||||
if path.components.len() < 1 {
|
||||
return cond.raise((path, ~"0-length pkgid"));
|
||||
}
|
||||
let short_name = path.filestem().expect(fmt!("Strange path! %s", s));
|
||||
let short_name = path.filestem().expect(format!("Strange path! {}", s));
|
||||
|
||||
let version = match given_version {
|
||||
Some(v) => v,
|
||||
@ -87,13 +87,13 @@ impl PkgId {
|
||||
}
|
||||
|
||||
pub fn hash(&self) -> ~str {
|
||||
fmt!("%s-%s-%s", self.path.to_str(),
|
||||
hash(self.path.to_str() + self.version.to_str()),
|
||||
self.version.to_str())
|
||||
format!("{}-{}-{}", self.path.to_str(),
|
||||
hash(self.path.to_str() + self.version.to_str()),
|
||||
self.version.to_str())
|
||||
}
|
||||
|
||||
pub fn short_name_with_version(&self) -> ~str {
|
||||
fmt!("%s%s", self.short_name, self.version.to_str())
|
||||
format!("{}{}", self.short_name, self.version.to_str())
|
||||
}
|
||||
|
||||
/// True if the ID has multiple components
|
||||
@ -112,7 +112,7 @@ impl PkgId {
|
||||
// binaries for this package (as opposed to the built ones,
|
||||
// which are per-crate).
|
||||
pub fn install_tag(&self) -> ~str {
|
||||
fmt!("install(%s)", self.to_str())
|
||||
format!("install({})", self.to_str())
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ impl Iterator<(Path, Path)> for Prefixes {
|
||||
impl ToStr for PkgId {
|
||||
fn to_str(&self) -> ~str {
|
||||
// should probably use the filestem and not the whole path
|
||||
fmt!("%s-%s", self.path.to_str(), self.version.to_str())
|
||||
format!("{}-{}", self.path.to_str(), self.version.to_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,9 @@ pub struct PkgSrc {
|
||||
|
||||
impl ToStr for PkgSrc {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("Package ID %s in start dir %s [workspace = %s]",
|
||||
self.id.to_str(),
|
||||
self.start_dir.to_str(), self.workspace.to_str())
|
||||
format!("Package ID {} in start dir {} [workspace = {}]",
|
||||
self.id.to_str(),
|
||||
self.start_dir.to_str(), self.workspace.to_str())
|
||||
}
|
||||
}
|
||||
condition! {
|
||||
@ -58,21 +58,21 @@ impl PkgSrc {
|
||||
pub fn new(workspace: Path, use_rust_path_hack: bool, id: PkgId) -> PkgSrc {
|
||||
use conditions::nonexistent_package::cond;
|
||||
|
||||
debug!("Checking package source for package ID %s, \
|
||||
workspace = %s use_rust_path_hack = %?",
|
||||
debug2!("Checking package source for package ID {}, \
|
||||
workspace = {} use_rust_path_hack = {:?}",
|
||||
id.to_str(), workspace.to_str(), use_rust_path_hack);
|
||||
|
||||
let mut to_try = ~[];
|
||||
if use_rust_path_hack {
|
||||
to_try.push(workspace.clone());
|
||||
} else {
|
||||
let result = workspace.push("src").push_rel(&id.path.pop()).push(fmt!("%s-%s",
|
||||
let result = workspace.push("src").push_rel(&id.path.pop()).push(format!("{}-{}",
|
||||
id.short_name, id.version.to_str()));
|
||||
to_try.push(result);
|
||||
to_try.push(workspace.push("src").push_rel(&id.path));
|
||||
}
|
||||
|
||||
debug!("Checking dirs: %?", to_try.map(|s| s.to_str()).connect(":"));
|
||||
debug2!("Checking dirs: {:?}", to_try.map(|s| s.to_str()).connect(":"));
|
||||
|
||||
let path = to_try.iter().find(|&d| os::path_exists(d));
|
||||
|
||||
@ -84,13 +84,13 @@ impl PkgSrc {
|
||||
for (prefix, suffix) in id.prefixes_iter() {
|
||||
let package_id = PkgId::new(prefix.to_str());
|
||||
let path = workspace.push("src").push_rel(&package_id.path);
|
||||
debug!("in loop: checking if %s is a directory", path.to_str());
|
||||
debug2!("in loop: checking if {} is a directory", path.to_str());
|
||||
if os::path_is_dir(&path) {
|
||||
let ps = PkgSrc::new(workspace.clone(),
|
||||
use_rust_path_hack,
|
||||
PkgId::new(prefix.to_str()));
|
||||
debug!("pkgsrc: Returning [%s|%s|%s]", workspace.to_str(),
|
||||
ps.start_dir.push_rel(&suffix).to_str(), ps.id.to_str());
|
||||
debug2!("pkgsrc: Returning [{}|{}|{}]", workspace.to_str(),
|
||||
ps.start_dir.push_rel(&suffix).to_str(), ps.id.to_str());
|
||||
|
||||
return PkgSrc {
|
||||
workspace: workspace,
|
||||
@ -108,7 +108,7 @@ impl PkgSrc {
|
||||
// Ok, no prefixes work, so try fetching from git
|
||||
let mut ok_d = None;
|
||||
for w in to_try.iter() {
|
||||
debug!("Calling fetch_git on %s", w.to_str());
|
||||
debug2!("Calling fetch_git on {}", w.to_str());
|
||||
let gf = PkgSrc::fetch_git(w, &id);
|
||||
for p in gf.iter() {
|
||||
ok_d = Some(p.clone());
|
||||
@ -138,14 +138,14 @@ impl PkgSrc {
|
||||
}
|
||||
}
|
||||
};
|
||||
debug!("For package id %s, returning %s", id.to_str(), dir.to_str());
|
||||
debug2!("For package id {}, returning {}", id.to_str(), dir.to_str());
|
||||
|
||||
if !os::path_is_dir(&dir) {
|
||||
cond.raise((id.clone(), ~"supplied path for package dir is a \
|
||||
non-directory"));
|
||||
}
|
||||
|
||||
debug!("pkgsrc: Returning {%s|%s|%s}", workspace.to_str(),
|
||||
debug2!("pkgsrc: Returning \\{{}|{}|{}\\}", workspace.to_str(),
|
||||
dir.to_str(), id.to_str());
|
||||
|
||||
PkgSrc {
|
||||
@ -176,13 +176,13 @@ impl PkgSrc {
|
||||
None => cond.raise(~"Failed to create temporary directory for fetching git sources")
|
||||
};
|
||||
|
||||
debug!("Checking whether %s (path = %s) exists locally. Cwd = %s, does it? %?",
|
||||
debug2!("Checking whether {} (path = {}) exists locally. Cwd = {}, does it? {:?}",
|
||||
pkgid.to_str(), pkgid.path.to_str(),
|
||||
os::getcwd().to_str(),
|
||||
os::path_exists(&pkgid.path));
|
||||
|
||||
if os::path_exists(&pkgid.path) {
|
||||
debug!("%s exists locally! Cloning it into %s",
|
||||
debug2!("{} exists locally! Cloning it into {}",
|
||||
pkgid.path.to_str(), local.to_str());
|
||||
// Ok to use local here; we know it will succeed
|
||||
git_clone(&pkgid.path, local, &pkgid.version);
|
||||
@ -194,8 +194,8 @@ impl PkgSrc {
|
||||
return None;
|
||||
}
|
||||
|
||||
let url = fmt!("https://%s", pkgid.path.to_str());
|
||||
debug!("Fetching package: git clone %s %s [version=%s]",
|
||||
let url = format!("https://{}", pkgid.path.to_str());
|
||||
debug2!("Fetching package: git clone {} {} [version={}]",
|
||||
url, clone_target.to_str(), pkgid.version.to_str());
|
||||
|
||||
if git_clone_general(url, &clone_target, &pkgid.version) {
|
||||
@ -219,7 +219,7 @@ impl PkgSrc {
|
||||
// return the path for it. Otherwise, None
|
||||
pub fn package_script_option(&self) -> Option<Path> {
|
||||
let maybe_path = self.start_dir.push("pkg.rs");
|
||||
debug!("package_script_option: checking whether %s exists", maybe_path.to_str());
|
||||
debug2!("package_script_option: checking whether {} exists", maybe_path.to_str());
|
||||
if os::path_exists(&maybe_path) {
|
||||
Some(maybe_path)
|
||||
}
|
||||
@ -239,7 +239,7 @@ impl PkgSrc {
|
||||
for c in p.components.slice(prefix, p.components.len()).iter() {
|
||||
sub = sub.push(*c);
|
||||
}
|
||||
debug!("Will compile crate %s", sub.to_str());
|
||||
debug2!("Will compile crate {}", sub.to_str());
|
||||
cs.push(Crate::new(&sub));
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ impl PkgSrc {
|
||||
use conditions::missing_pkg_files::cond;
|
||||
|
||||
let prefix = self.start_dir.components.len();
|
||||
debug!("Matching against %s", self.id.short_name);
|
||||
debug2!("Matching against {}", self.id.short_name);
|
||||
do os::walk_dir(&self.start_dir) |pth| {
|
||||
let maybe_known_crate_set = match pth.filename() {
|
||||
Some(filename) if filter(filename) => match filename {
|
||||
@ -282,7 +282,7 @@ impl PkgSrc {
|
||||
cond.raise(self.id.clone());
|
||||
}
|
||||
|
||||
debug!("In %s, found %u libs, %u mains, %u tests, %u benchs",
|
||||
debug2!("In {}, found {} libs, {} mains, {} tests, {} benchs",
|
||||
self.start_dir.to_str(),
|
||||
self.libs.len(),
|
||||
self.mains.len(),
|
||||
@ -298,12 +298,12 @@ impl PkgSrc {
|
||||
what: OutputType) {
|
||||
for crate in crates.iter() {
|
||||
let path = self.start_dir.push_rel(&crate.file).normalize();
|
||||
debug!("build_crates: compiling %s", path.to_str());
|
||||
debug2!("build_crates: compiling {}", path.to_str());
|
||||
let path_str = path.to_str();
|
||||
let cfgs = crate.cfgs + cfgs;
|
||||
|
||||
do ctx.workcache_context.with_prep(crate_tag(&path)) |prep| {
|
||||
debug!("Building crate %s, declaring it as an input", path.to_str());
|
||||
debug2!("Building crate {}, declaring it as an input", path.to_str());
|
||||
prep.declare_input("file", path.to_str(),
|
||||
workcache_support::digest_file_with_date(&path));
|
||||
let subpath = path.clone();
|
||||
@ -323,7 +323,7 @@ impl PkgSrc {
|
||||
subcfgs,
|
||||
false,
|
||||
what).to_str();
|
||||
debug!("Result of compiling %s was %s", subpath_str, result);
|
||||
debug2!("Result of compiling {} was {}", subpath_str, result);
|
||||
result
|
||||
}
|
||||
};
|
||||
@ -335,11 +335,11 @@ impl PkgSrc {
|
||||
pub fn declare_inputs(&self, prep: &mut workcache::Prep) {
|
||||
let to_do = ~[self.libs.clone(), self.mains.clone(),
|
||||
self.tests.clone(), self.benchs.clone()];
|
||||
debug!("In declare inputs, self = %s", self.to_str());
|
||||
debug2!("In declare inputs, self = {}", self.to_str());
|
||||
for cs in to_do.iter() {
|
||||
for c in cs.iter() {
|
||||
let path = self.start_dir.push_rel(&c.file).normalize();
|
||||
debug!("Declaring input: %s", path.to_str());
|
||||
debug2!("Declaring input: {}", path.to_str());
|
||||
prep.declare_input("file",
|
||||
path.to_str(),
|
||||
workcache_support::digest_file_with_date(&path.clone()));
|
||||
@ -357,17 +357,17 @@ impl PkgSrc {
|
||||
// Determine the destination workspace (which depends on whether
|
||||
// we're using the rust_path_hack)
|
||||
let destination_workspace = if is_workspace(&self.workspace) {
|
||||
debug!("%s is indeed a workspace", self.workspace.to_str());
|
||||
debug2!("{} is indeed a workspace", self.workspace.to_str());
|
||||
self.workspace.clone()
|
||||
} else {
|
||||
// It would be nice to have only one place in the code that checks
|
||||
// for the use_rust_path_hack flag...
|
||||
if build_context.context.use_rust_path_hack {
|
||||
let rs = default_workspace();
|
||||
debug!("Using hack: %s", rs.to_str());
|
||||
debug2!("Using hack: {}", rs.to_str());
|
||||
rs
|
||||
} else {
|
||||
cond.raise(fmt!("Package root %s is not a workspace; pass in --rust_path_hack \
|
||||
cond.raise(format!("Package root {} is not a workspace; pass in --rust_path_hack \
|
||||
if you want to treat it as a package source",
|
||||
self.workspace.to_str()))
|
||||
}
|
||||
@ -377,14 +377,14 @@ impl PkgSrc {
|
||||
let mains = self.mains.clone();
|
||||
let tests = self.tests.clone();
|
||||
let benchs = self.benchs.clone();
|
||||
debug!("Building libs in %s, destination = %s",
|
||||
debug2!("Building libs in {}, destination = {}",
|
||||
destination_workspace.to_str(), destination_workspace.to_str());
|
||||
self.build_crates(build_context, &destination_workspace, libs, cfgs, Lib);
|
||||
debug!("Building mains");
|
||||
debug2!("Building mains");
|
||||
self.build_crates(build_context, &destination_workspace, mains, cfgs, Main);
|
||||
debug!("Building tests");
|
||||
debug2!("Building tests");
|
||||
self.build_crates(build_context, &destination_workspace, tests, cfgs, Test);
|
||||
debug!("Building benches");
|
||||
debug2!("Building benches");
|
||||
self.build_crates(build_context, &destination_workspace, benchs, cfgs, Bench);
|
||||
destination_workspace.to_str()
|
||||
}
|
||||
@ -394,7 +394,7 @@ impl PkgSrc {
|
||||
let crate_sets = [&self.libs, &self.mains, &self.tests, &self.benchs];
|
||||
for crate_set in crate_sets.iter() {
|
||||
for c in crate_set.iter() {
|
||||
debug!("Built crate: %s", c.file.to_str())
|
||||
debug2!("Built crate: {}", c.file.to_str())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use messages::*;
|
||||
pub fn default_workspace() -> Path {
|
||||
let p = rust_path();
|
||||
if p.is_empty() {
|
||||
fail!("Empty RUST_PATH");
|
||||
fail2!("Empty RUST_PATH");
|
||||
}
|
||||
let result = p[0];
|
||||
if !os::path_is_dir(&result) {
|
||||
@ -88,9 +88,9 @@ pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path,
|
||||
};
|
||||
|
||||
if found.is_some() {
|
||||
debug!("Found %s in %s", pkgid.to_str(), workspace.to_str());
|
||||
debug2!("Found {} in {}", pkgid.to_str(), workspace.to_str());
|
||||
} else {
|
||||
debug!("Didn't find %s in %s", pkgid.to_str(), workspace.to_str());
|
||||
debug2!("Didn't find {} in {}", pkgid.to_str(), workspace.to_str());
|
||||
}
|
||||
found
|
||||
}
|
||||
@ -119,13 +119,13 @@ fn target_bin_dir(workspace: &Path) -> Path {
|
||||
pub fn built_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> {
|
||||
let mut result = target_build_dir(workspace);
|
||||
result = mk_output_path(Main, Build, pkgid, result);
|
||||
debug!("built_executable_in_workspace: checking whether %s exists",
|
||||
debug2!("built_executable_in_workspace: checking whether {} exists",
|
||||
result.to_str());
|
||||
if os::path_exists(&result) {
|
||||
Some(result)
|
||||
}
|
||||
else {
|
||||
debug!("built_executable_in_workspace: %s does not exist", result.to_str());
|
||||
debug2!("built_executable_in_workspace: {} does not exist", result.to_str());
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -146,13 +146,13 @@ fn output_in_workspace(pkgid: &PkgId, workspace: &Path, what: OutputType) -> Opt
|
||||
let mut result = target_build_dir(workspace);
|
||||
// should use a target-specific subdirectory
|
||||
result = mk_output_path(what, Build, pkgid, result);
|
||||
debug!("output_in_workspace: checking whether %s exists",
|
||||
debug2!("output_in_workspace: checking whether {} exists",
|
||||
result.to_str());
|
||||
if os::path_exists(&result) {
|
||||
Some(result)
|
||||
}
|
||||
else {
|
||||
error!(fmt!("output_in_workspace: %s does not exist", result.to_str()));
|
||||
error2!("output_in_workspace: {} does not exist", result.to_str());
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -181,14 +181,14 @@ pub fn installed_library_in_workspace(pkg_path: &Path, workspace: &Path) -> Opti
|
||||
/// `short_name` is taken as the link name of the library.
|
||||
pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
|
||||
workspace: &Path, prefix: &str, version: &Version) -> Option<Path> {
|
||||
debug!("library_in_workspace: checking whether a library named %s exists",
|
||||
debug2!("library_in_workspace: checking whether a library named {} exists",
|
||||
short_name);
|
||||
|
||||
// We don't know what the hash is, so we have to search through the directory
|
||||
// contents
|
||||
|
||||
debug!("short_name = %s where = %? workspace = %s \
|
||||
prefix = %s", short_name, where, workspace.to_str(), prefix);
|
||||
debug2!("short_name = {} where = {:?} workspace = {} \
|
||||
prefix = {}", short_name, where, workspace.to_str(), prefix);
|
||||
|
||||
let dir_to_search = match where {
|
||||
Build => target_build_dir(workspace).push_rel(path),
|
||||
@ -204,14 +204,14 @@ pub fn system_library(sysroot: &Path, lib_name: &str) -> Option<Path> {
|
||||
}
|
||||
|
||||
fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> {
|
||||
debug!("Listing directory %s", dir_to_search.to_str());
|
||||
debug2!("Listing directory {}", dir_to_search.to_str());
|
||||
let dir_contents = os::list_dir(dir_to_search);
|
||||
debug!("dir has %? entries", dir_contents.len());
|
||||
debug2!("dir has {:?} entries", dir_contents.len());
|
||||
|
||||
let lib_prefix = fmt!("%s%s", os::consts::DLL_PREFIX, short_name);
|
||||
let lib_prefix = format!("{}{}", os::consts::DLL_PREFIX, short_name);
|
||||
let lib_filetype = os::consts::DLL_SUFFIX;
|
||||
|
||||
debug!("lib_prefix = %s and lib_filetype = %s", lib_prefix, lib_filetype);
|
||||
debug2!("lib_prefix = {} and lib_filetype = {}", lib_prefix, lib_filetype);
|
||||
|
||||
// Find a filename that matches the pattern:
|
||||
// (lib_prefix)-hash-(version)(lib_suffix)
|
||||
@ -221,7 +221,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
|
||||
|
||||
let mut libraries = do paths.filter |p| {
|
||||
let extension = p.filetype();
|
||||
debug!("p = %s, p's extension is %?", p.to_str(), extension);
|
||||
debug2!("p = {}, p's extension is {:?}", p.to_str(), extension);
|
||||
match extension {
|
||||
None => false,
|
||||
Some(ref s) => lib_filetype == *s
|
||||
@ -242,12 +242,12 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
|
||||
if f_name.is_empty() { break; }
|
||||
match f_name.rfind('-') {
|
||||
Some(i) => {
|
||||
debug!("Maybe %s is a version", f_name.slice(i + 1, f_name.len()));
|
||||
debug2!("Maybe {} is a version", f_name.slice(i + 1, f_name.len()));
|
||||
match try_parsing_version(f_name.slice(i + 1, f_name.len())) {
|
||||
Some(ref found_vers) if version == found_vers => {
|
||||
match f_name.slice(0, i).rfind('-') {
|
||||
Some(j) => {
|
||||
debug!("Maybe %s equals %s", f_name.slice(0, j), lib_prefix);
|
||||
debug2!("Maybe {} equals {}", f_name.slice(0, j), lib_prefix);
|
||||
if f_name.slice(0, j) == lib_prefix {
|
||||
result_filename = Some(p_path.clone());
|
||||
}
|
||||
@ -265,7 +265,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
|
||||
} // for
|
||||
|
||||
if result_filename.is_none() {
|
||||
debug!("warning: library_in_workspace didn't find a library in %s for %s",
|
||||
debug2!("warning: library_in_workspace didn't find a library in {} for {}",
|
||||
dir_to_search.to_str(), short_name);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
|
||||
// (if result_filename != None)
|
||||
let abs_path = do result_filename.map |result_filename| {
|
||||
let absolute_path = dir_to_search.push_rel(result_filename);
|
||||
debug!("result_filename = %s", absolute_path.to_str());
|
||||
debug2!("result_filename = {}", absolute_path.to_str());
|
||||
absolute_path
|
||||
};
|
||||
|
||||
@ -295,8 +295,8 @@ pub fn target_library_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
|
||||
use conditions::bad_path::cond;
|
||||
if !os::path_is_dir(workspace) {
|
||||
cond.raise(((*workspace).clone(),
|
||||
fmt!("Workspace supplied to target_library_in_workspace \
|
||||
is not a directory! %s", workspace.to_str())));
|
||||
format!("Workspace supplied to target_library_in_workspace \
|
||||
is not a directory! {}", workspace.to_str())));
|
||||
}
|
||||
target_file_in_workspace(pkgid, workspace, Lib, Install)
|
||||
}
|
||||
@ -333,8 +333,8 @@ fn target_file_in_workspace(pkgid: &PkgId, workspace: &Path,
|
||||
(Install, _) => target_bin_dir(workspace)
|
||||
};
|
||||
if !os::path_exists(&result) && !mkdir_recursive(&result, U_RWX) {
|
||||
cond.raise((result.clone(), fmt!("target_file_in_workspace couldn't \
|
||||
create the %s dir (pkgid=%s, workspace=%s, what=%?, where=%?",
|
||||
cond.raise((result.clone(), format!("target_file_in_workspace couldn't \
|
||||
create the {} dir (pkgid={}, workspace={}, what={:?}, where={:?}",
|
||||
subdir, pkgid.to_str(), workspace.to_str(), what, where)));
|
||||
}
|
||||
mk_output_path(what, where, pkgid, result)
|
||||
@ -347,13 +347,13 @@ pub fn build_pkg_id_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
|
||||
|
||||
let mut result = target_build_dir(workspace);
|
||||
result = result.push_rel(&pkgid.path);
|
||||
debug!("Creating build dir %s for package id %s", result.to_str(),
|
||||
debug2!("Creating build dir {} for package id {}", result.to_str(),
|
||||
pkgid.to_str());
|
||||
if os::path_exists(&result) || os::mkdir_recursive(&result, U_RWX) {
|
||||
result
|
||||
}
|
||||
else {
|
||||
cond.raise((result, fmt!("Could not create directory for package %s", pkgid.to_str())))
|
||||
cond.raise((result, format!("Could not create directory for package {}", pkgid.to_str())))
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,8 +361,8 @@ pub fn build_pkg_id_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
|
||||
/// given whether we're building a library and whether we're building tests
|
||||
pub fn mk_output_path(what: OutputType, where: Target,
|
||||
pkg_id: &PkgId, workspace: Path) -> Path {
|
||||
let short_name_with_version = fmt!("%s-%s", pkg_id.short_name,
|
||||
pkg_id.version.to_str());
|
||||
let short_name_with_version = format!("{}-{}", pkg_id.short_name,
|
||||
pkg_id.version.to_str());
|
||||
// Not local_path.dir_path()! For package foo/bar/blat/, we want
|
||||
// the executable blat-0.5 to live under blat/
|
||||
let dir = match where {
|
||||
@ -371,14 +371,14 @@ pub fn mk_output_path(what: OutputType, where: Target,
|
||||
// and if we're just building, it goes in a package-specific subdir
|
||||
Build => workspace.push_rel(&pkg_id.path)
|
||||
};
|
||||
debug!("[%?:%?] mk_output_path: short_name = %s, path = %s", what, where,
|
||||
debug2!("[{:?}:{:?}] mk_output_path: short_name = {}, path = {}", what, where,
|
||||
if what == Lib { short_name_with_version.clone() } else { pkg_id.short_name.clone() },
|
||||
dir.to_str());
|
||||
let mut output_path = match what {
|
||||
// this code is duplicated from elsewhere; fix this
|
||||
Lib => dir.push(os::dll_filename(short_name_with_version)),
|
||||
// executable names *aren't* versioned
|
||||
_ => dir.push(fmt!("%s%s%s", pkg_id.short_name,
|
||||
_ => dir.push(format!("{}{}{}", pkg_id.short_name,
|
||||
match what {
|
||||
Test => "test",
|
||||
Bench => "bench",
|
||||
@ -389,7 +389,7 @@ pub fn mk_output_path(what: OutputType, where: Target,
|
||||
if !output_path.is_absolute() {
|
||||
output_path = os::getcwd().push_rel(&output_path).normalize();
|
||||
}
|
||||
debug!("mk_output_path: returning %s", output_path.to_str());
|
||||
debug2!("mk_output_path: returning {}", output_path.to_str());
|
||||
output_path
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ pub fn uninstall_package_from(workspace: &Path, pkgid: &PkgId) {
|
||||
did_something = true;
|
||||
}
|
||||
if !did_something {
|
||||
warn(fmt!("Warning: there don't seem to be any files for %s installed in %s",
|
||||
warn(format!("Warning: there don't seem to be any files for {} installed in {}",
|
||||
pkgid.to_str(), workspace.to_str()));
|
||||
}
|
||||
|
||||
@ -425,14 +425,14 @@ pub fn find_dir_using_rust_path_hack(p: &PkgId) -> Option<Path> {
|
||||
// Note that this only matches if the package ID being searched for
|
||||
// has a name that's a single component
|
||||
if dir.is_parent_of(&p.path) || dir.is_parent_of(&versionize(&p.path, &p.version)) {
|
||||
debug!("In find_dir_using_rust_path_hack: checking dir %s", dir.to_str());
|
||||
debug2!("In find_dir_using_rust_path_hack: checking dir {}", dir.to_str());
|
||||
if dir_has_file(dir, "lib.rs") || dir_has_file(dir, "main.rs")
|
||||
|| dir_has_file(dir, "test.rs") || dir_has_file(dir, "bench.rs") {
|
||||
debug!("Did find id %s in dir %s", p.to_str(), dir.to_str());
|
||||
debug2!("Did find id {} in dir {}", p.to_str(), dir.to_str());
|
||||
return Some(dir.clone());
|
||||
}
|
||||
}
|
||||
debug!("Didn't find id %s in dir %s", p.to_str(), dir.to_str())
|
||||
debug2!("Didn't find id {} in dir {}", p.to_str(), dir.to_str())
|
||||
}
|
||||
None
|
||||
}
|
||||
@ -449,7 +449,7 @@ pub fn user_set_rust_path() -> bool {
|
||||
/// Append the version string onto the end of the path's filename
|
||||
fn versionize(p: &Path, v: &Version) -> Path {
|
||||
let q = p.file_path().to_str();
|
||||
p.with_filename(fmt!("%s-%s", q, v.to_str()))
|
||||
p.with_filename(format!("{}-{}", q, v.to_str()))
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ impl<'self> PkgScript<'self> {
|
||||
let binary = os::args()[0].to_managed();
|
||||
// Build the rustc session data structures to pass
|
||||
// to the compiler
|
||||
debug!("pkgscript parse: %s", sysroot.to_str());
|
||||
debug2!("pkgscript parse: {}", sysroot.to_str());
|
||||
let options = @session::options {
|
||||
binary: binary,
|
||||
maybe_sysroot: Some(sysroot),
|
||||
@ -118,7 +118,7 @@ impl<'self> PkgScript<'self> {
|
||||
let crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate);
|
||||
let work_dir = build_pkg_id_in_workspace(id, workspace);
|
||||
|
||||
debug!("Returning package script with id %s", id.to_str());
|
||||
debug2!("Returning package script with id {}", id.to_str());
|
||||
|
||||
PkgScript {
|
||||
id: id,
|
||||
@ -138,10 +138,10 @@ impl<'self> PkgScript<'self> {
|
||||
sysroot: &Path) -> (~[~str], ExitCode) {
|
||||
let sess = self.sess;
|
||||
|
||||
debug!("Working directory = %s", self.build_dir.to_str());
|
||||
debug2!("Working directory = {}", self.build_dir.to_str());
|
||||
// Collect together any user-defined commands in the package script
|
||||
let crate = util::ready_crate(sess, self.crate.take_unwrap());
|
||||
debug!("Building output filenames with script name %s",
|
||||
debug2!("Building output filenames with script name {}",
|
||||
driver::source_name(&driver::file_input(self.input.clone())));
|
||||
let exe = self.build_dir.push(~"pkg" + util::exe_suffix());
|
||||
util::compile_crate_from_input(&self.input,
|
||||
@ -150,7 +150,7 @@ impl<'self> PkgScript<'self> {
|
||||
&self.build_dir,
|
||||
sess,
|
||||
crate);
|
||||
debug!("Running program: %s %s %s", exe.to_str(),
|
||||
debug2!("Running program: {} {} {}", exe.to_str(),
|
||||
sysroot.to_str(), "install");
|
||||
// Discover the output
|
||||
exec.discover_output("binary", exe.to_str(), digest_only_date(&exe));
|
||||
@ -160,7 +160,7 @@ impl<'self> PkgScript<'self> {
|
||||
return (~[], status);
|
||||
}
|
||||
else {
|
||||
debug!("Running program (configs): %s %s %s",
|
||||
debug2!("Running program (configs): {} {} {}",
|
||||
exe.to_str(), sysroot.to_str(), "configs");
|
||||
let output = run::process_output(exe.to_str(), [sysroot.to_str(), ~"configs"]);
|
||||
// Run the configs() function to get the configs
|
||||
@ -223,7 +223,7 @@ impl CtxMethods for BuildContext {
|
||||
let pkgid = PkgId::new(args[0].clone());
|
||||
let mut dest_ws = None;
|
||||
do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| {
|
||||
debug!("found pkg %s in workspace %s, trying to build",
|
||||
debug2!("found pkg {} in workspace {}, trying to build",
|
||||
pkgid.to_str(), workspace.to_str());
|
||||
let mut pkg_src = PkgSrc::new(workspace.clone(), false, pkgid.clone());
|
||||
dest_ws = Some(self.build(&mut pkg_src, what));
|
||||
@ -290,7 +290,7 @@ impl CtxMethods for BuildContext {
|
||||
// argument
|
||||
let pkgid = PkgId::new(args[0]);
|
||||
let workspaces = pkg_parent_workspaces(&self.context, &pkgid);
|
||||
debug!("package ID = %s, found it in %? workspaces",
|
||||
debug2!("package ID = {}, found it in {:?} workspaces",
|
||||
pkgid.to_str(), workspaces.len());
|
||||
if workspaces.is_empty() {
|
||||
let rp = rust_path();
|
||||
@ -349,7 +349,8 @@ impl CtxMethods for BuildContext {
|
||||
|
||||
let pkgid = PkgId::new(args[0]);
|
||||
if !installed_packages::package_is_installed(&pkgid) {
|
||||
warn(fmt!("Package %s doesn't seem to be installed! Doing nothing.", args[0]));
|
||||
warn(format!("Package {} doesn't seem to be installed! \
|
||||
Doing nothing.", args[0]));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -357,7 +358,7 @@ impl CtxMethods for BuildContext {
|
||||
assert!(!rp.is_empty());
|
||||
do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| {
|
||||
path_util::uninstall_package_from(workspace, &pkgid);
|
||||
note(fmt!("Uninstalled package %s (was installed in %s)",
|
||||
note(format!("Uninstalled package {} (was installed in {})",
|
||||
pkgid.to_str(), workspace.to_str()));
|
||||
true
|
||||
};
|
||||
@ -370,13 +371,13 @@ impl CtxMethods for BuildContext {
|
||||
|
||||
self.unprefer(args[0], None);
|
||||
}
|
||||
_ => fail!(fmt!("I don't know the command `%s`", cmd))
|
||||
_ => fail2!("I don't know the command `{}`", cmd)
|
||||
}
|
||||
}
|
||||
|
||||
fn do_cmd(&self, _cmd: &str, _pkgname: &str) {
|
||||
// stub
|
||||
fail!("`do` not yet implemented");
|
||||
fail2!("`do` not yet implemented");
|
||||
}
|
||||
|
||||
/// Returns the destination workspace
|
||||
@ -387,8 +388,8 @@ impl CtxMethods for BuildContext {
|
||||
let workspace = pkg_src.workspace.clone();
|
||||
let pkgid = pkg_src.id.clone();
|
||||
|
||||
debug!("build: workspace = %s (in Rust path? %? is git dir? %? \
|
||||
pkgid = %s pkgsrc start_dir = %s", workspace.to_str(),
|
||||
debug2!("build: workspace = {} (in Rust path? {:?} is git dir? {:?} \
|
||||
pkgid = {} pkgsrc start_dir = {}", workspace.to_str(),
|
||||
in_rust_path(&workspace), is_git_dir(&workspace.push_rel(&pkgid.path)),
|
||||
pkgid.to_str(), pkg_src.start_dir.to_str());
|
||||
|
||||
@ -399,16 +400,16 @@ impl CtxMethods for BuildContext {
|
||||
source_control::git_clone(&workspace.push_rel(&pkgid.path),
|
||||
&out_dir, &pkgid.version);
|
||||
let default_ws = default_workspace();
|
||||
debug!("Calling build recursively with %? and %?", default_ws.to_str(),
|
||||
debug2!("Calling build recursively with {:?} and {:?}", default_ws.to_str(),
|
||||
pkgid.to_str());
|
||||
return self.build(&mut PkgSrc::new(default_ws, false, pkgid.clone()), what_to_build);
|
||||
}
|
||||
|
||||
// Is there custom build logic? If so, use it
|
||||
let mut custom = false;
|
||||
debug!("Package source directory = %s", pkg_src.to_str());
|
||||
debug2!("Package source directory = {}", pkg_src.to_str());
|
||||
let opt = pkg_src.package_script_option();
|
||||
debug!("Calling pkg_script_option on %?", opt);
|
||||
debug2!("Calling pkg_script_option on {:?}", opt);
|
||||
let cfgs = match pkg_src.package_script_option() {
|
||||
Some(package_script_path) => {
|
||||
let sysroot = self.sysroot_to_use();
|
||||
@ -428,16 +429,16 @@ impl CtxMethods for BuildContext {
|
||||
pscript.run_custom(exec, &sub_sysroot)
|
||||
}
|
||||
};
|
||||
debug!("Command return code = %?", hook_result);
|
||||
debug2!("Command return code = {:?}", hook_result);
|
||||
if hook_result != 0 {
|
||||
fail!("Error running custom build command")
|
||||
fail2!("Error running custom build command")
|
||||
}
|
||||
custom = true;
|
||||
// otherwise, the package script succeeded
|
||||
cfgs
|
||||
}
|
||||
None => {
|
||||
debug!("No package script, continuing");
|
||||
debug2!("No package script, continuing");
|
||||
~[]
|
||||
}
|
||||
} + self.context.cfgs;
|
||||
@ -454,7 +455,7 @@ impl CtxMethods for BuildContext {
|
||||
&JustOne(ref p) => {
|
||||
// We expect that p is relative to the package source's start directory,
|
||||
// so check that assumption
|
||||
debug!("JustOne: p = %s", p.to_str());
|
||||
debug2!("JustOne: p = {}", p.to_str());
|
||||
assert!(os::path_exists(&pkg_src.start_dir.push_rel(p)));
|
||||
if is_lib(p) {
|
||||
PkgSrc::push_crate(&mut pkg_src.libs, 0, p);
|
||||
@ -465,7 +466,7 @@ impl CtxMethods for BuildContext {
|
||||
} else if is_bench(p) {
|
||||
PkgSrc::push_crate(&mut pkg_src.benchs, 0, p);
|
||||
} else {
|
||||
warn(fmt!("Not building any crates for dependency %s", p.to_str()));
|
||||
warn(format!("Not building any crates for dependency {}", p.to_str()));
|
||||
return workspace.clone();
|
||||
}
|
||||
}
|
||||
@ -486,19 +487,19 @@ impl CtxMethods for BuildContext {
|
||||
// Do something reasonable for now
|
||||
|
||||
let dir = build_pkg_id_in_workspace(id, workspace);
|
||||
note(fmt!("Cleaning package %s (removing directory %s)",
|
||||
note(format!("Cleaning package {} (removing directory {})",
|
||||
id.to_str(), dir.to_str()));
|
||||
if os::path_exists(&dir) {
|
||||
os::remove_dir_recursive(&dir);
|
||||
note(fmt!("Removed directory %s", dir.to_str()));
|
||||
note(format!("Removed directory {}", dir.to_str()));
|
||||
}
|
||||
|
||||
note(fmt!("Cleaned package %s", id.to_str()));
|
||||
note(format!("Cleaned package {}", id.to_str()));
|
||||
}
|
||||
|
||||
fn info(&self) {
|
||||
// stub
|
||||
fail!("info not yet implemented");
|
||||
fail2!("info not yet implemented");
|
||||
}
|
||||
|
||||
fn install(&self, mut pkg_src: PkgSrc, what: &WhatToBuild) -> (~[Path], ~[(~str, ~str)]) {
|
||||
@ -514,11 +515,11 @@ impl CtxMethods for BuildContext {
|
||||
|
||||
let to_do = ~[pkg_src.libs.clone(), pkg_src.mains.clone(),
|
||||
pkg_src.tests.clone(), pkg_src.benchs.clone()];
|
||||
debug!("In declare inputs for %s", id.to_str());
|
||||
debug2!("In declare inputs for {}", id.to_str());
|
||||
for cs in to_do.iter() {
|
||||
for c in cs.iter() {
|
||||
let path = pkg_src.start_dir.push_rel(&c.file).normalize();
|
||||
debug!("Recording input: %s", path.to_str());
|
||||
debug2!("Recording input: {}", path.to_str());
|
||||
installed_files.push(path);
|
||||
}
|
||||
}
|
||||
@ -532,15 +533,15 @@ impl CtxMethods for BuildContext {
|
||||
else {
|
||||
Path(destination_workspace)
|
||||
};
|
||||
debug!("install: destination workspace = %s, id = %s, installing to %s",
|
||||
debug2!("install: destination workspace = {}, id = {}, installing to {}",
|
||||
destination_workspace, id.to_str(), actual_workspace.to_str());
|
||||
let result = self.install_no_build(&Path(destination_workspace),
|
||||
&actual_workspace,
|
||||
&id).map(|s| Path(*s));
|
||||
debug!("install: id = %s, about to call discover_outputs, %?",
|
||||
debug2!("install: id = {}, about to call discover_outputs, {:?}",
|
||||
id.to_str(), result.to_str());
|
||||
installed_files = installed_files + result;
|
||||
note(fmt!("Installed package %s to %s", id.to_str(), actual_workspace.to_str()));
|
||||
note(format!("Installed package {} to {}", id.to_str(), actual_workspace.to_str()));
|
||||
(installed_files, inputs)
|
||||
}
|
||||
|
||||
@ -557,8 +558,8 @@ impl CtxMethods for BuildContext {
|
||||
let target_exec = target_executable_in_workspace(id, target_workspace);
|
||||
let target_lib = maybe_library.map(|_p| target_library_in_workspace(id, target_workspace));
|
||||
|
||||
debug!("target_exec = %s target_lib = %? \
|
||||
maybe_executable = %? maybe_library = %?",
|
||||
debug2!("target_exec = {} target_lib = {:?} \
|
||||
maybe_executable = {:?} maybe_library = {:?}",
|
||||
target_exec.to_str(), target_lib,
|
||||
maybe_executable, maybe_library);
|
||||
|
||||
@ -582,7 +583,7 @@ impl CtxMethods for BuildContext {
|
||||
let mut outputs = ~[];
|
||||
|
||||
for exec in subex.iter() {
|
||||
debug!("Copying: %s -> %s", exec.to_str(), sub_target_ex.to_str());
|
||||
debug2!("Copying: {} -> {}", exec.to_str(), sub_target_ex.to_str());
|
||||
if !(os::mkdir_recursive(&sub_target_ex.dir_path(), U_RWX) &&
|
||||
os::copy_file(exec, &sub_target_ex)) {
|
||||
cond.raise(((*exec).clone(), sub_target_ex.clone()));
|
||||
@ -594,11 +595,11 @@ impl CtxMethods for BuildContext {
|
||||
}
|
||||
for lib in sublib.iter() {
|
||||
let target_lib = sub_target_lib
|
||||
.clone().expect(fmt!("I built %s but apparently \
|
||||
.clone().expect(format!("I built {} but apparently \
|
||||
didn't install it!", lib.to_str()));
|
||||
let target_lib = target_lib
|
||||
.pop().push(lib.filename().expect("weird target lib"));
|
||||
debug!("Copying: %s -> %s", lib.to_str(), sub_target_lib.to_str());
|
||||
debug2!("Copying: {} -> {}", lib.to_str(), sub_target_lib.to_str());
|
||||
if !(os::mkdir_recursive(&target_lib.dir_path(), U_RWX) &&
|
||||
os::copy_file(lib, &target_lib)) {
|
||||
cond.raise(((*lib).clone(), target_lib.clone()));
|
||||
@ -614,18 +615,18 @@ impl CtxMethods for BuildContext {
|
||||
}
|
||||
|
||||
fn prefer(&self, _id: &str, _vers: Option<~str>) {
|
||||
fail!("prefer not yet implemented");
|
||||
fail2!("prefer not yet implemented");
|
||||
}
|
||||
|
||||
fn test(&self, pkgid: &PkgId, workspace: &Path) {
|
||||
match built_test_in_workspace(pkgid, workspace) {
|
||||
Some(test_exec) => {
|
||||
debug!("test: test_exec = %s", test_exec.to_str());
|
||||
debug2!("test: test_exec = {}", test_exec.to_str());
|
||||
let status = run::process_status(test_exec.to_str(), [~"--test"]);
|
||||
os::set_exit_status(status);
|
||||
}
|
||||
None => {
|
||||
error(fmt!("Internal error: test executable for package ID %s in workspace %s \
|
||||
error(format!("Internal error: test executable for package ID {} in workspace {} \
|
||||
wasn't built! Please report this as a bug.",
|
||||
pkgid.to_str(), workspace.to_str()));
|
||||
}
|
||||
@ -640,11 +641,11 @@ impl CtxMethods for BuildContext {
|
||||
}
|
||||
|
||||
fn uninstall(&self, _id: &str, _vers: Option<~str>) {
|
||||
fail!("uninstall not yet implemented");
|
||||
fail2!("uninstall not yet implemented");
|
||||
}
|
||||
|
||||
fn unprefer(&self, _id: &str, _vers: Option<~str>) {
|
||||
fail!("unprefer not yet implemented");
|
||||
fail2!("unprefer not yet implemented");
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,7 +678,7 @@ pub fn main_args(args: &[~str]) -> int {
|
||||
let matches = &match getopts::getopts(args, opts) {
|
||||
result::Ok(m) => m,
|
||||
result::Err(f) => {
|
||||
error(fmt!("%s", f.to_err_msg()));
|
||||
error(format!("{}", f.to_err_msg()));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -812,8 +813,8 @@ pub fn main_args(args: &[~str]) -> int {
|
||||
_ => filesearch::get_or_default_sysroot()
|
||||
};
|
||||
|
||||
debug!("Using sysroot: %s", sroot.to_str());
|
||||
debug!("Will store workcache in %s", default_workspace().to_str());
|
||||
debug2!("Using sysroot: {}", sroot.to_str());
|
||||
debug2!("Will store workcache in {}", default_workspace().to_str());
|
||||
|
||||
let rm_args = remaining_args.clone();
|
||||
let sub_cmd = cmd.clone();
|
||||
|
@ -17,7 +17,8 @@ use version::Version;
|
||||
/// FIXME #8711: This ignores the desired version.
|
||||
pub fn find_installed_library_in_rust_path(pkg_path: &Path, _version: &Version) -> Option<Path> {
|
||||
let rp = rust_path();
|
||||
debug!("find_installed_library_in_rust_path: looking for path %s", pkg_path.to_str());
|
||||
debug2!("find_installed_library_in_rust_path: looking for path {}",
|
||||
pkg_path.to_str());
|
||||
for p in rp.iter() {
|
||||
match installed_library_in_workspace(pkg_path, p) {
|
||||
Some(path) => return Some(path),
|
||||
|
@ -19,26 +19,26 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
|
||||
assert!(os::path_is_dir(source));
|
||||
assert!(is_git_dir(source));
|
||||
if !os::path_exists(target) {
|
||||
debug!("Running: git clone %s %s", source.to_str(), target.to_str());
|
||||
debug2!("Running: git clone {} {}", source.to_str(), target.to_str());
|
||||
let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
|
||||
if outp.status != 0 {
|
||||
io::println(str::from_utf8_owned(outp.output.clone()));
|
||||
io::println(str::from_utf8_owned(outp.error));
|
||||
fail!("Couldn't `git clone` %s", source.to_str());
|
||||
fail2!("Couldn't `git clone` {}", source.to_str());
|
||||
}
|
||||
else {
|
||||
match v {
|
||||
&ExactRevision(ref s) => {
|
||||
debug!("`Running: git --work-tree=%s --git-dir=%s checkout %s",
|
||||
debug2!("`Running: git --work-tree={} --git-dir={} checkout {}",
|
||||
*s, target.to_str(), target.push(".git").to_str());
|
||||
let outp = run::process_output("git",
|
||||
[fmt!("--work-tree=%s", target.to_str()),
|
||||
fmt!("--git-dir=%s", target.push(".git").to_str()),
|
||||
~"checkout", fmt!("%s", *s)]);
|
||||
[format!("--work-tree={}", target.to_str()),
|
||||
format!("--git-dir={}", target.push(".git").to_str()),
|
||||
~"checkout", format!("{}", *s)]);
|
||||
if outp.status != 0 {
|
||||
io::println(str::from_utf8_owned(outp.output.clone()));
|
||||
io::println(str::from_utf8_owned(outp.error));
|
||||
fail!("Couldn't `git checkout %s` in %s",
|
||||
fail2!("Couldn't `git checkout {}` in {}",
|
||||
*s, target.to_str());
|
||||
}
|
||||
}
|
||||
@ -50,11 +50,12 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
|
||||
// Check that no version was specified. There's no reason to not handle the
|
||||
// case where a version was requested, but I haven't implemented it.
|
||||
assert!(*v == NoVersion);
|
||||
debug!("Running: git --work-tree=%s --git-dir=%s pull --no-edit %s",
|
||||
debug2!("Running: git --work-tree={} --git-dir={} pull --no-edit {}",
|
||||
target.to_str(), target.push(".git").to_str(), source.to_str());
|
||||
let outp = run::process_output("git", [fmt!("--work-tree=%s", target.to_str()),
|
||||
fmt!("--git-dir=%s", target.push(".git").to_str()),
|
||||
~"pull", ~"--no-edit", source.to_str()]);
|
||||
let args = [format!("--work-tree={}", target.to_str()),
|
||||
format!("--git-dir={}", target.push(".git").to_str()),
|
||||
~"pull", ~"--no-edit", source.to_str()];
|
||||
let outp = run::process_output("git", args);
|
||||
assert!(outp.status == 0);
|
||||
}
|
||||
}
|
||||
@ -64,18 +65,18 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) {
|
||||
pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
|
||||
let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
|
||||
if outp.status != 0 {
|
||||
debug!(str::from_utf8_owned(outp.output.clone()));
|
||||
debug!(str::from_utf8_owned(outp.error));
|
||||
debug2!("{}", str::from_utf8_owned(outp.output.clone()));
|
||||
debug2!("{}", str::from_utf8_owned(outp.error));
|
||||
false
|
||||
}
|
||||
else {
|
||||
match v {
|
||||
&ExactRevision(ref s) | &Tagged(ref s) => {
|
||||
let outp = process_output_in_cwd("git", [~"checkout", fmt!("%s", *s)],
|
||||
let outp = process_output_in_cwd("git", [~"checkout", format!("{}", *s)],
|
||||
target);
|
||||
if outp.status != 0 {
|
||||
debug!(str::from_utf8_owned(outp.output.clone()));
|
||||
debug!(str::from_utf8_owned(outp.error));
|
||||
debug2!("{}", str::from_utf8_owned(outp.output.clone()));
|
||||
debug2!("{}", str::from_utf8_owned(outp.error));
|
||||
false
|
||||
}
|
||||
else {
|
||||
|
@ -91,24 +91,24 @@ fn mk_empty_workspace(short_name: &Path, version: &Version, tag: &str) -> Path {
|
||||
|
||||
fn mk_workspace(workspace: &Path, short_name: &Path, version: &Version) -> Path {
|
||||
// include version number in directory name
|
||||
let package_dir = workspace.push_many([~"src", fmt!("%s-%s",
|
||||
short_name.to_str(), version.to_str())]);
|
||||
let package_dir = workspace.push_many([~"src", format!("{}-{}",
|
||||
short_name.to_str(), version.to_str())]);
|
||||
assert!(os::mkdir_recursive(&package_dir, U_RWX));
|
||||
package_dir
|
||||
}
|
||||
|
||||
fn mk_temp_workspace(short_name: &Path, version: &Version) -> Path {
|
||||
let package_dir = mk_empty_workspace(short_name,
|
||||
version, "temp_workspace").push_many([~"src", fmt!("%s-%s",
|
||||
version, "temp_workspace").push_many([~"src", format!("{}-{}",
|
||||
short_name.to_str(),
|
||||
version.to_str())]);
|
||||
|
||||
debug!("Created %s and does it exist? %?", package_dir.to_str(),
|
||||
debug2!("Created {} and does it exist? {:?}", package_dir.to_str(),
|
||||
os::path_is_dir(&package_dir));
|
||||
// Create main, lib, test, and bench files
|
||||
debug!("mk_workspace: creating %s", package_dir.to_str());
|
||||
debug2!("mk_workspace: creating {}", package_dir.to_str());
|
||||
assert!(os::mkdir_recursive(&package_dir, U_RWX));
|
||||
debug!("Created %s and does it exist? %?", package_dir.to_str(),
|
||||
debug2!("Created {} and does it exist? {:?}", package_dir.to_str(),
|
||||
os::path_is_dir(&package_dir));
|
||||
// Create main, lib, test, and bench files
|
||||
|
||||
@ -134,7 +134,7 @@ fn run_git(args: &[~str], env: Option<~[(~str, ~str)]>, cwd: &Path, err_msg: &st
|
||||
});
|
||||
let rslt = prog.finish_with_output();
|
||||
if rslt.status != 0 {
|
||||
fail!("%s [git returned %?, output = %s, error = %s]", err_msg,
|
||||
fail2!("{} [git returned {:?}, output = {}, error = {}]", err_msg,
|
||||
rslt.status, str::from_utf8(rslt.output), str::from_utf8(rslt.error));
|
||||
}
|
||||
}
|
||||
@ -147,13 +147,13 @@ fn init_git_repo(p: &Path) -> Path {
|
||||
let work_dir = tmp.push_rel(p);
|
||||
let work_dir_for_opts = work_dir.clone();
|
||||
assert!(os::mkdir_recursive(&work_dir, U_RWX));
|
||||
debug!("Running: git init in %s", work_dir.to_str());
|
||||
debug2!("Running: git init in {}", work_dir.to_str());
|
||||
let ws = work_dir.to_str();
|
||||
run_git([~"init"], None, &work_dir_for_opts,
|
||||
fmt!("Couldn't initialize git repository in %s", ws));
|
||||
format!("Couldn't initialize git repository in {}", ws));
|
||||
// Add stuff to the dir so that git tag succeeds
|
||||
writeFile(&work_dir.push("README"), "");
|
||||
run_git([~"add", ~"README"], None, &work_dir_for_opts, fmt!("Couldn't add in %s", ws));
|
||||
run_git([~"add", ~"README"], None, &work_dir_for_opts, format!("Couldn't add in {}", ws));
|
||||
git_commit(&work_dir_for_opts, ~"whatever");
|
||||
tmp
|
||||
}
|
||||
@ -165,11 +165,11 @@ fn add_all_and_commit(repo: &Path) {
|
||||
|
||||
fn git_commit(repo: &Path, msg: ~str) {
|
||||
run_git([~"commit", ~"--author=tester <test@mozilla.com>", ~"-m", msg],
|
||||
None, repo, fmt!("Couldn't commit in %s", repo.to_str()));
|
||||
None, repo, format!("Couldn't commit in {}", repo.to_str()));
|
||||
}
|
||||
|
||||
fn git_add_all(repo: &Path) {
|
||||
run_git([~"add", ~"-A"], None, repo, fmt!("Couldn't add all files in %s", repo.to_str()));
|
||||
run_git([~"add", ~"-A"], None, repo, format!("Couldn't add all files in {}", repo.to_str()));
|
||||
}
|
||||
|
||||
fn add_git_tag(repo: &Path, tag: ~str) {
|
||||
@ -177,7 +177,7 @@ fn add_git_tag(repo: &Path, tag: ~str) {
|
||||
git_add_all(repo);
|
||||
git_commit(repo, ~"whatever");
|
||||
run_git([~"tag", tag.clone()], None, repo,
|
||||
fmt!("Couldn't add git tag %s in %s", tag, repo.to_str()));
|
||||
format!("Couldn't add git tag {} in {}", tag, repo.to_str()));
|
||||
}
|
||||
|
||||
fn is_rwx(p: &Path) -> bool {
|
||||
@ -214,7 +214,7 @@ fn rustpkg_exec() -> Path {
|
||||
second_try
|
||||
}
|
||||
else {
|
||||
fail!("in rustpkg test, can't find an installed rustpkg");
|
||||
fail2!("in rustpkg test, can't find an installed rustpkg");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,7 @@ fn rustpkg_exec() -> Path {
|
||||
fn command_line_test(args: &[~str], cwd: &Path) -> ProcessOutput {
|
||||
match command_line_test_with_env(args, cwd, None) {
|
||||
Success(r) => r,
|
||||
_ => fail!("Command line test failed")
|
||||
_ => fail2!("Command line test failed")
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,10 +242,10 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s
|
||||
-> ProcessResult {
|
||||
let cmd = rustpkg_exec().to_str();
|
||||
let env_str = match env {
|
||||
Some(ref pairs) => pairs.map(|&(ref k, ref v)| { fmt!("%s=%s", *k, *v) }).connect(","),
|
||||
Some(ref pairs) => pairs.map(|&(ref k, ref v)| { format!("{}={}", *k, *v) }).connect(","),
|
||||
None => ~""
|
||||
};
|
||||
debug!("%s cd %s; %s %s", env_str, cwd.to_str(), cmd, args.connect(" "));
|
||||
debug2!("{} cd {}; {} {}", env_str, cwd.to_str(), cmd, args.connect(" "));
|
||||
assert!(os::path_is_dir(&*cwd));
|
||||
let cwd = (*cwd).clone();
|
||||
let mut prog = run::Process::new(cmd, args, run::ProcessOptions {
|
||||
@ -256,7 +256,7 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s
|
||||
err_fd: None
|
||||
});
|
||||
let output = prog.finish_with_output();
|
||||
debug!("Output from command %s with args %? was %s {%s}[%?]",
|
||||
debug2!("Output from command {} with args {:?} was {} \\{{}\\}[{:?}]",
|
||||
cmd, args, str::from_utf8(output.output),
|
||||
str::from_utf8(output.error),
|
||||
output.status);
|
||||
@ -267,7 +267,7 @@ So tests that use this need to check the existence of a file
|
||||
to make sure the command succeeded
|
||||
*/
|
||||
if output.status != 0 {
|
||||
debug!("Command %s %? failed with exit code %?; its output was {{{ %s }}}",
|
||||
debug2!("Command {} {:?} failed with exit code {:?}; its output was --- {} ---",
|
||||
cmd, args, output.status,
|
||||
str::from_utf8(output.output) + str::from_utf8(output.error));
|
||||
Fail(output.status)
|
||||
@ -279,7 +279,7 @@ to make sure the command succeeded
|
||||
|
||||
fn create_local_package(pkgid: &PkgId) -> Path {
|
||||
let parent_dir = mk_temp_workspace(&pkgid.path, &pkgid.version);
|
||||
debug!("Created empty package dir for %s, returning %s", pkgid.to_str(), parent_dir.to_str());
|
||||
debug2!("Created empty package dir for {}, returning {}", pkgid.to_str(), parent_dir.to_str());
|
||||
parent_dir.pop().pop()
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ fn create_local_package_in(pkgid: &PkgId, pkgdir: &Path) -> Path {
|
||||
|
||||
// Create main, lib, test, and bench files
|
||||
assert!(os::mkdir_recursive(&package_dir, U_RWX));
|
||||
debug!("Created %s and does it exist? %?", package_dir.to_str(),
|
||||
debug2!("Created {} and does it exist? {:?}", package_dir.to_str(),
|
||||
os::path_is_dir(&package_dir));
|
||||
// Create main, lib, test, and bench files
|
||||
|
||||
@ -305,7 +305,7 @@ fn create_local_package_in(pkgid: &PkgId, pkgdir: &Path) -> Path {
|
||||
}
|
||||
|
||||
fn create_local_package_with_test(pkgid: &PkgId) -> Path {
|
||||
debug!("Dry run -- would create package %s with test");
|
||||
debug2!("Dry run -- would create package {:?} with test", pkgid);
|
||||
create_local_package(pkgid) // Already has tests???
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ fn create_local_package_with_dep(pkgid: &PkgId, subord_pkgid: &PkgId) -> Path {
|
||||
create_local_package_in(subord_pkgid, &package_dir);
|
||||
// Write a main.rs file into pkgid that references subord_pkgid
|
||||
writeFile(&package_dir.push_many([~"src", pkgid.to_str(), ~"main.rs"]),
|
||||
fmt!("extern mod %s;\nfn main() {}",
|
||||
format!("extern mod {};\nfn main() \\{\\}",
|
||||
subord_pkgid.short_name));
|
||||
// Write a lib.rs file into subord_pkgid that has something in it
|
||||
writeFile(&package_dir.push_many([~"src", subord_pkgid.to_str(), ~"lib.rs"]),
|
||||
@ -324,7 +324,7 @@ fn create_local_package_with_dep(pkgid: &PkgId, subord_pkgid: &PkgId) -> Path {
|
||||
|
||||
fn create_local_package_with_custom_build_hook(pkgid: &PkgId,
|
||||
custom_build_hook: &str) -> Path {
|
||||
debug!("Dry run -- would create package %s with custom build hook %s",
|
||||
debug2!("Dry run -- would create package {} with custom build hook {}",
|
||||
pkgid.to_str(), custom_build_hook);
|
||||
create_local_package(pkgid)
|
||||
// actually write the pkg.rs with the custom build hook
|
||||
@ -336,9 +336,9 @@ fn assert_lib_exists(repo: &Path, pkg_path: &Path, v: Version) {
|
||||
}
|
||||
|
||||
fn lib_exists(repo: &Path, pkg_path: &Path, _v: Version) -> bool { // ??? version?
|
||||
debug!("assert_lib_exists: repo = %s, pkg_path = %s", repo.to_str(), pkg_path.to_str());
|
||||
debug2!("assert_lib_exists: repo = {}, pkg_path = {}", repo.to_str(), pkg_path.to_str());
|
||||
let lib = installed_library_in_workspace(pkg_path, repo);
|
||||
debug!("assert_lib_exists: checking whether %? exists", lib);
|
||||
debug2!("assert_lib_exists: checking whether {:?} exists", lib);
|
||||
lib.is_some() && {
|
||||
let libname = lib.get_ref();
|
||||
os::path_exists(libname) && is_rwx(libname)
|
||||
@ -350,13 +350,13 @@ fn assert_executable_exists(repo: &Path, short_name: &str) {
|
||||
}
|
||||
|
||||
fn executable_exists(repo: &Path, short_name: &str) -> bool {
|
||||
debug!("executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
|
||||
debug2!("executable_exists: repo = {}, short_name = {}", repo.to_str(), short_name);
|
||||
let exec = target_executable_in_workspace(&PkgId::new(short_name), repo);
|
||||
os::path_exists(&exec) && is_rwx(&exec)
|
||||
}
|
||||
|
||||
fn test_executable_exists(repo: &Path, short_name: &str) -> bool {
|
||||
debug!("test_executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
|
||||
debug2!("test_executable_exists: repo = {}, short_name = {}", repo.to_str(), short_name);
|
||||
let exec = built_test_in_workspace(&PkgId::new(short_name), repo);
|
||||
do exec.map_default(false) |exec| {
|
||||
os::path_exists(exec) && is_rwx(exec)
|
||||
@ -375,7 +375,8 @@ fn assert_built_executable_exists(repo: &Path, short_name: &str) {
|
||||
}
|
||||
|
||||
fn built_executable_exists(repo: &Path, short_name: &str) -> bool {
|
||||
debug!("assert_built_executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
|
||||
debug2!("assert_built_executable_exists: repo = {}, short_name = {}",
|
||||
repo.to_str(), short_name);
|
||||
let exec = built_executable_in_workspace(&PkgId::new(short_name), repo);
|
||||
exec.is_some() && {
|
||||
let execname = exec.get_ref();
|
||||
@ -409,7 +410,7 @@ fn llvm_bitcode_file_exists(repo: &Path, short_name: &str) -> bool {
|
||||
|
||||
fn file_exists(repo: &Path, short_name: &str, extension: &str) -> bool {
|
||||
os::path_exists(&target_build_dir(repo).push_many([short_name.to_owned(),
|
||||
fmt!("%s.%s", short_name, extension)]))
|
||||
format!("{}.{}", short_name, extension)]))
|
||||
}
|
||||
|
||||
fn assert_built_library_exists(repo: &Path, short_name: &str) {
|
||||
@ -417,7 +418,7 @@ fn assert_built_library_exists(repo: &Path, short_name: &str) {
|
||||
}
|
||||
|
||||
fn built_library_exists(repo: &Path, short_name: &str) -> bool {
|
||||
debug!("assert_built_library_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
|
||||
debug2!("assert_built_library_exists: repo = {}, short_name = {}", repo.to_str(), short_name);
|
||||
let lib = built_library_in_workspace(&PkgId::new(short_name), repo);
|
||||
lib.is_some() && {
|
||||
let libname = lib.get_ref();
|
||||
@ -439,7 +440,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~
|
||||
let mut result = ~[];
|
||||
let p_output = match command_line_test_with_env(args,
|
||||
&os::getcwd(), Some(env)) {
|
||||
Fail(_) => fail!("Command-line test failed"),
|
||||
Fail(_) => fail2!("Command-line test failed"),
|
||||
Success(r) => r
|
||||
};
|
||||
let test_output = str::from_utf8(p_output.output);
|
||||
@ -451,7 +452,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~
|
||||
|
||||
// assumes short_name and path are one and the same -- I should fix
|
||||
fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path {
|
||||
debug!("lib_output_file_name: given %s and short name %s",
|
||||
debug2!("lib_output_file_name: given {} and short name {}",
|
||||
workspace.to_str(), short_name);
|
||||
library_in_workspace(&Path(short_name),
|
||||
short_name,
|
||||
@ -462,7 +463,7 @@ fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path {
|
||||
}
|
||||
|
||||
fn output_file_name(workspace: &Path, short_name: ~str) -> Path {
|
||||
target_build_dir(workspace).push(short_name).push(fmt!("%s%s", short_name, os::EXE_SUFFIX))
|
||||
target_build_dir(workspace).push(short_name).push(format!("{}{}", short_name, os::EXE_SUFFIX))
|
||||
}
|
||||
|
||||
fn touch_source_file(workspace: &Path, pkgid: &PkgId) {
|
||||
@ -485,20 +486,20 @@ fn frob_source_file(workspace: &Path, pkgid: &PkgId, filename: &str) {
|
||||
let pkg_src_dir = workspace.push_many([~"src", pkgid.to_str()]);
|
||||
let mut maybe_p = None;
|
||||
let maybe_file = pkg_src_dir.push(filename);
|
||||
debug!("Trying to frob %s -- %s", pkg_src_dir.to_str(), filename);
|
||||
debug2!("Trying to frob {} -- {}", pkg_src_dir.to_str(), filename);
|
||||
if os::path_exists(&maybe_file) {
|
||||
maybe_p = Some(maybe_file);
|
||||
}
|
||||
debug!("Frobbed? %?", maybe_p);
|
||||
debug2!("Frobbed? {:?}", maybe_p);
|
||||
match maybe_p {
|
||||
Some(ref p) => {
|
||||
let w = io::file_writer(p, &[io::Append]);
|
||||
match w {
|
||||
Err(s) => { let _ = cond.raise((p.clone(), fmt!("Bad path: %s", s))); }
|
||||
Err(s) => { let _ = cond.raise((p.clone(), format!("Bad path: {}", s))); }
|
||||
Ok(w) => w.write_line("/* hi */")
|
||||
}
|
||||
}
|
||||
None => fail!(fmt!("frob_source_file failed to find a source file in %s",
|
||||
None => fail2!(format!("frob_source_file failed to find a source file in {}",
|
||||
pkg_src_dir.to_str()))
|
||||
}
|
||||
}
|
||||
@ -509,7 +510,7 @@ fn test_make_dir_rwx() {
|
||||
let dir = temp.push("quux");
|
||||
assert!(!os::path_exists(&dir) ||
|
||||
os::remove_dir_recursive(&dir));
|
||||
debug!("Trying to make %s", dir.to_str());
|
||||
debug2!("Trying to make {}", dir.to_str());
|
||||
assert!(make_dir_rwx(&dir));
|
||||
assert!(os::path_is_dir(&dir));
|
||||
assert!(is_rwx(&dir));
|
||||
@ -521,29 +522,29 @@ fn test_install_valid() {
|
||||
use path_util::installed_library_in_workspace;
|
||||
|
||||
let sysroot = test_sysroot();
|
||||
debug!("sysroot = %s", sysroot.to_str());
|
||||
debug2!("sysroot = {}", sysroot.to_str());
|
||||
let temp_pkg_id = fake_pkg();
|
||||
let temp_workspace = mk_temp_workspace(&temp_pkg_id.path, &NoVersion).pop().pop();
|
||||
let ctxt = fake_ctxt(sysroot, &temp_workspace);
|
||||
debug!("temp_workspace = %s", temp_workspace.to_str());
|
||||
debug2!("temp_workspace = {}", temp_workspace.to_str());
|
||||
// should have test, bench, lib, and main
|
||||
let src = PkgSrc::new(temp_workspace.clone(), false, temp_pkg_id.clone());
|
||||
ctxt.install(src, &Everything);
|
||||
// Check that all files exist
|
||||
let exec = target_executable_in_workspace(&temp_pkg_id, &temp_workspace);
|
||||
debug!("exec = %s", exec.to_str());
|
||||
debug2!("exec = {}", exec.to_str());
|
||||
assert!(os::path_exists(&exec));
|
||||
assert!(is_rwx(&exec));
|
||||
|
||||
let lib = installed_library_in_workspace(&temp_pkg_id.path, &temp_workspace);
|
||||
debug!("lib = %?", lib);
|
||||
debug2!("lib = {:?}", lib);
|
||||
assert!(lib.map_default(false, |l| os::path_exists(l)));
|
||||
assert!(lib.map_default(false, |l| is_rwx(l)));
|
||||
|
||||
// And that the test and bench executables aren't installed
|
||||
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, &temp_workspace)));
|
||||
let bench = target_bench_in_workspace(&temp_pkg_id, &temp_workspace);
|
||||
debug!("bench = %s", bench.to_str());
|
||||
debug2!("bench = {}", bench.to_str());
|
||||
assert!(!os::path_exists(&bench));
|
||||
}
|
||||
|
||||
@ -568,12 +569,12 @@ fn test_install_invalid() {
|
||||
#[test]
|
||||
fn test_install_git() {
|
||||
let sysroot = test_sysroot();
|
||||
debug!("sysroot = %s", sysroot.to_str());
|
||||
debug2!("sysroot = {}", sysroot.to_str());
|
||||
let temp_pkg_id = git_repo_pkg();
|
||||
let repo = init_git_repo(&temp_pkg_id.path);
|
||||
debug!("repo = %s", repo.to_str());
|
||||
debug2!("repo = {}", repo.to_str());
|
||||
let repo_subdir = repo.push_many([~"mockgithub.com", ~"catamorphism", ~"test-pkg"]);
|
||||
debug!("repo_subdir = %s", repo_subdir.to_str());
|
||||
debug2!("repo_subdir = {}", repo_subdir.to_str());
|
||||
|
||||
writeFile(&repo_subdir.push("main.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
@ -585,15 +586,15 @@ fn test_install_git() {
|
||||
"#[bench] pub fn f() { (); }");
|
||||
add_git_tag(&repo_subdir, ~"0.1"); // this has the effect of committing the files
|
||||
|
||||
debug!("test_install_git: calling rustpkg install %s in %s",
|
||||
debug2!("test_install_git: calling rustpkg install {} in {}",
|
||||
temp_pkg_id.path.to_str(), repo.to_str());
|
||||
// should have test, bench, lib, and main
|
||||
command_line_test([~"install", temp_pkg_id.path.to_str()], &repo);
|
||||
let ws = repo.push(".rust");
|
||||
// Check that all files exist
|
||||
debug!("Checking for files in %s", ws.to_str());
|
||||
debug2!("Checking for files in {}", ws.to_str());
|
||||
let exec = target_executable_in_workspace(&temp_pkg_id, &ws);
|
||||
debug!("exec = %s", exec.to_str());
|
||||
debug2!("exec = {}", exec.to_str());
|
||||
assert!(os::path_exists(&exec));
|
||||
assert!(is_rwx(&exec));
|
||||
let _built_lib =
|
||||
@ -609,9 +610,9 @@ fn test_install_git() {
|
||||
// And that the test and bench executables aren't installed
|
||||
let test = target_test_in_workspace(&temp_pkg_id, &ws);
|
||||
assert!(!os::path_exists(&test));
|
||||
debug!("test = %s", test.to_str());
|
||||
debug2!("test = {}", test.to_str());
|
||||
let bench = target_bench_in_workspace(&temp_pkg_id, &ws);
|
||||
debug!("bench = %s", bench.to_str());
|
||||
debug2!("bench = {}", bench.to_str());
|
||||
assert!(!os::path_exists(&bench));
|
||||
}
|
||||
|
||||
@ -661,7 +662,7 @@ fn test_package_version() {
|
||||
let local_path = "mockgithub.com/catamorphism/test_pkg_version";
|
||||
let repo = init_git_repo(&Path(local_path));
|
||||
let repo_subdir = repo.push_many([~"mockgithub.com", ~"catamorphism", ~"test_pkg_version"]);
|
||||
debug!("Writing files in: %s", repo_subdir.to_str());
|
||||
debug2!("Writing files in: {}", repo_subdir.to_str());
|
||||
writeFile(&repo_subdir.push("main.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
writeFile(&repo_subdir.push("lib.rs"),
|
||||
@ -681,7 +682,7 @@ fn test_package_version() {
|
||||
// we can still match on the filename to make sure it contains the 0.4 version
|
||||
assert!(match built_library_in_workspace(&temp_pkg_id,
|
||||
&ws) {
|
||||
Some(p) => p.to_str().ends_with(fmt!("0.4%s", os::consts::DLL_SUFFIX)),
|
||||
Some(p) => p.to_str().ends_with(format!("0.4{}", os::consts::DLL_SUFFIX)),
|
||||
None => false
|
||||
});
|
||||
assert!(built_executable_in_workspace(&temp_pkg_id, &ws)
|
||||
@ -696,7 +697,7 @@ fn test_package_request_version() {
|
||||
let local_path = "mockgithub.com/catamorphism/test_pkg_version";
|
||||
let repo = init_git_repo(&Path(local_path));
|
||||
let repo_subdir = repo.push_many([~"mockgithub.com", ~"catamorphism", ~"test_pkg_version"]);
|
||||
debug!("Writing files in: %s", repo_subdir.to_str());
|
||||
debug2!("Writing files in: {}", repo_subdir.to_str());
|
||||
writeFile(&repo_subdir.push("main.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
writeFile(&repo_subdir.push("lib.rs"),
|
||||
@ -710,12 +711,12 @@ fn test_package_request_version() {
|
||||
writeFile(&repo_subdir.push("version-0.4-file.txt"), "hello");
|
||||
add_git_tag(&repo_subdir, ~"0.4");
|
||||
|
||||
command_line_test([~"install", fmt!("%s#0.3", local_path)], &repo);
|
||||
command_line_test([~"install", format!("{}\\#0.3", local_path)], &repo);
|
||||
|
||||
assert!(match installed_library_in_workspace(&Path("test_pkg_version"), &repo.push(".rust")) {
|
||||
Some(p) => {
|
||||
debug!("installed: %s", p.to_str());
|
||||
p.to_str().ends_with(fmt!("0.3%s", os::consts::DLL_SUFFIX))
|
||||
debug2!("installed: {}", p.to_str());
|
||||
p.to_str().ends_with(format!("0.3{}", os::consts::DLL_SUFFIX))
|
||||
}
|
||||
None => false
|
||||
});
|
||||
@ -746,7 +747,7 @@ fn rustpkg_library_target() {
|
||||
let foo_repo = init_git_repo(&Path("foo"));
|
||||
let package_dir = foo_repo.push("foo");
|
||||
|
||||
debug!("Writing files in: %s", package_dir.to_str());
|
||||
debug2!("Writing files in: {}", package_dir.to_str());
|
||||
writeFile(&package_dir.push("main.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
writeFile(&package_dir.push("lib.rs"),
|
||||
@ -772,13 +773,13 @@ fn rustpkg_local_pkg() {
|
||||
#[ignore (reason = "test makes bogus assumptions about build directory layout: issue #8690")]
|
||||
fn package_script_with_default_build() {
|
||||
let dir = create_local_package(&PkgId::new("fancy-lib"));
|
||||
debug!("dir = %s", dir.to_str());
|
||||
debug2!("dir = {}", dir.to_str());
|
||||
let source = test_sysroot().pop().pop().pop().push_many(
|
||||
[~"src", ~"librustpkg", ~"testsuite", ~"pass", ~"src", ~"fancy-lib", ~"pkg.rs"]);
|
||||
debug!("package_script_with_default_build: %s", source.to_str());
|
||||
debug2!("package_script_with_default_build: {}", source.to_str());
|
||||
if !os::copy_file(&source,
|
||||
&dir.push_many([~"src", ~"fancy-lib-0.1", ~"pkg.rs"])) {
|
||||
fail!("Couldn't copy file");
|
||||
fail2!("Couldn't copy file");
|
||||
}
|
||||
command_line_test([~"install", ~"fancy-lib"], &dir);
|
||||
assert_lib_exists(&dir, &Path("fancy-lib"), NoVersion);
|
||||
@ -794,7 +795,7 @@ fn rustpkg_build_no_arg() {
|
||||
|
||||
writeFile(&package_dir.push("main.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
debug!("build_no_arg: dir = %s", package_dir.to_str());
|
||||
debug2!("build_no_arg: dir = {}", package_dir.to_str());
|
||||
command_line_test([~"build"], &package_dir);
|
||||
assert_built_executable_exists(&tmp, "foo");
|
||||
}
|
||||
@ -808,7 +809,7 @@ fn rustpkg_install_no_arg() {
|
||||
assert!(os::mkdir_recursive(&package_dir, U_RWX));
|
||||
writeFile(&package_dir.push("lib.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
debug!("install_no_arg: dir = %s", package_dir.to_str());
|
||||
debug2!("install_no_arg: dir = {}", package_dir.to_str());
|
||||
command_line_test([~"install"], &package_dir);
|
||||
assert_lib_exists(&tmp, &Path("foo"), NoVersion);
|
||||
}
|
||||
@ -822,7 +823,7 @@ fn rustpkg_clean_no_arg() {
|
||||
|
||||
writeFile(&package_dir.push("main.rs"),
|
||||
"fn main() { let _x = (); }");
|
||||
debug!("clean_no_arg: dir = %s", package_dir.to_str());
|
||||
debug2!("clean_no_arg: dir = {}", package_dir.to_str());
|
||||
command_line_test([~"build"], &package_dir);
|
||||
assert_built_executable_exists(&tmp, "foo");
|
||||
command_line_test([~"clean"], &package_dir);
|
||||
@ -834,11 +835,11 @@ fn rustpkg_clean_no_arg() {
|
||||
fn rust_path_test() {
|
||||
let dir_for_path = mkdtemp(&os::tmpdir(), "more_rust").expect("rust_path_test failed");
|
||||
let dir = mk_workspace(&dir_for_path, &Path("foo"), &NoVersion);
|
||||
debug!("dir = %s", dir.to_str());
|
||||
debug2!("dir = {}", dir.to_str());
|
||||
writeFile(&dir.push("main.rs"), "fn main() { let _x = (); }");
|
||||
|
||||
let cwd = os::getcwd();
|
||||
debug!("cwd = %s", cwd.to_str());
|
||||
debug2!("cwd = {}", cwd.to_str());
|
||||
// use command_line_test_with_env
|
||||
command_line_test_with_env([~"install", ~"foo"],
|
||||
&cwd,
|
||||
@ -944,7 +945,7 @@ fn install_check_duplicates() {
|
||||
let mut contents = ~[];
|
||||
let check_dups = |p: &PkgId| {
|
||||
if contents.contains(p) {
|
||||
fail!("package %s appears in `list` output more than once", p.path.to_str());
|
||||
fail2!("package {} appears in `list` output more than once", p.path.to_str());
|
||||
}
|
||||
else {
|
||||
contents.push((*p).clone());
|
||||
@ -983,8 +984,8 @@ fn no_rebuilding_dep() {
|
||||
|
||||
match command_line_test_partial([~"build", ~"foo"], &workspace) {
|
||||
Success(*) => (), // ok
|
||||
Fail(status) if status == 65 => fail!("no_rebuilding_dep failed: it tried to rebuild bar"),
|
||||
Fail(_) => fail!("no_rebuilding_dep failed for some other reason")
|
||||
Fail(status) if status == 65 => fail2!("no_rebuilding_dep failed: it tried to rebuild bar"),
|
||||
Fail(_) => fail2!("no_rebuilding_dep failed for some other reason")
|
||||
}
|
||||
|
||||
let bar_date_2 = datestamp(&lib_output_file_name(&workspace,
|
||||
@ -1001,11 +1002,11 @@ fn do_rebuild_dep_dates_change() {
|
||||
command_line_test([~"build", ~"foo"], &workspace);
|
||||
let bar_lib_name = lib_output_file_name(&workspace, "bar");
|
||||
let bar_date = datestamp(&bar_lib_name);
|
||||
debug!("Datestamp on %s is %?", bar_lib_name.to_str(), bar_date);
|
||||
debug2!("Datestamp on {} is {:?}", bar_lib_name.to_str(), bar_date);
|
||||
touch_source_file(&workspace, &dep_id);
|
||||
command_line_test([~"build", ~"foo"], &workspace);
|
||||
let new_bar_date = datestamp(&bar_lib_name);
|
||||
debug!("Datestamp on %s is %?", bar_lib_name.to_str(), new_bar_date);
|
||||
debug2!("Datestamp on {} is {:?}", bar_lib_name.to_str(), new_bar_date);
|
||||
assert!(new_bar_date > bar_date);
|
||||
}
|
||||
|
||||
@ -1074,7 +1075,7 @@ fn test_non_numeric_tag() {
|
||||
writeFile(&repo_subdir.push("not_on_testbranch_only"), "bye bye");
|
||||
add_all_and_commit(&repo_subdir);
|
||||
|
||||
command_line_test([~"install", fmt!("%s#testbranch", temp_pkg_id.path.to_str())], &repo);
|
||||
command_line_test([~"install", format!("{}\\#testbranch", temp_pkg_id.path.to_str())], &repo);
|
||||
let file1 = repo.push_many(["mockgithub.com", "catamorphism",
|
||||
"test-pkg", "testbranch_only"]);
|
||||
let file2 = repo.push_many(["mockgithub.com", "catamorphism", "test-pkg",
|
||||
@ -1119,7 +1120,7 @@ fn test_extern_mod() {
|
||||
});
|
||||
let outp = prog.finish_with_output();
|
||||
if outp.status != 0 {
|
||||
fail!("output was %s, error was %s",
|
||||
fail2!("output was {}, error was {}",
|
||||
str::from_utf8(outp.output),
|
||||
str::from_utf8(outp.error));
|
||||
}
|
||||
@ -1149,7 +1150,7 @@ fn test_extern_mod_simpler() {
|
||||
let env = Some([(~"RUST_PATH", lib_depend_dir.to_str())] + os::env());
|
||||
let rustpkg_exec = rustpkg_exec();
|
||||
let rustc = rustpkg_exec.with_filename("rustc");
|
||||
debug!("RUST_PATH=%s %s %s \n --sysroot %s -o %s",
|
||||
debug2!("RUST_PATH={} {} {} \n --sysroot {} -o {}",
|
||||
lib_depend_dir.to_str(),
|
||||
rustc.to_str(),
|
||||
main_file.to_str(),
|
||||
@ -1168,7 +1169,7 @@ fn test_extern_mod_simpler() {
|
||||
});
|
||||
let outp = prog.finish_with_output();
|
||||
if outp.status != 0 {
|
||||
fail!("output was %s, error was %s",
|
||||
fail2!("output was {}, error was {}",
|
||||
str::from_utf8(outp.output),
|
||||
str::from_utf8(outp.error));
|
||||
}
|
||||
@ -1182,8 +1183,8 @@ fn test_import_rustpkg() {
|
||||
writeFile(&workspace.push_many([~"src", ~"foo-0.1", ~"pkg.rs"]),
|
||||
"extern mod rustpkg; fn main() {}");
|
||||
command_line_test([~"build", ~"foo"], &workspace);
|
||||
debug!("workspace = %s", workspace.to_str());
|
||||
assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(fmt!("pkg%s",
|
||||
debug2!("workspace = {}", workspace.to_str());
|
||||
assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(format!("pkg{}",
|
||||
os::EXE_SUFFIX))));
|
||||
}
|
||||
|
||||
@ -1192,10 +1193,10 @@ fn test_macro_pkg_script() {
|
||||
let p_id = PkgId::new("foo");
|
||||
let workspace = create_local_package(&p_id);
|
||||
writeFile(&workspace.push_many([~"src", ~"foo-0.1", ~"pkg.rs"]),
|
||||
"extern mod rustpkg; fn main() { debug!(\"Hi\"); }");
|
||||
"extern mod rustpkg; fn main() { debug2!(\"Hi\"); }");
|
||||
command_line_test([~"build", ~"foo"], &workspace);
|
||||
debug!("workspace = %s", workspace.to_str());
|
||||
assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(fmt!("pkg%s",
|
||||
debug2!("workspace = {}", workspace.to_str());
|
||||
assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(format!("pkg{}",
|
||||
os::EXE_SUFFIX))));
|
||||
}
|
||||
|
||||
@ -1207,11 +1208,11 @@ fn multiple_workspaces() {
|
||||
// Make a third package that uses foo, make sure we can build/install it
|
||||
let a_loc = mk_temp_workspace(&Path("foo"), &NoVersion).pop().pop();
|
||||
let b_loc = mk_temp_workspace(&Path("foo"), &NoVersion).pop().pop();
|
||||
debug!("Trying to install foo in %s", a_loc.to_str());
|
||||
debug2!("Trying to install foo in {}", a_loc.to_str());
|
||||
command_line_test([~"install", ~"foo"], &a_loc);
|
||||
debug!("Trying to install foo in %s", b_loc.to_str());
|
||||
debug2!("Trying to install foo in {}", b_loc.to_str());
|
||||
command_line_test([~"install", ~"foo"], &b_loc);
|
||||
let env = Some(~[(~"RUST_PATH", fmt!("%s:%s", a_loc.to_str(), b_loc.to_str()))]);
|
||||
let env = Some(~[(~"RUST_PATH", format!("{}:{}", a_loc.to_str(), b_loc.to_str()))]);
|
||||
let c_loc = create_local_package_with_dep(&PkgId::new("bar"), &PkgId::new("foo"));
|
||||
command_line_test_with_env([~"install", ~"bar"], &c_loc, env);
|
||||
}
|
||||
@ -1229,7 +1230,9 @@ fn rust_path_hack_test(hack_flag: bool) {
|
||||
let workspace = create_local_package(&p_id);
|
||||
let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace");
|
||||
let rust_path = Some(~[(~"RUST_PATH",
|
||||
fmt!("%s:%s", dest_workspace.to_str(), workspace.push_many(["src", "foo-0.1"]).to_str()))]);
|
||||
format!("{}:{}",
|
||||
dest_workspace.to_str(),
|
||||
workspace.push_many(["src", "foo-0.1"]).to_str()))]);
|
||||
command_line_test_with_env(~[~"install"] + if hack_flag { ~[~"--rust-path-hack"] } else { ~[] } +
|
||||
~[~"foo"], &dest_workspace, rust_path);
|
||||
assert_lib_exists(&dest_workspace, &Path("foo"), NoVersion);
|
||||
@ -1272,7 +1275,7 @@ fn rust_path_hack_cwd() {
|
||||
let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace");
|
||||
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]);
|
||||
command_line_test_with_env([~"install", ~"--rust-path-hack", ~"foo"], &cwd, rust_path);
|
||||
debug!("Checking that foo exists in %s", dest_workspace.to_str());
|
||||
debug2!("Checking that foo exists in {}", dest_workspace.to_str());
|
||||
assert_lib_exists(&dest_workspace, &Path("foo"), NoVersion);
|
||||
assert_built_library_exists(&dest_workspace, "foo");
|
||||
assert!(!lib_exists(&cwd, &Path("foo"), NoVersion));
|
||||
@ -1291,7 +1294,7 @@ fn rust_path_hack_multi_path() {
|
||||
let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace");
|
||||
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]);
|
||||
command_line_test_with_env([~"install", ~"--rust-path-hack", name.clone()], &subdir, rust_path);
|
||||
debug!("Checking that %s exists in %s", name, dest_workspace.to_str());
|
||||
debug2!("Checking that {} exists in {}", name, dest_workspace.to_str());
|
||||
assert_lib_exists(&dest_workspace, &Path("quux"), NoVersion);
|
||||
assert_built_library_exists(&dest_workspace, name);
|
||||
assert!(!lib_exists(&subdir, &Path("quux"), NoVersion));
|
||||
@ -1309,7 +1312,7 @@ fn rust_path_hack_install_no_arg() {
|
||||
let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace");
|
||||
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]);
|
||||
command_line_test_with_env([~"install", ~"--rust-path-hack"], &source_dir, rust_path);
|
||||
debug!("Checking that foo exists in %s", dest_workspace.to_str());
|
||||
debug2!("Checking that foo exists in {}", dest_workspace.to_str());
|
||||
assert_lib_exists(&dest_workspace, &Path("foo"), NoVersion);
|
||||
assert_built_library_exists(&dest_workspace, "foo");
|
||||
assert!(!lib_exists(&source_dir, &Path("foo"), NoVersion));
|
||||
@ -1327,7 +1330,7 @@ fn rust_path_hack_build_no_arg() {
|
||||
let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace");
|
||||
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]);
|
||||
command_line_test_with_env([~"build", ~"--rust-path-hack"], &source_dir, rust_path);
|
||||
debug!("Checking that foo exists in %s", dest_workspace.to_str());
|
||||
debug2!("Checking that foo exists in {}", dest_workspace.to_str());
|
||||
assert_built_library_exists(&dest_workspace, "foo");
|
||||
assert!(!built_library_exists(&source_dir, "foo"));
|
||||
}
|
||||
@ -1337,13 +1340,13 @@ fn rust_path_install_target() {
|
||||
let dir_for_path = mkdtemp(&os::tmpdir(),
|
||||
"source_workspace").expect("rust_path_install_target failed");
|
||||
let dir = mk_workspace(&dir_for_path, &Path("foo"), &NoVersion);
|
||||
debug!("dir = %s", dir.to_str());
|
||||
debug2!("dir = {}", dir.to_str());
|
||||
writeFile(&dir.push("main.rs"), "fn main() { let _x = (); }");
|
||||
let dir_to_install_to = mkdtemp(&os::tmpdir(),
|
||||
"dest_workspace").expect("rust_path_install_target failed");
|
||||
let dir = dir.pop().pop();
|
||||
|
||||
let rust_path = Some(~[(~"RUST_PATH", fmt!("%s:%s", dir_to_install_to.to_str(),
|
||||
let rust_path = Some(~[(~"RUST_PATH", format!("{}:{}", dir_to_install_to.to_str(),
|
||||
dir.to_str()))]);
|
||||
let cwd = os::getcwd();
|
||||
command_line_test_with_env([~"install", ~"foo"],
|
||||
@ -1491,7 +1494,7 @@ fn test_cfg_fail() {
|
||||
~"build",
|
||||
~"foo"],
|
||||
&workspace) {
|
||||
Success(*) => fail!("test_cfg_fail failed"),
|
||||
Success(*) => fail2!("test_cfg_fail failed"),
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
@ -1627,7 +1630,7 @@ fn pkgid_pointing_to_subdir() {
|
||||
writeFile(&foo_dir.push("lib.rs"), "pub fn f() {}");
|
||||
writeFile(&bar_dir.push("lib.rs"), "pub fn g() {}");
|
||||
|
||||
debug!("Creating a file in %s", workspace.to_str());
|
||||
debug2!("Creating a file in {}", workspace.to_str());
|
||||
let testpkg_dir = workspace.push_many([~"src", ~"testpkg-0.1"]);
|
||||
assert!(os::mkdir_recursive(&testpkg_dir, U_RWX));
|
||||
|
||||
@ -1654,7 +1657,7 @@ fn test_recursive_deps() {
|
||||
writeFile(&b_workspace.push("src").push("b-0.1").push("lib.rs"),
|
||||
"extern mod c; use c::g; pub fn f() { g(); }");
|
||||
let environment = Some(~[(~"RUST_PATH", b_workspace.to_str())]);
|
||||
debug!("RUST_PATH=%s", b_workspace.to_str());
|
||||
debug2!("RUST_PATH={}", b_workspace.to_str());
|
||||
command_line_test_with_env([~"install", ~"a"],
|
||||
&a_workspace,
|
||||
environment);
|
||||
@ -1669,9 +1672,9 @@ fn test_install_to_rust_path() {
|
||||
let second_workspace = create_local_package(&p_id);
|
||||
let first_workspace = mk_empty_workspace(&Path("p"), &NoVersion, "dest");
|
||||
let rust_path = Some(~[(~"RUST_PATH",
|
||||
fmt!("%s:%s", first_workspace.to_str(),
|
||||
format!("{}:{}", first_workspace.to_str(),
|
||||
second_workspace.to_str()))]);
|
||||
debug!("RUST_PATH=%s:%s", first_workspace.to_str(), second_workspace.to_str());
|
||||
debug2!("RUST_PATH={}:{}", first_workspace.to_str(), second_workspace.to_str());
|
||||
command_line_test_with_env([test_sysroot().to_str(),
|
||||
~"install",
|
||||
~"foo"],
|
||||
@ -1782,7 +1785,7 @@ fn correct_package_name_with_rust_path_hack() {
|
||||
writeFile(&dest_workspace.push_many(["src", "bar-0.1", "main.rs"]),
|
||||
"extern mod blat; fn main() { let _x = (); }");
|
||||
|
||||
let rust_path = Some(~[(~"RUST_PATH", fmt!("%s:%s", dest_workspace.to_str(),
|
||||
let rust_path = Some(~[(~"RUST_PATH", format!("{}:{}", dest_workspace.to_str(),
|
||||
foo_workspace.push_many(["src", "foo-0.1"]).to_str()))]);
|
||||
// bar doesn't exist, but we want to make sure rustpkg doesn't think foo is bar
|
||||
command_line_test_with_env([~"install", ~"--rust-path-hack", ~"bar"],
|
||||
@ -1833,9 +1836,9 @@ fn test_rebuild_when_needed() {
|
||||
frob_source_file(&foo_workspace, &foo_id, "test.rs");
|
||||
chmod_read_only(&test_executable);
|
||||
match command_line_test_partial([~"test", ~"foo"], &foo_workspace) {
|
||||
Success(*) => fail!("test_rebuild_when_needed didn't rebuild"),
|
||||
Success(*) => fail2!("test_rebuild_when_needed didn't rebuild"),
|
||||
Fail(status) if status == 65 => (), // ok
|
||||
Fail(_) => fail!("test_rebuild_when_needed failed for some other reason")
|
||||
Fail(_) => fail2!("test_rebuild_when_needed failed for some other reason")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1852,8 +1855,8 @@ fn test_no_rebuilding() {
|
||||
chmod_read_only(&test_executable);
|
||||
match command_line_test_partial([~"test", ~"foo"], &foo_workspace) {
|
||||
Success(*) => (), // ok
|
||||
Fail(status) if status == 65 => fail!("test_no_rebuilding failed: it rebuilt the tests"),
|
||||
Fail(_) => fail!("test_no_rebuilding failed for some other reason")
|
||||
Fail(status) if status == 65 => fail2!("test_no_rebuilding failed: it rebuilt the tests"),
|
||||
Fail(_) => fail2!("test_no_rebuilding failed for some other reason")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ pub fn compile_input(context: &BuildContext,
|
||||
what: OutputType) -> Option<Path> {
|
||||
assert!(in_file.components.len() > 1);
|
||||
let input = driver::file_input((*in_file).clone());
|
||||
debug!("compile_input: %s / %?", in_file.to_str(), what);
|
||||
debug2!("compile_input: {} / {:?}", in_file.to_str(), what);
|
||||
// tjc: by default, use the package ID name as the link name
|
||||
// not sure if we should support anything else
|
||||
|
||||
@ -184,9 +184,9 @@ pub fn compile_input(context: &BuildContext,
|
||||
|
||||
let binary = os::args()[0].to_managed();
|
||||
|
||||
debug!("flags: %s", flags.connect(" "));
|
||||
debug!("cfgs: %s", cfgs.connect(" "));
|
||||
debug!("compile_input's sysroot = %s", context.sysroot().to_str());
|
||||
debug2!("flags: {}", flags.connect(" "));
|
||||
debug2!("cfgs: {}", cfgs.connect(" "));
|
||||
debug2!("compile_input's sysroot = {}", context.sysroot().to_str());
|
||||
|
||||
let crate_type = match what {
|
||||
Lib => lib_crate,
|
||||
@ -203,7 +203,7 @@ pub fn compile_input(context: &BuildContext,
|
||||
+ context.flag_strs()
|
||||
+ cfgs.flat_map(|c| { ~[~"--cfg", (*c).clone()] }),
|
||||
driver::optgroups()).unwrap();
|
||||
debug!("rustc flags: %?", matches);
|
||||
debug2!("rustc flags: {:?}", matches);
|
||||
|
||||
// Hack so that rustpkg can run either out of a rustc target dir,
|
||||
// or the host dir
|
||||
@ -213,8 +213,8 @@ pub fn compile_input(context: &BuildContext,
|
||||
else {
|
||||
context.sysroot().pop().pop().pop()
|
||||
};
|
||||
debug!("compile_input's sysroot = %s", context.sysroot().to_str());
|
||||
debug!("sysroot_to_use = %s", sysroot_to_use.to_str());
|
||||
debug2!("compile_input's sysroot = {}", context.sysroot().to_str());
|
||||
debug2!("sysroot_to_use = {}", sysroot_to_use.to_str());
|
||||
|
||||
let output_type = match context.compile_upto() {
|
||||
Assemble => link::output_type_assembly,
|
||||
@ -262,7 +262,7 @@ pub fn compile_input(context: &BuildContext,
|
||||
|
||||
find_and_install_dependencies(context, pkg_id, sess, exec, &crate,
|
||||
|p| {
|
||||
debug!("a dependency: %s", p.to_str());
|
||||
debug2!("a dependency: {}", p.to_str());
|
||||
// Pass the directory containing a dependency
|
||||
// as an additional lib search path
|
||||
if !addl_lib_search_paths.contains(&p) {
|
||||
@ -275,23 +275,23 @@ pub fn compile_input(context: &BuildContext,
|
||||
// Inject the link attributes so we get the right package name and version
|
||||
if attr::find_linkage_metas(crate.attrs).is_empty() {
|
||||
let name_to_use = match what {
|
||||
Test => fmt!("%stest", pkg_id.short_name).to_managed(),
|
||||
Bench => fmt!("%sbench", pkg_id.short_name).to_managed(),
|
||||
Test => format!("{}test", pkg_id.short_name).to_managed(),
|
||||
Bench => format!("{}bench", pkg_id.short_name).to_managed(),
|
||||
_ => pkg_id.short_name.to_managed()
|
||||
};
|
||||
debug!("Injecting link name: %s", name_to_use);
|
||||
debug2!("Injecting link name: {}", name_to_use);
|
||||
let link_options =
|
||||
~[attr::mk_name_value_item_str(@"name", name_to_use),
|
||||
attr::mk_name_value_item_str(@"vers", pkg_id.version.to_str().to_managed())] +
|
||||
~[attr::mk_name_value_item_str(@"package_id",
|
||||
pkg_id.path.to_str().to_managed())];
|
||||
|
||||
debug!("link options: %?", link_options);
|
||||
debug2!("link options: {:?}", link_options);
|
||||
crate.attrs = ~[attr::mk_attr(attr::mk_list_item(@"link", link_options))];
|
||||
}
|
||||
|
||||
debug!("calling compile_crate_from_input, workspace = %s,
|
||||
building_library = %?", out_dir.to_str(), sess.building_library);
|
||||
debug2!("calling compile_crate_from_input, workspace = {},
|
||||
building_library = {:?}", out_dir.to_str(), sess.building_library);
|
||||
let result = compile_crate_from_input(in_file,
|
||||
exec,
|
||||
context.compile_upto(),
|
||||
@ -305,7 +305,7 @@ pub fn compile_input(context: &BuildContext,
|
||||
else {
|
||||
result
|
||||
};
|
||||
debug!("About to discover output %s", discovered_output.to_str());
|
||||
debug2!("About to discover output {}", discovered_output.to_str());
|
||||
for p in discovered_output.iter() {
|
||||
if os::path_exists(p) {
|
||||
exec.discover_output("binary", p.to_str(), digest_only_date(p));
|
||||
@ -330,22 +330,22 @@ pub fn compile_crate_from_input(input: &Path,
|
||||
// Returns None if one of the flags that suppresses compilation output was
|
||||
// given
|
||||
crate: ast::Crate) -> Option<Path> {
|
||||
debug!("Calling build_output_filenames with %s, building library? %?",
|
||||
debug2!("Calling build_output_filenames with {}, building library? {:?}",
|
||||
out_dir.to_str(), sess.building_library);
|
||||
|
||||
// bad copy
|
||||
debug!("out_dir = %s", out_dir.to_str());
|
||||
debug2!("out_dir = {}", out_dir.to_str());
|
||||
let outputs = driver::build_output_filenames(&driver::file_input(input.clone()),
|
||||
&Some(out_dir.clone()), &None,
|
||||
crate.attrs, sess);
|
||||
|
||||
debug!("Outputs are out_filename: %s and obj_filename: %s and output type = %?",
|
||||
debug2!("Outputs are out_filename: {} and obj_filename: {} and output type = {:?}",
|
||||
outputs.out_filename.to_str(),
|
||||
outputs.obj_filename.to_str(),
|
||||
sess.opts.output_type);
|
||||
debug!("additional libraries:");
|
||||
debug2!("additional libraries:");
|
||||
for lib in sess.opts.addl_lib_search_paths.iter() {
|
||||
debug!("an additional library: %s", lib.to_str());
|
||||
debug2!("an additional library: {}", lib.to_str());
|
||||
}
|
||||
let analysis = driver::phase_3_run_analysis_passes(sess, &crate);
|
||||
if driver::stop_after_phase_3(sess) { return None; }
|
||||
@ -362,7 +362,7 @@ pub fn compile_crate_from_input(input: &Path,
|
||||
// Register dependency on the source file
|
||||
exec.discover_input("file", input.to_str(), digest_file_with_date(input));
|
||||
|
||||
debug!("Built %s, date = %?", outputs.out_filename.to_str(),
|
||||
debug2!("Built {}, date = {:?}", outputs.out_filename.to_str(),
|
||||
datestamp(&outputs.out_filename));
|
||||
|
||||
Some(outputs.out_filename)
|
||||
@ -384,10 +384,10 @@ pub fn compile_crate(ctxt: &BuildContext,
|
||||
crate: &Path, workspace: &Path,
|
||||
flags: &[~str], cfgs: &[~str], opt: bool,
|
||||
what: OutputType) -> Option<Path> {
|
||||
debug!("compile_crate: crate=%s, workspace=%s", crate.to_str(), workspace.to_str());
|
||||
debug!("compile_crate: short_name = %s, flags =...", pkg_id.to_str());
|
||||
debug2!("compile_crate: crate={}, workspace={}", crate.to_str(), workspace.to_str());
|
||||
debug2!("compile_crate: short_name = {}, flags =...", pkg_id.to_str());
|
||||
for fl in flags.iter() {
|
||||
debug!("+++ %s", *fl);
|
||||
debug2!("+++ {}", *fl);
|
||||
}
|
||||
compile_input(ctxt, exec, pkg_id, crate, workspace, flags, cfgs, opt, what)
|
||||
}
|
||||
@ -403,7 +403,7 @@ struct ViewItemVisitor<'self> {
|
||||
|
||||
impl<'self> Visitor<()> for ViewItemVisitor<'self> {
|
||||
fn visit_view_item(&mut self, vi: &ast::view_item, env: ()) {
|
||||
debug!("A view item!");
|
||||
debug2!("A view item!");
|
||||
match vi.node {
|
||||
// ignore metadata, I guess
|
||||
ast::view_item_extern_mod(lib_ident, path_opt, _, _) => {
|
||||
@ -411,11 +411,11 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> {
|
||||
Some(p) => p,
|
||||
None => self.sess.str_of(lib_ident)
|
||||
};
|
||||
debug!("Finding and installing... %s", lib_name);
|
||||
debug2!("Finding and installing... {}", lib_name);
|
||||
// Check standard Rust library path first
|
||||
match system_library(&self.context.sysroot(), lib_name) {
|
||||
Some(ref installed_path) => {
|
||||
debug!("It exists: %s", installed_path.to_str());
|
||||
debug2!("It exists: {}", installed_path.to_str());
|
||||
// Say that [path for c] has a discovered dependency on
|
||||
// installed_path
|
||||
// For binary files, we only hash the datestamp, not the contents.
|
||||
@ -428,15 +428,15 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> {
|
||||
}
|
||||
None => {
|
||||
// FIXME #8711: need to parse version out of path_opt
|
||||
debug!("Trying to install library %s, rebuilding it",
|
||||
debug2!("Trying to install library {}, rebuilding it",
|
||||
lib_name.to_str());
|
||||
// Try to install it
|
||||
let pkg_id = PkgId::new(lib_name);
|
||||
let workspaces = pkg_parent_workspaces(&self.context.context,
|
||||
&pkg_id);
|
||||
let source_workspace = if workspaces.is_empty() {
|
||||
error(fmt!("Couldn't find package %s \
|
||||
in any of the workspaces in the RUST_PATH (%s)",
|
||||
error(format!("Couldn't find package {} \
|
||||
in any of the workspaces in the RUST_PATH ({})",
|
||||
lib_name,
|
||||
rust_path().map(|s| s.to_str()).connect(":")));
|
||||
cond.raise((pkg_id.clone(), ~"Dependency not found"))
|
||||
@ -452,14 +452,14 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> {
|
||||
pkg_id),
|
||||
&JustOne(Path(
|
||||
lib_crate_filename)));
|
||||
debug!("Installed %s, returned %? dependencies and \
|
||||
%? transitive dependencies",
|
||||
debug2!("Installed {}, returned {:?} dependencies and \
|
||||
{:?} transitive dependencies",
|
||||
lib_name, outputs_disc.len(), inputs_disc.len());
|
||||
// It must have installed *something*...
|
||||
assert!(!outputs_disc.is_empty());
|
||||
let target_workspace = outputs_disc[0].pop();
|
||||
for dep in outputs_disc.iter() {
|
||||
debug!("Discovering a binary input: %s", dep.to_str());
|
||||
debug2!("Discovering a binary input: {}", dep.to_str());
|
||||
self.exec.discover_input("binary",
|
||||
dep.to_str(),
|
||||
digest_only_date(dep));
|
||||
@ -476,11 +476,11 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> {
|
||||
digest_only_date(&Path(*dep)));
|
||||
}
|
||||
else {
|
||||
fail!("Bad kind: %s", *what);
|
||||
fail2!("Bad kind: {}", *what);
|
||||
}
|
||||
}
|
||||
// Also, add an additional search path
|
||||
debug!("Installed %s into %s", lib_name, target_workspace.to_str());
|
||||
debug2!("Installed {} into {}", lib_name, target_workspace.to_str());
|
||||
(self.save)(target_workspace);
|
||||
}
|
||||
}
|
||||
@ -501,7 +501,7 @@ pub fn find_and_install_dependencies(context: &BuildContext,
|
||||
exec: &mut workcache::Exec,
|
||||
c: &ast::Crate,
|
||||
save: &fn(Path)) {
|
||||
debug!("In find_and_install_dependencies...");
|
||||
debug2!("In find_and_install_dependencies...");
|
||||
let mut visitor = ViewItemVisitor {
|
||||
context: context,
|
||||
parent: parent,
|
||||
@ -553,8 +553,8 @@ fn debug_flags() -> ~[~str] { ~[] }
|
||||
|
||||
/// Returns the last-modified date as an Option
|
||||
pub fn datestamp(p: &Path) -> Option<libc::time_t> {
|
||||
debug!("Scrutinizing datestamp for %s - does it exist? %?", p.to_str(), os::path_exists(p));
|
||||
debug2!("Scrutinizing datestamp for {} - does it exist? {:?}", p.to_str(), os::path_exists(p));
|
||||
let out = p.stat().map(|stat| stat.st_mtime);
|
||||
debug!("Date = %?", out);
|
||||
debug2!("Date = {:?}", out);
|
||||
out.map(|t| { *t as libc::time_t })
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ impl Ord for Version {
|
||||
impl ToStr for Version {
|
||||
fn to_str(&self) -> ~str {
|
||||
match *self {
|
||||
ExactRevision(ref n) | Tagged(ref n) => fmt!("%s", n.to_str()),
|
||||
SemanticVersion(ref v) => fmt!("%s", v.to_str()),
|
||||
ExactRevision(ref n) | Tagged(ref n) => format!("{}", n.to_str()),
|
||||
SemanticVersion(ref v) => format!("{}", v.to_str()),
|
||||
NoVersion => ~"0.1"
|
||||
}
|
||||
}
|
||||
@ -104,9 +104,9 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> {
|
||||
loop;
|
||||
}
|
||||
let outp = run::process_output("git",
|
||||
[fmt!("--git-dir=%s", git_dir.to_str()), ~"tag", ~"-l"]);
|
||||
[format!("--git-dir={}", git_dir.to_str()), ~"tag", ~"-l"]);
|
||||
|
||||
debug!("git --git-dir=%s tag -l ~~~> %?", git_dir.to_str(), outp.status);
|
||||
debug2!("git --git-dir={} tag -l ~~~> {:?}", git_dir.to_str(), outp.status);
|
||||
|
||||
if outp.status != 0 {
|
||||
loop;
|
||||
@ -134,25 +134,27 @@ pub fn try_getting_version(remote_path: &Path) -> Option<Version> {
|
||||
if is_url_like(remote_path) {
|
||||
let tmp_dir = mkdtemp(&os::tmpdir(),
|
||||
"test").expect("try_getting_version: couldn't create temp dir");
|
||||
debug!("(to get version) executing {git clone https://%s %s}",
|
||||
debug2!("(to get version) executing \\{git clone https://{} {}\\}",
|
||||
remote_path.to_str(),
|
||||
tmp_dir.to_str());
|
||||
let outp = run::process_output("git", [~"clone", fmt!("https://%s", remote_path.to_str()),
|
||||
let outp = run::process_output("git", [~"clone",
|
||||
format!("https://{}",
|
||||
remote_path.to_str()),
|
||||
tmp_dir.to_str()]);
|
||||
if outp.status == 0 {
|
||||
debug!("Cloned it... ( %s, %s )",
|
||||
debug2!("Cloned it... ( {}, {} )",
|
||||
str::from_utf8(outp.output),
|
||||
str::from_utf8(outp.error));
|
||||
let mut output = None;
|
||||
debug!("(getting version, now getting tags) executing {git --git-dir=%s tag -l}",
|
||||
debug2!("(getting version, now getting tags) executing \\{git --git-dir={} tag -l\\}",
|
||||
tmp_dir.push(".git").to_str());
|
||||
let outp = run::process_output("git",
|
||||
[fmt!("--git-dir=%s", tmp_dir.push(".git").to_str()),
|
||||
[format!("--git-dir={}", tmp_dir.push(".git").to_str()),
|
||||
~"tag", ~"-l"]);
|
||||
let output_text = str::from_utf8(outp.output);
|
||||
debug!("Full output: ( %s ) [%?]", output_text, outp.status);
|
||||
debug2!("Full output: ( {} ) [{:?}]", output_text, outp.status);
|
||||
for l in output_text.line_iter() {
|
||||
debug!("A line of output: %s", l);
|
||||
debug2!("A line of output: {}", l);
|
||||
if !l.is_whitespace() {
|
||||
output = Some(l);
|
||||
}
|
||||
@ -179,7 +181,7 @@ enum ParseState {
|
||||
|
||||
pub fn try_parsing_version(s: &str) -> Option<Version> {
|
||||
let s = s.trim();
|
||||
debug!("Attempting to parse: %s", s);
|
||||
debug2!("Attempting to parse: {}", s);
|
||||
let mut parse_state = Start;
|
||||
for c in s.iter() {
|
||||
if char::is_digit(c) {
|
||||
@ -242,7 +244,7 @@ fn test_parse_version() {
|
||||
#[test]
|
||||
fn test_split_version() {
|
||||
let s = "a/b/c#0.1";
|
||||
debug!("== %? ==", split_version(s));
|
||||
debug2!("== {:?} ==", split_version(s));
|
||||
assert!(split_version(s) == Some((s.slice(0, 5), ExactRevision(~"0.1"))));
|
||||
assert!(split_version("a/b/c") == None);
|
||||
let s = "a#1.2";
|
||||
|
@ -25,12 +25,12 @@ pub fn digest_file_with_date(path: &Path) -> ~str {
|
||||
(*sha).input_str(s);
|
||||
let st = match path.stat() {
|
||||
Some(st) => st,
|
||||
None => cond1.raise((path.clone(), fmt!("Couldn't get file access time")))
|
||||
None => cond1.raise((path.clone(), format!("Couldn't get file access time")))
|
||||
};
|
||||
(*sha).input_str(st.st_mtime.to_str());
|
||||
(*sha).result_str()
|
||||
}
|
||||
Err(e) => cond.raise((path.clone(), fmt!("Couldn't read file: %s", e))).to_str()
|
||||
Err(e) => cond.raise((path.clone(), format!("Couldn't read file: {}", e))).to_str()
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ pub fn digest_only_date(path: &Path) -> ~str {
|
||||
let mut sha = ~Sha1::new();
|
||||
let st = match path.stat() {
|
||||
Some(st) => st,
|
||||
None => cond.raise((path.clone(), fmt!("Couldn't get file access time")))
|
||||
None => cond.raise((path.clone(), format!("Couldn't get file access time")))
|
||||
};
|
||||
(*sha).input_str(st.st_mtime.to_str());
|
||||
(*sha).result_str()
|
||||
@ -49,9 +49,9 @@ pub fn digest_only_date(path: &Path) -> ~str {
|
||||
|
||||
/// Adds multiple discovered outputs
|
||||
pub fn discover_outputs(e: &mut workcache::Exec, outputs: ~[Path]) {
|
||||
debug!("Discovering %? outputs", outputs.len());
|
||||
debug2!("Discovering {:?} outputs", outputs.len());
|
||||
for p in outputs.iter() {
|
||||
debug!("Discovering output! %s", p.to_str());
|
||||
debug2!("Discovering output! {}", p.to_str());
|
||||
// For now, assume that all discovered outputs are binaries
|
||||
e.discover_output("binary", p.to_str(), digest_only_date(p));
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ pub fn each_pkg_parent_workspace(cx: &Context, pkgid: &PkgId, action: &fn(&Path)
|
||||
let workspaces = pkg_parent_workspaces(cx, pkgid);
|
||||
if workspaces.is_empty() {
|
||||
// tjc: make this a condition
|
||||
fail!("Package %s not found in any of \
|
||||
the following workspaces: %s",
|
||||
fail2!("Package {} not found in any of \
|
||||
the following workspaces: {}",
|
||||
pkgid.path.to_str(),
|
||||
rust_path().to_str());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user