Skip to content

Commit f634fae

Browse files
author
Jakub
committed
---
yaml --- r: 145014 b: refs/heads/try2 c: 3d14e82 h: refs/heads/master v: v3
1 parent bfce291 commit f634fae

File tree

24 files changed

+299
-599
lines changed

24 files changed

+299
-599
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 323e8f07ff4d5b8e2e38fe94a13c55070ce66384
8+
refs/heads/try2: 3d14e82be752959fb010a786ef4c9ef417bd64db
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/rt.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ RUNTIME_CXXS_$(1)_$(2) := \
7575
rt/rust_rng.cpp \
7676
rt/rust_upcall.cpp \
7777
rt/rust_uv.cpp \
78+
rt/rust_crate_map.cpp \
7879
rt/isaac/randport.cpp \
7980
rt/miniz.cpp \
8081
rt/memory_region.cpp \

branches/try2/src/librustc/middle/stack_check.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,6 @@ fn stack_check_item(v: StackCheckVisitor,
8080
visit::walk_method_helper(&mut v, method, new_cx);
8181
}
8282
}
83-
ast::item_trait(_, _, ref methods) => {
84-
for method in methods.iter() {
85-
match *method {
86-
ast::provided(@ref method) => {
87-
let safe_stack = fixed_stack_segment(method.attrs);
88-
let new_cx = Context {safe_stack: safe_stack, ..in_cx};
89-
visit::walk_method_helper(&mut v, method, new_cx);
90-
}
91-
ast::required(*) => ()
92-
}
93-
}
94-
}
9583
_ => {
9684
visit::walk_item(&mut v, item, in_cx);
9785
}

branches/try2/src/librustc/middle/ty.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,7 +4267,6 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
42674267
static tycat_int: int = 3;
42684268
static tycat_float: int = 4;
42694269
static tycat_bot: int = 5;
4270-
static tycat_raw_ptr: int = 6;
42714270

42724271
static opcat_add: int = 0;
42734272
static opcat_sub: int = 1;
@@ -4311,7 +4310,6 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
43114310
ty_int(_) | ty_uint(_) | ty_infer(IntVar(_)) => tycat_int,
43124311
ty_float(_) | ty_infer(FloatVar(_)) => tycat_float,
43134312
ty_bot => tycat_bot,
4314-
ty_ptr(_) => tycat_raw_ptr,
43154313
_ => tycat_other
43164314
}
43174315
}
@@ -4326,8 +4324,7 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
43264324
/*char*/ [f, f, f, f, t, t, f, f],
43274325
/*int*/ [t, t, t, t, t, t, t, f],
43284326
/*float*/ [t, t, t, f, t, t, f, f],
4329-
/*bot*/ [t, t, t, t, f, f, t, t],
4330-
/*raw ptr*/ [f, f, f, f, t, t, f, f]];
4327+
/*bot*/ [t, t, t, t, f, f, t, t]];
43314328

43324329
return tbl[tycat(cx, ty)][opcat(op)];
43334330
}

branches/try2/src/librustpkg/package_id.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -99,35 +99,7 @@ impl PkgId {
9999
/// True if the ID has multiple components
100100
pub fn is_complex(&self) -> bool {
101101
self.short_name != self.path.to_str()
102-
}
103-
104-
pub fn prefixes_iter(&self) -> Prefixes {
105-
Prefixes {
106-
components: self.path.components().to_owned(),
107-
remaining: ~[]
108-
}
109-
}
110-
111-
}
112-
113-
struct Prefixes {
114-
priv components: ~[~str],
115-
priv remaining: ~[~str]
116-
}
117-
118-
impl Iterator<(Path, Path)> for Prefixes {
119-
#[inline]
120-
fn next(&mut self) -> Option<(Path, Path)> {
121-
if self.components.len() <= 1 {
122-
None
123-
}
124-
else {
125-
let last = self.components.pop();
126-
self.remaining.push(last);
127-
// converting to str and then back is a little unfortunate
128-
Some((Path(self.components.to_str()), Path(self.remaining.to_str())))
129-
}
130-
}
102+
}
131103
}
132104

