Skip to content

Commit 557f499

Browse files
committed
---
yaml --- r: 64298 b: refs/heads/snap-stage3 c: 3b02589 h: refs/heads/master v: v3
1 parent a319fe8 commit 557f499

File tree

13 files changed

+49
-235
lines changed

13 files changed

+49
-235
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 563172a73be64aa2b0f528346095aba566753d14
4+
refs/heads/snap-stage3: 3b0258916d28a1215acf9a0c78f6760cc67f935c
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustpkg/conditions.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,3 @@ condition! {
3232
condition! {
3333
bad_pkg_id: (super::Path, ~str) -> super::PkgId;
3434
}
35-
36-
condition! {
37-
no_rust_path: (~str) -> super::Path;
38-
}

branches/snap-stage3/src/librustpkg/installed_packages.rs

Lines changed: 0 additions & 40 deletions
This file was deleted.

branches/snap-stage3/src/librustpkg/package_id.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ pub struct PkgId {
3030
version: Version
3131
}
3232

33-
impl Eq for PkgId {
34-
fn eq(&self, p: &PkgId) -> bool {
35-
*p.local_path == *self.local_path && p.version == self.version
36-
}
37-
fn ne(&self, p: &PkgId) -> bool {
38-
!(self.eq(p))
39-
}
40-
}
41-
4233
impl PkgId {
4334
pub fn new(s: &str) -> PkgId {
4435
use conditions::bad_pkg_id::cond;

branches/snap-stage3/src/librustpkg/path_util.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,13 @@ static PATH_ENTRY_SEPARATOR: &'static str = ";";
3333
#[cfg(not(windows))]
3434
static PATH_ENTRY_SEPARATOR: &'static str = ":";
3535

36-
/// Returns RUST_PATH as a string, without default paths added
37-
pub fn get_rust_path() -> Option<~str> {
38-
os::getenv("RUST_PATH")
39-
}
40-
4136
/// Returns the value of RUST_PATH, as a list
4237
/// of Paths. Includes default entries for, if they exist:
4338
/// $HOME/.rust
4439
/// DIR/.rust for any DIR that's the current working directory
4540
/// or an ancestor of it
4641
pub fn rust_path() -> ~[Path] {
47-
let mut env_rust_path: ~[Path] = match get_rust_path() {
42+
let mut env_rust_path: ~[Path] = match os::getenv("RUST_PATH") {
4843
Some(env_path) => {
4944
let env_path_components: ~[&str] =
5045
env_path.split_str_iter(PATH_ENTRY_SEPARATOR).collect();
@@ -383,23 +378,3 @@ pub fn mk_output_path(what: OutputType, where: Target,
383378
debug!("mk_output_path: returning %s", output_path.to_str());
384379
output_path
385380
}
386-
387-
/// Removes files for the package `pkgid`, assuming it's installed in workspace `workspace`
388-
pub fn uninstall_package_from(workspace: &Path, pkgid: &PkgId) {
389-
let mut did_something = false;
390-
let installed_bin = target_executable_in_workspace(pkgid, workspace);
391-
if os::path_exists(&installed_bin) {
392-
os::remove_file(&installed_bin);
393-
did_something = true;
394-
}
395-
let installed_lib = target_library_in_workspace(pkgid, workspace);
396-
if os::path_exists(&installed_lib) {
397-
os::remove_file(&installed_lib);
398-
did_something = true;
399-
}
400-
if !did_something {
401-
warn(fmt!("Warning: there don't seem to be any files for %s installed in %s",
402-
pkgid.to_str(), workspace.to_str()));
403-
}
404-
405-
}

branches/snap-stage3/src/librustpkg/rustpkg.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ pub mod api;
5050
mod conditions;
5151
mod context;
5252
mod crate;
53-
mod installed_packages;
5453
mod messages;
5554
mod package_id;
5655
mod package_path;
@@ -249,14 +248,6 @@ impl CtxMethods for Ctx {
249248
}
250249
}
251250
}
252-
"list" => {
253-
io::println("Installed packages:");
254-
for installed_packages::list_installed_packages |pkg_id| {
255-
io::println(fmt!("%s-%s",
256-
pkg_id.local_path.to_str(),
257-
pkg_id.version.to_str()));
258-
}
259-
}
260251
"prefer" => {
261252
if args.len() < 1 {
262253
return usage::uninstall();
@@ -272,24 +263,11 @@ impl CtxMethods for Ctx {
272263
return usage::uninstall();
273264
}
274265

275-
let pkgid = PkgId::new(args[0]);
276-
if !installed_packages::package_is_installed(&pkgid) {
277-
warn(fmt!("Package %s doesn't seem to be installed! Doing nothing.", args[0]));
278-
return;
279-
}
280-
else {
281-
let rp = rust_path();
282-
assert!(!rp.is_empty());
283-
for each_pkg_parent_workspace(&pkgid) |workspace| {
284-
path_util::uninstall_package_from(workspace, &pkgid);
285-
note(fmt!("Uninstalled package %s (was installed in %s)",
286-
pkgid.to_str(), workspace.to_str()));
287-
}
288-
}
266+
self.uninstall(args[0], None);
289267
}
290268
"unprefer" => {
291269
if args.len() < 1 {
292-
return usage::unprefer();
270+
return usage::uninstall();
293271
}
294272

295273
self.unprefer(args[0], None);
@@ -469,7 +447,6 @@ pub fn main() {
469447
~"do" => usage::do_cmd(),
470448
~"info" => usage::info(),
471449
~"install" => usage::install(),
472-
~"list" => usage::list(),
473450
~"prefer" => usage::prefer(),
474451
~"test" => usage::test(),
475452
~"uninstall" => usage::uninstall(),

branches/snap-stage3/src/librustpkg/tests.rs

Lines changed: 20 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212

1313
use context::Ctx;
1414
use std::hashmap::HashMap;
15-
use std::{io, libc, os, result, run, str};
15+
use std::{io, libc, os, result, run, str, vec};
1616
use extra::tempfile::mkdtemp;
1717
use std::run::ProcessOutput;
18-
use installed_packages::list_installed_packages;
1918
use package_path::*;
2019
use package_id::{PkgId};
2120
use package_source::*;
@@ -129,27 +128,20 @@ fn test_sysroot() -> Path {
129128
self_path.pop()
130129
}
131130

132-
fn command_line_test(args: &[~str], cwd: &Path) -> ProcessOutput {
133-
command_line_test_with_env(args, cwd, None)
134-
}
135-
136131
/// Runs `rustpkg` (based on the directory that this executable was
137132
/// invoked from) with the given arguments, in the given working directory.
138133
/// Returns the process's output.
139-
fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~str)]>)
140-
-> ProcessOutput {
134+
fn command_line_test(args: &[~str], cwd: &Path) -> ProcessOutput {
141135
let cmd = test_sysroot().push("bin").push("rustpkg").to_str();
142136
let cwd = normalize(RemotePath(copy *cwd));
143137
debug!("About to run command: %? %? in %s", cmd, args, cwd.to_str());
144138
assert!(os::path_is_dir(&*cwd));
145-
let cwd = cwd.clone();
146-
let mut prog = run::Process::new(cmd, args, run::ProcessOptions {
147-
env: env.map(|v| v.slice(0, v.len())),
148-
dir: Some(&cwd),
149-
in_fd: None,
150-
out_fd: None,
151-
err_fd: None
152-
});
139+
let mut prog = run::Process::new(cmd, args, run::ProcessOptions { env: None,
140+
dir: Some(&*cwd),
141+
in_fd: None,
142+
out_fd: None,
143+
err_fd: None
144+
});
153145
let output = prog.finish_with_output();
154146
debug!("Output from command %s with args %? was %s {%s}[%?]",
155147
cmd, args, str::from_bytes(output.output),
@@ -260,16 +252,6 @@ fn command_line_test_output(args: &[~str]) -> ~[~str] {
260252
result
261253
}
262254

263-
fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~str] {
264-
let mut result = ~[];
265-
let p_output = command_line_test_with_env(args, &os::getcwd(), Some(env));
266-
let test_output = str::from_bytes(p_output.output);
267-
for test_output.split_iter('\n').advance |s| {
268-
result.push(s.to_owned());
269-
}
270-
result
271-
}
272-
273255
// assumes short_name and local_path are one and the same -- I should fix
274256
fn lib_output_file_name(workspace: &Path, parent: &str, short_name: &str) -> Path {
275257
debug!("lib_output_file_name: given %s and parent %s and short name %s",
@@ -494,9 +476,8 @@ fn test_package_version() {
494476
push("test_pkg_version")));
495477
}
496478
497-
// FIXME #7006: Fails on linux for some reason
498-
#[test]
499-
#[ignore]
479+
// FIXME #7006: Fails on linux/mac for some reason
480+
#[test] #[ignore]
500481
fn test_package_request_version() {
501482
let temp_pkg_id = PkgId::new("github.com/catamorphism/test_pkg_version#0.3");
502483
let temp = mk_empty_workspace(&LocalPath(Path("test_pkg_version")), &ExactRevision(~"0.3"));
@@ -632,33 +613,7 @@ fn rust_path_parse() {
632613
}
633614
634615
#[test]
635-
fn test_list() {
636-
let foo = PkgId::new("foo");
637-
let dir = mkdtemp(&os::tmpdir(), "test_list").expect("test_list failed");
638-
create_local_package_in(&foo, &dir);
639-
let bar = PkgId::new("bar");
640-
create_local_package_in(&bar, &dir);
641-
let quux = PkgId::new("quux");
642-
create_local_package_in(&quux, &dir);
643-
644-
command_line_test([~"install", ~"foo"], &dir);
645-
let env_arg = ~[(~"RUST_PATH", dir.to_str())];
646-
let list_output = command_line_test_output_with_env([~"list"], env_arg.clone());
647-
assert!(list_output.iter().any(|x| x.starts_with("foo-")));
648-
649-
command_line_test([~"install", ~"bar"], &dir);
650-
let list_output = command_line_test_output_with_env([~"list"], env_arg.clone());
651-
assert!(list_output.iter().any(|x| x.starts_with("foo-")));
652-
assert!(list_output.iter().any(|x| x.starts_with("bar-")));
653-
654-
command_line_test([~"install", ~"quux"], &dir);
655-
let list_output = command_line_test_output_with_env([~"list"], env_arg);
656-
assert!(list_output.iter().any(|x| x.starts_with("foo-")));
657-
assert!(list_output.iter().any(|x| x.starts_with("bar-")));
658-
assert!(list_output.iter().any(|x| x.starts_with("quux-")));
659-
}
660-
661-
#[test]
616+
#[ignore(reason = "Package database not yet implemented")]
662617
fn install_remove() {
663618
let foo = PkgId::new("foo");
664619
let bar = PkgId::new("bar");
@@ -667,43 +622,18 @@ fn install_remove() {
667622
create_local_package_in(&foo, &dir);
668623
create_local_package_in(&bar, &dir);
669624
create_local_package_in(&quux, &dir);
670-
let rust_path_to_use = ~[(~"RUST_PATH", dir.to_str())];
671625
command_line_test([~"install", ~"foo"], &dir);
672626
command_line_test([~"install", ~"bar"], &dir);
673627
command_line_test([~"install", ~"quux"], &dir);
674-
let list_output = command_line_test_output_with_env([~"list"], rust_path_to_use.clone());
675-
assert!(list_output.iter().any(|x| x.starts_with("foo")));
676-
assert!(list_output.iter().any(|x| x.starts_with("bar")));
677-
assert!(list_output.iter().any(|x| x.starts_with("quux")));
678-
command_line_test([~"uninstall", ~"foo"], &dir);
679-
let list_output = command_line_test_output_with_env([~"list"], rust_path_to_use.clone());
680-
assert!(!list_output.iter().any(|x| x.starts_with("foo")));
681-
assert!(list_output.iter().any(|x| x.starts_with("bar")));
682-
assert!(list_output.iter().any(|x| x.starts_with("quux")));
683-
}
684-
685-
#[test]
686-
fn install_check_duplicates() {
687-
// should check that we don't install two packages with the same full name *and* version
688-
// ("Is already installed -- doing nothing")
689-
// check invariant that there are no dups in the pkg database
690-
let dir = mkdtemp(&os::tmpdir(), "install_remove").expect("install_remove");
691-
let foo = PkgId::new("foo");
692-
create_local_package_in(&foo, &dir);
693-
694-
command_line_test([~"install", ~"foo"], &dir);
695-
command_line_test([~"install", ~"foo"], &dir);
696-
let mut contents = ~[];
697-
let check_dups = |p: &PkgId| {
698-
if contents.contains(p) {
699-
fail!("package database contains duplicate ID");
700-
}
701-
else {
702-
contents.push(copy *p);
703-
}
704-
false
705-
};
706-
list_installed_packages(check_dups);
628+
let list_output = command_line_test_output([~"list"]);
629+
assert!(list_output.iter().any(|x| x == &~"foo"));
630+
assert!(list_output.iter().any(|x| x == &~"bar"));
631+
assert!(list_output.iter().any(|x| x == &~"quux"));
632+
command_line_test([~"remove", ~"foo"], &dir);
633+
let list_output = command_line_test_output([~"list"]);
634+
assert!(!list_output.iter().any(|x| x == &~"foo"));
635+
assert!(list_output.iter().any(|x| x == &~"bar"));
636+
assert!(list_output.iter().any(|x| x == &~"quux"));
707637
}
708638
709639
#[test]

branches/snap-stage3/src/librustpkg/testsuite/pass/src/install-paths/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub fn f() -> int { 42 }
11+
fn f() -> int { 42 }

branches/snap-stage3/src/librustpkg/testsuite/pass/src/install-paths/main.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,4 @@ The test runner should check that, after `rustpkg install install-paths`
1919
* install-paths/build/install_pathsbench exists and is an executable
2020
*/
2121

22-
use lib::f;
23-
24-
mod lib;
25-
26-
fn main() {
27-
f();
28-
}
22+
fn main() {}

branches/snap-stage3/src/librustpkg/usage.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn general() {
1414
io::println("Usage: rustpkg [options] <cmd> [args..]
1515
1616
Where <cmd> is one of:
17-
build, clean, do, info, install, list, prefer, test, uninstall, unprefer
17+
build, clean, do, info, install, prefer, test, uninstall, unprefer
1818
1919
Options:
2020
@@ -55,12 +55,6 @@ Options:
5555
-j, --json Output the result as JSON");
5656
}
5757

58-
pub fn list() {
59-
io::println("rustpkg list
60-
61-
List all installed packages.");
62-
}
63-
6458
pub fn install() {
6559
io::println("rustpkg [options..] install [url] [target]
6660

0 commit comments

Comments
 (0)