Skip to content

Commit 0cae213

Browse files
committed
Merge pull request #1836 from tychosci/cargo-fix
cargo: additions for issue #1643 and #1806
2 parents d4d21b4 + 60b80fa commit 0cae213

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/cargo/cargo.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ fn configure(opts: options) -> cargo {
418418

419419
if c.pgp {
420420
pgp::init(c.root);
421+
} else {
422+
warn("command \"gpg\" is not found");
423+
warn("you have to install \"gpg\" from source " +
424+
" or package manager to get it to work correctly");
421425
}
422426

423427
c
@@ -436,8 +440,8 @@ fn test_one_crate(_c: cargo, _path: str, cf: str, _p: pkg) {
436440
let buildpath = fs::connect(_path, "/test");
437441
need_dir(buildpath);
438442
#debug("Testing: %s -> %s", cf, buildpath);
439-
let p = run::program_output("rustc", ["--out-dir", buildpath, "--test",
440-
cf]);
443+
let p = run::program_output(rustc_sysroot(),
444+
["--out-dir", buildpath, "--test", cf]);
441445
if p.status != 0 {
442446
error(#fmt["rustc failed: %d\n%s\n%s", p.status, p.err, p.out]);
443447
ret;
@@ -452,7 +456,8 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
452456
let buildpath = fs::connect(_path, "/build");
453457
need_dir(buildpath);
454458
#debug("Installing: %s -> %s", cf, buildpath);
455-
let p = run::program_output("rustc", ["--out-dir", buildpath, cf]);
459+
let p = run::program_output(rustc_sysroot(),
460+
["--out-dir", buildpath, cf]);
456461
if p.status != 0 {
457462
error(#fmt["rustc failed: %d\n%s\n%s", p.status, p.err, p.out]);
458463
ret;
@@ -473,6 +478,19 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
473478
}
474479
}
475480

481+
fn rustc_sysroot() -> str {
482+
alt os::get_exe_path() {
483+
some(_path) {
484+
let path = [_path, "..", "bin", "rustc"];
485+
check vec::is_not_empty(path);
486+
let rustc = fs::normalize(fs::connect_many(path));
487+
#debug(" rustc: %s", rustc);
488+
rustc
489+
}
490+
none { "rustc" }
491+
}
492+
}
493+
476494
fn install_source(c: cargo, path: str) {
477495
#debug("source: %s", path);
478496
fs::change_dir(path);

0 commit comments

Comments
 (0)