133105
impl ToStr for PkgId {
@@ -147,4 +119,3 @@ pub fn hash(data: ~str) -> ~str {
147119
write(hasher, data);
148120
hasher.result_str()
149121
}
150-

branches/try2/src/librustpkg/package_source.rs

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use context::*;
1818
use crate::Crate;
1919
use messages::*;
2020
use source_control::{git_clone, git_clone_general};
21-
use path_util::{find_dir_using_rust_path_hack, default_workspace};
21+
use path_util::{find_dir_using_rust_path_hack, default_workspace, make_dir_rwx_recursive};
2222
use util::compile_crate;
2323
use workspace::is_workspace;
2424
use workcache_support;
@@ -77,33 +77,6 @@ impl PkgSrc {
7777
let dir: Path = match path {
7878
Some(d) => (*d).clone(),
7979
None => {
80-
// See if any of the prefixes of this package ID form a valid package ID
81-
// That is, is this a package ID that points into the middle of a workspace?
82-
for (prefix, suffix) in id.prefixes_iter() {
83-
let package_id = PkgId::new(prefix.to_str());
84-
let path = workspace.push("src").push_rel(&package_id.path);
85-
debug!("in loop: checking if %s is a directory", path.to_str());
86-
if os::path_is_dir(&path) {
87-
let ps = PkgSrc::new(workspace.clone(),
88-
use_rust_path_hack,
89-
PkgId::new(prefix.to_str()));
90-
debug!("pkgsrc: Returning [%s|%s|%s]", workspace.to_str(),
91-
ps.start_dir.push_rel(&suffix).to_str(), ps.id.to_str());
92-
93-
return PkgSrc {
94-
workspace: workspace,
95-
start_dir: ps.start_dir.push_rel(&suffix),
96-
id: ps.id,
97-
libs: ~[],
98-
mains: ~[],
99-
tests: ~[],
100-
benchs: ~[]
101-
}
102-
103-
};
104-
}
105-
106-
// Ok, no prefixes work, so try fetching from git
10780
let mut ok_d = None;
10881
for w in to_try.iter() {
10982
debug!("Calling fetch_git on %s", w.to_str());
@@ -120,17 +93,16 @@ impl PkgSrc {
12093
if use_rust_path_hack {
12194
match find_dir_using_rust_path_hack(&id) {
12295
Some(d) => d,
123-
None => {
124-
cond.raise((id.clone(),
125-
~"supplied path for package dir does not \
126-
exist, and couldn't interpret it as a URL fragment"))
127-
}
96+
None => cond.raise((id.clone(),
97+
~"supplied path for package dir does not \
98+
exist, and couldn't interpret it as a URL fragment"))
12899
}
129100
}
130101
else {
131102
cond.raise((id.clone(),
132-
~"supplied path for package dir does not \
133-
exist, and couldn't interpret it as a URL fragment"))
103+
~"supplied path for package dir does not \
104+
exist, and couldn't interpret it as a URL fragment"))
105+
134106
}
135107
}
136108
}
@@ -143,9 +115,6 @@ impl PkgSrc {
143115
non-directory"));
144116
}
145117

146-
debug!("pkgsrc: Returning {%s|%s|%s}", workspace.to_str(),
147-
dir.to_str(), id.to_str());
148-
149118
PkgSrc {
150119
workspace: workspace,
151120
start_dir: dir,
@@ -197,12 +166,14 @@ impl PkgSrc {
197166
url, clone_target.to_str(), pkgid.version.to_str());
198167

199168
if git_clone_general(url, &clone_target, &pkgid.version) {
200-
// since the operation succeeded, move clone_target to local
201-
if !os::rename_file(&clone_target, local) {
202-
None
169+
// Since the operation succeeded, move clone_target to local.
170+
// First, create all ancestor directories.
171+
if make_dir_rwx_recursive(&local.pop())
172+
&& os::rename_file(&clone_target, local) {
173+
Some(local.clone())
203174
}
204175
else {
205-
Some(local.clone())
176+
None
206177
}
207178
}
208179
else {

branches/try2/src/librustpkg/path_util.rs

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ pub static U_RWX: i32 = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
4343
/// succeeded.
4444
pub fn make_dir_rwx(p: &Path) -> bool { os::make_dir(p, U_RWX) }
4545

46+
pub fn make_dir_rwx_recursive(p: &Path) -> bool { os::mkdir_recursive(p, U_RWX) }
47+
4648
// n.b. The next three functions ignore the package version right
4749
// now. Should fix that.
4850

4951
/// True if there's a directory in <workspace> with
5052
/// pkgid's short name
5153
pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool {
54+
debug!("Checking in src dir of %s for %s",
55+
workspace.to_str(), pkgid.to_str());
5256
workspace_contains_package_id_(pkgid, workspace, |p| { p.push("src") }).is_some()
5357
}
5458

5559
pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path,
5660
// Returns the directory it was actually found in
5761
workspace_to_src_dir: &fn(&Path) -> Path) -> Option<Path> {
58-
if !os::path_is_dir(workspace) {
59-
return None;
60-
}
61-
6262
let src_dir = workspace_to_src_dir(workspace);
6363

6464
let mut found = None;
@@ -143,17 +143,9 @@ pub fn built_library_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Pat
143143
}
144144

145145
/// Does the actual searching stuff
146-
pub fn installed_library_in_workspace(pkg_path: &Path, workspace: &Path) -> Option<Path> {
146+
pub fn installed_library_in_workspace(short_name: &str, workspace: &Path) -> Option<Path> {
147147
// This could break once we're handling multiple versions better -- I should add a test for it
148-
match pkg_path.filename() {
149-
None => None,
150-
Some(short_name) => library_in_workspace(pkg_path,
151-
short_name,
152-
Install,
153-
workspace,
154-
"lib",
155-
&NoVersion)
156-
}
148+
library_in_workspace(&Path(short_name), short_name, Install, workspace, "lib", &NoVersion)
157149
}
158150

159151
/// `workspace` is used to figure out the directory to search.
@@ -399,12 +391,3 @@ pub fn find_dir_using_rust_path_hack(p: &PkgId) -> Option<Path> {
399391
}
400392
None
401393
}
402-
403-
/// True if the user set RUST_PATH to something non-empty --
404-
/// as opposed to the default paths that rustpkg adds automatically
405-
pub fn user_set_rust_path() -> bool {
406-
match os::getenv("RUST_PATH") {
407-
None | Some(~"") => false,
408-
Some(_) => true
409-
}
410-
}

branches/try2/src/librustpkg/rustpkg.rs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use rustc::metadata::filesearch::rust_path;
3333
use extra::{getopts};
3434
use syntax::{ast, diagnostic};
3535
use util::*;
36-
use messages::{error, warn, note};
36+
use messages::*;
3737
use path_util::build_pkg_id_in_workspace;
3838
use path_util::{U_RWX, in_rust_path};
3939
use path_util::{built_executable_in_workspace, built_library_in_workspace, default_workspace};
@@ -181,10 +181,7 @@ pub trait CtxMethods {
181181
/// second is a list of declared and discovered inputs
182182
fn install(&self, src: PkgSrc) -> (~[Path], ~[(~str, ~str)]);
183183
/// Returns a list of installed files
184-
fn install_no_build(&self,
185-
source_workspace: &Path,
186-
target_workspace: &Path,
187-
id: &PkgId) -> ~[Path];
184+
fn install_no_build(&self, workspace: &Path, id: &PkgId) -> ~[Path];
188185
fn prefer(&self, _id: &str, _vers: Option<~str>);
189186
fn test(&self);
190187
fn uninstall(&self, _id: &str, _vers: Option<~str>);
@@ -467,40 +464,28 @@ impl CtxMethods for BuildContext {
467464
// install to the first workspace in the RUST_PATH if there's
468465
// a non-default RUST_PATH. This code installs to the same
469466
// workspace the package was built in.
470-
let actual_workspace = if path_util::user_set_rust_path() {
471-
default_workspace()
472-
}
473-
else {
474-
Path(destination_workspace)
475-
};
476-
debug!("install: destination workspace = %s, id = %s, installing to %s",
477-
destination_workspace, id_str, actual_workspace.to_str());
478-
let result = subself.install_no_build(&Path(destination_workspace),
479-
&actual_workspace,
480-
&sub_id);
467+
debug!("install: destination workspace = %s, id = %s",
468+
destination_workspace, id_str);
469+
let result = subself.install_no_build(&Path(destination_workspace), &sub_id);
481470
debug!("install: id = %s, about to call discover_outputs, %?",
482471
id_str, result.to_str());
483472

484473
discover_outputs(exec, result.clone());
485474
sub_files.write(|r| { *r = result.clone(); });
486475
sub_inputs.write(|r| { *r = *r + exec.lookup_discovered_inputs() });
487-
note(fmt!("Installed package %s to %s", id_str, actual_workspace.to_str()));
488476
}
489477
};
490478
(installed_files.unwrap(), inputs.unwrap())
491479
}
492480

493-
fn install_no_build(&self,
494-
source_workspace: &Path,
495-
target_workspace: &Path,
496-
id: &PkgId) -> ~[Path] {
481+
fn install_no_build(&self, workspace: &Path, id: &PkgId) -> ~[Path] {
497482
use conditions::copy_failed::cond;
498483

499484
// Now copy stuff into the install dirs
500-
let maybe_executable = built_executable_in_workspace(id, source_workspace);
501-
let maybe_library = built_library_in_workspace(id, source_workspace);
502-
let target_exec = target_executable_in_workspace(id, target_workspace);
503-
let target_lib = maybe_library.map(|_p| target_library_in_workspace(id, target_workspace));
485+
let maybe_executable = built_executable_in_workspace(id, workspace);
486+
let maybe_library = built_library_in_workspace(id, workspace);
487+
let target_exec = target_executable_in_workspace(id, workspace);
488+
let target_lib = maybe_library.map(|_p| target_library_in_workspace(id, workspace));
504489

505490
debug!("target_exec = %s target_lib = %? \
506491
maybe_executable = %? maybe_library = %?",

branches/try2/src/librustpkg/search.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ use version::Version;
1515
/// return Some(p) (returns the first one of there are multiple matches.) Return
1616
/// None if there's no such path.
1717
/// FIXME #8711: This ignores the desired version.
18-
pub fn find_installed_library_in_rust_path(pkg_path: &Path, _version: &Version) -> Option<Path> {
18+
pub fn find_installed_library_in_rust_path(short_name: &str, _version: &Version) -> Option<Path> {
1919
let rp = rust_path();
20-
debug!("find_installed_library_in_rust_path: looking for path %s", pkg_path.to_str());
2120
for p in rp.iter() {
22-
match installed_library_in_workspace(pkg_path, p) {
21+
match installed_library_in_workspace(short_name, p) {
2322
Some(path) => return Some(path),
2423
None => ()
2524
}

0 commit comments

Comments
 (0)