Skip to content

Commit 2e7168b

Browse files
committed
---
yaml --- r: 65919 b: refs/heads/master c: 7d1065e h: refs/heads/master i: 65917: 5bc7eec 65915: 0974675 65911: b37ffe4 65903: d8d977e 65887: 62ec0fa 65855: 5928e78 65791: dfdf50b v: v3
1 parent 1706793 commit 2e7168b

File tree

15 files changed

+180
-577
lines changed

15 files changed

+180
-577
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e3c4104d746d87fc0f747005908c0b1ec209b3e4
2+
refs/heads/master: 7d1065e913e6d50ddb1a157f81bb7752caeca329
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/librustc/middle/lang_items.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,5 @@ pub fn collect_language_items(crate: @crate,
441441
let mut collector = LanguageItemCollector(crate, session);
442442
collector.collect();
443443
let LanguageItemCollector { items, _ } = collector;
444-
session.abort_if_errors();
445444
items
446445
}

trunk/src/librustpkg/messages.rs

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

trunk/src/librustpkg/package_id.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ impl PkgId {
6969
}
7070
};
7171

72-
debug!("local_path = %s, remote_path = %s", local_path.to_str(), remote_path.to_str());
7372
PkgId {
7473
local_path: local_path,
7574
remote_path: remote_path,
@@ -91,7 +90,11 @@ impl PkgId {
9190

9291
impl ToStr for PkgId {
9392
fn to_str(&self) -> ~str {
93+
let maybe_dash = match self.version {
94+
NoVersion => "",
95+
_ => "-"
96+
};
9497
// should probably use the filestem and not the whole path
95-
fmt!("%s-%s", self.local_path.to_str(), self.version.to_str())
98+
fmt!("%s%s%s", self.local_path.to_str(), maybe_dash, self.version.to_str())
9699
}
97100
}

trunk/src/librustpkg/package_source.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ use core::option::*;
1515
use core::{os, run, str, vec};
1616
use context::*;
1717
use crate::Crate;
18-
use messages::*;
1918
use path_util::pkgid_src_in_workspace;
20-
use util::compile_crate;
19+
use util::{compile_crate, note};
2120
use version::{ExactRevision, SemanticVersion, NoVersion};
2221

2322
// An enumeration of the unpacked source of a package workspace.
@@ -96,7 +95,7 @@ impl PkgSrc {
9695
};
9796

9897

99-
note(fmt!("Fetching package: git clone %s %s %?", url, local.to_str(), branch_args));
98+
note(fmt!("git clone %s %s %?", url, local.to_str(), branch_args));
10099

101100
if run::process_output("git",
102101
~[~"clone", copy url, local.to_str()] + branch_args).status != 0 {

trunk/src/librustpkg/path_util.rs

Lines changed: 22 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@
1111
// rustpkg utilities having to do with paths and directories
1212

1313
use core::prelude::*;
14-
pub use package_path::{RemotePath, LocalPath, normalize};
14+
pub use package_path::{RemotePath, LocalPath};
1515
pub use package_id::PkgId;
1616
pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
17-
pub use version::{Version, NoVersion, split_version_general};
1817
use core::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
1918
use core::os::mkdir_recursive;
2019
use core::os;
21-
use core::iterator::IteratorUtil;
22-
use messages::*;
23-
use package_id::*;
2420

2521
/// Returns the value of RUST_PATH, as a list
2622
/// of Paths. In general this should be read from the
@@ -42,39 +38,8 @@ pub fn make_dir_rwx(p: &Path) -> bool { os::make_dir(p, u_rwx) }
4238
/// True if there's a directory in <workspace> with
4339
/// pkgid's short name
4440
pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool {
45-
let src_dir = workspace.push("src");
46-
for os::list_dir(&src_dir).each |&p| {
47-
let p = Path(p);
48-
debug!("=> p = %s", p.to_str());
49-
if !os::path_is_dir(&src_dir.push_rel(&p)) {
50-
loop;
51-
}
52-
debug!("p = %s, remote_path = %s", p.to_str(), pkgid.remote_path.to_str());
53-
54-
if p == *pkgid.remote_path {
55-
return true;
56-
}
57-
else {
58-
let pf = p.filename();
59-
for pf.iter().advance |&pf| {
60-
let f_ = copy pf;
61-
let g = f_.to_str();
62-
match split_version_general(g, '-') {
63-
Some((ref might_match, ref vers)) => {
64-
debug!("might_match = %s, vers = %s", *might_match,
65-
vers.to_str());
66-
if *might_match == pkgid.short_name
67-
&& (*vers == pkgid.version || pkgid.version == NoVersion)
68-
{
69-
return true;
70-
}
71-
}
72-
None => ()
73-
}
74-
}
75-
}
76-
}
77-
false
41+
let pkgpath = workspace.push("src").push(pkgid.remote_path.to_str());
42+
os::path_is_dir(&pkgpath)
7843
}
7944

8045
/// Returns a list of possible directories
@@ -149,34 +114,31 @@ fn output_in_workspace(pkgid: &PkgId, workspace: &Path, what: OutputType) -> Opt
149114
/// Figure out what the library name for <pkgid> in <workspace>'s build
150115
/// directory is, and if the file exists, return it.
151116
pub fn built_library_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> {
152-
library_in_workspace(&pkgid.local_path, pkgid.short_name,
153-
Build, workspace, "build")
117+
// passing in local_path here sounds fishy
118+
library_in_workspace(pkgid.local_path.to_str(), pkgid.short_name, Build,
119+
workspace, "build")
154120
}
155121

156122
/// Does the actual searching stuff
157123
pub fn installed_library_in_workspace(short_name: &str, workspace: &Path) -> Option<Path> {
158-
library_in_workspace(&normalize(RemotePath(Path(short_name))),
159-
short_name, Install, workspace, "lib")
124+
library_in_workspace(short_name, short_name, Install, workspace, "lib")
160125
}
161126

162127

163128
/// This doesn't take a PkgId, so we can use it for `extern mod` inference, where we
164129
/// don't know the entire package ID.
165-
/// `workspace` is used to figure out the directory to search.
130+
/// `full_name` is used to figure out the directory to search.
166131
/// `short_name` is taken as the link name of the library.
167-
pub fn library_in_workspace(path: &LocalPath, short_name: &str, where: Target,
132+
fn library_in_workspace(full_name: &str, short_name: &str, where: Target,
168133
workspace: &Path, prefix: &str) -> Option<Path> {
169134
debug!("library_in_workspace: checking whether a library named %s exists",
170135
short_name);
171136

172137
// We don't know what the hash is, so we have to search through the directory
173138
// contents
174139

175-
debug!("short_name = %s where = %? workspace = %s \
176-
prefix = %s", short_name, where, workspace.to_str(), prefix);
177-
178140
let dir_to_search = match where {
179-
Build => workspace.push(prefix).push_rel(&**path),
141+
Build => workspace.push(prefix).push(full_name),
180142
Install => workspace.push(prefix)
181143
};
182144
debug!("Listing directory %s", dir_to_search.to_str());
@@ -231,11 +193,7 @@ pub fn library_in_workspace(path: &LocalPath, short_name: &str, where: Target,
231193
// Return the filename that matches, which we now know exists
232194
// (if result_filename != None)
233195
match result_filename {
234-
None => {
235-
warn(fmt!("library_in_workspace didn't find a library in %s for %s",
236-
dir_to_search.to_str(), short_name));
237-
None
238-
}
196+
None => None,
239197
Some(result_filename) => {
240198
let absolute_path = dir_to_search.push_rel(&result_filename);
241199
debug!("result_filename = %s", absolute_path.to_str());
@@ -252,17 +210,17 @@ pub fn target_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
252210
}
253211

254212

255-
/// Returns the executable that would be installed for <pkgid>
256-
/// in <workspace>
213+
/// Returns the installed path for <built_library> in <workspace>
257214
/// As a side effect, creates the lib-dir if it doesn't exist
258-
pub fn target_library_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
215+
pub fn target_library_in_workspace(workspace: &Path,
216+
built_library: &Path) -> Path {
259217
use conditions::bad_path::cond;
260-
if !os::path_is_dir(workspace) {
261-
cond.raise((copy *workspace,
262-
fmt!("Workspace supplied to target_library_in_workspace \
263-
is not a directory! %s", workspace.to_str())));
218+
let result = workspace.push("lib");
219+
if !os::path_exists(&result) && !mkdir_recursive(&result, u_rwx) {
220+
cond.raise((copy result, ~"I couldn't create the library directory"));
264221
}
265-
target_file_in_workspace(pkgid, workspace, Lib, Install)
222+
result.push(built_library.filename().expect(fmt!("I don't know how to treat %s as a library",
223+
built_library.to_str())))
266224
}
267225

268226
/// Returns the test executable that would be installed for <pkgid>
@@ -291,9 +249,7 @@ fn target_file_in_workspace(pkgid: &PkgId, workspace: &Path,
291249
};
292250
let result = workspace.push(subdir);
293251
if !os::path_exists(&result) && !mkdir_recursive(&result, u_rwx) {
294-
cond.raise((copy result, fmt!("target_file_in_workspace couldn't \
295-
create the %s dir (pkgid=%s, workspace=%s, what=%?, where=%?",
296-
subdir, pkgid.to_str(), workspace.to_str(), what, where)));
252+
cond.raise((copy result, fmt!("I couldn't create the %s dir", subdir)));
297253
}
298254
mk_output_path(what, where, pkgid, &result)
299255
}
@@ -319,8 +275,7 @@ pub fn build_pkg_id_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
319275
/// given whether we're building a library and whether we're building tests
320276
pub fn mk_output_path(what: OutputType, where: Target,
321277
pkg_id: &PkgId, workspace: &Path) -> Path {
322-
let short_name_with_version = fmt!("%s-%s", pkg_id.short_name,
323-
pkg_id.version.to_str());
278+
let short_name_with_version = pkg_id.short_name_with_version();
324279
// Not local_path.dir_path()! For package foo/bar/blat/, we want
325280
// the executable blat-0.5 to live under blat/
326281
let dir = match where {
@@ -336,7 +291,7 @@ pub fn mk_output_path(what: OutputType, where: Target,
336291
// this code is duplicated from elsewhere; fix this
337292
Lib => dir.push(os::dll_filename(short_name_with_version)),
338293
// executable names *aren't* versioned
339-
_ => dir.push(fmt!("%s%s%s", pkg_id.short_name,
294+
_ => dir.push(fmt!("%s%s%s", copy pkg_id.short_name,
340295
match what {
341296
Test => "test",
342297
Bench => "bench",

trunk/src/librustpkg/rustpkg.rc

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,18 @@ use rustc::metadata::filesearch;
3636
use extra::{getopts};
3737
use syntax::{ast, diagnostic};
3838
use util::*;
39-
use messages::*;
4039
use path_util::{build_pkg_id_in_workspace, first_pkgid_src_in_workspace};
41-
use path_util::{u_rwx, rust_path};
40+
use path_util::u_rwx;
4241
use path_util::{built_executable_in_workspace, built_library_in_workspace};
4342
use path_util::{target_executable_in_workspace, target_library_in_workspace};
44-
use workspace::{each_pkg_parent_workspace, pkg_parent_workspaces};
43+
use workspace::pkg_parent_workspaces;
4544
use context::Ctx;
4645
use package_id::PkgId;
4746
use package_source::PkgSrc;
4847

4948
mod conditions;
5049
mod context;
5150
mod crate;
52-
mod messages;
5351
mod package_id;
5452
mod package_path;
5553
mod package_source;
@@ -191,7 +189,7 @@ impl Ctx {
191189
// The package id is presumed to be the first command-line
192190
// argument
193191
let pkgid = PkgId::new(copy args[0]);
194-
for each_pkg_parent_workspace(&pkgid) |workspace| {
192+
for pkg_parent_workspaces(&pkgid) |workspace| {
195193
self.build(workspace, &pkgid);
196194
}
197195
}
@@ -223,19 +221,8 @@ impl Ctx {
223221
// The package id is presumed to be the first command-line
224222
// argument
225223
let pkgid = PkgId::new(args[0]);
226-
let workspaces = pkg_parent_workspaces(&pkgid);
227-
if workspaces.is_empty() {
228-
let rp = rust_path();
229-
assert!(!rp.is_empty());
230-
let src = PkgSrc::new(&rp[0], &build_pkg_id_in_workspace(&pkgid, &rp[0]),
231-
&pkgid);
232-
src.fetch_git();
233-
self.install(&rp[0], &pkgid);
234-
}
235-
else {
236-
for each_pkg_parent_workspace(&pkgid) |workspace| {
237-
self.install(workspace, &pkgid);
238-
}
224+
for pkg_parent_workspaces(&pkgid) |workspace| {
225+
self.install(workspace, &pkgid);
239226
}
240227
}
241228
"prefer" => {
@@ -272,8 +259,6 @@ impl Ctx {
272259
}
273260

274261
fn build(&self, workspace: &Path, pkgid: &PkgId) {
275-
debug!("build: workspace = %s pkgid = %s", workspace.to_str(),
276-
pkgid.to_str());
277262
let src_dir = first_pkgid_src_in_workspace(pkgid, workspace);
278263
let build_dir = build_pkg_id_in_workspace(pkgid, workspace);
279264
debug!("Destination dir = %s", build_dir.to_str());
@@ -325,14 +310,14 @@ impl Ctx {
325310
// Do something reasonable for now
326311

327312
let dir = build_pkg_id_in_workspace(id, workspace);
328-
note(fmt!("Cleaning package %s (removing directory %s)",
313+
util::note(fmt!("Cleaning package %s (removing directory %s)",
329314
id.to_str(), dir.to_str()));
330315
if os::path_exists(&dir) {
331316
os::remove_dir_recursive(&dir);
332-
note(fmt!("Removed directory %s", dir.to_str()));
317+
util::note(fmt!("Removed directory %s", dir.to_str()));
333318
}
334319

335-
note(fmt!("Cleaned package %s", id.to_str()));
320+
util::note(fmt!("Cleaned package %s", id.to_str()));
336321
}
337322

338323
fn info(&self) {
@@ -353,7 +338,7 @@ impl Ctx {
353338
let maybe_executable = built_executable_in_workspace(id, workspace);
354339
let maybe_library = built_library_in_workspace(id, workspace);
355340
let target_exec = target_executable_in_workspace(id, workspace);
356-
let target_lib = maybe_library.map(|_p| target_library_in_workspace(id, workspace));
341+
let target_lib = maybe_library.map(|p| target_library_in_workspace(workspace, p));
357342

358343
debug!("target_exec = %s target_lib = %? \
359344
maybe_executable = %? maybe_library = %?",
@@ -407,7 +392,7 @@ pub fn main() {
407392
let matches = &match getopts::getopts(args, opts) {
408393
result::Ok(m) => m,
409394
result::Err(f) => {
410-
error(fmt!("%s", getopts::fail_str(f)));
395+
util::error(fmt!("%s", getopts::fail_str(f)));
411396

412397
return;
413398
}
@@ -443,12 +428,8 @@ pub fn main() {
443428
};
444429
}
445430

446-
let sroot = match filesearch::get_rustpkg_sysroot() {
447-
Ok(r) => Some(@r.pop().pop()), Err(_) => None
448-
};
449-
debug!("Using sysroot: %?", sroot);
450431
Ctx {
451-
sysroot_opt: sroot, // Currently, only tests override this
432+
sysroot_opt: None, // Currently, only tests override this
452433
json: json,
453434
dep_cache: @mut HashMap::new()
454435
}.run(cmd, args);

trunk/src/librustpkg/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ pub fn find_library_in_search_path(sroot_opt: Option<@Path>, short_name: &str) -
2222
}
2323
None => None
2424
}
25-
}
25+
}

0 commit comments

Comments
 (0)