Skip to content

Commit 016d52e

Browse files
committed
Rename uses of PkgId to CrateId in librustpkg
1 parent f872c47 commit 016d52e

12 files changed

+301
-299
lines changed

src/etc/combine-tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def scrub(b):
4545
"""
4646
// AUTO-GENERATED FILE: DO NOT EDIT
4747
#[crate_id=\"run_pass_stage2#0.1\"];
48-
#[pkgid=\"run_pass_stage2#0.1\"];
48+
#[crate_id=\"run_pass_stage2#0.1\"];
4949
#[feature(globs, macro_rules, struct_variant, managed_boxes)];
5050
#[allow(warnings)];
5151
"""

src/librustpkg/api.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use context::*;
1212
use crate::*;
13-
use package_id::*;
13+
use crate_id::*;
1414
use package_source::*;
1515
use path_util::{platform_library_name, target_build_dir};
1616
use target::*;
@@ -92,7 +92,7 @@ pub fn build_lib_with_cfgs(sysroot: Path, root: Path, name: ~str,
9292
build_in_destination: false,
9393
destination_workspace: root.clone(),
9494
start_dir: root.join_many(["src", name.as_slice()]),
95-
id: PkgId{ version: version, ..PkgId::new(name)},
95+
id: CrateId{ version: version, ..CrateId::new(name)},
9696
// n.b. This assumes the package only has one crate
9797
libs: ~[mk_crate(lib)],
9898
mains: ~[],
@@ -115,7 +115,7 @@ pub fn build_exe_with_cfgs(sysroot: Path, root: Path, name: ~str,
115115
build_in_destination: false,
116116
destination_workspace: root.clone(),
117117
start_dir: root.join_many(["src", name.as_slice()]),
118-
id: PkgId{ version: version, ..PkgId::new(name)},
118+
id: CrateId{ version: version, ..CrateId::new(name)},
119119
libs: ~[],
120120
// n.b. This assumes the package only has one crate
121121
mains: ~[mk_crate(main)],
@@ -132,8 +132,8 @@ pub fn install_pkg(cx: &BuildContext,
132132
version: Version,
133133
// For now, these inputs are assumed to be inputs to each of the crates
134134
more_inputs: ~[(~str, Path)]) { // pairs of Kind and Path
135-
let pkgid = PkgId{ version: version, ..PkgId::new(name)};
136-
cx.install(PkgSrc::new(workspace.clone(), workspace, false, pkgid),
135+
let crateid = CrateId{ version: version, ..CrateId::new(name)};
136+
cx.install(PkgSrc::new(workspace.clone(), workspace, false, crateid),
137137
&WhatToBuild{ build_type: Inferred,
138138
inputs_to_discover: more_inputs,
139139
sources: Everything });
@@ -157,10 +157,10 @@ pub fn build_library_in_workspace(exec: &mut workcache::Exec,
157157
let out_name = workspace_build_dir.join_many([package_name.to_str(),
158158
platform_library_name(output)]);
159159
// make paths absolute
160-
let pkgid = PkgId::new(package_name);
160+
let crateid = CrateId::new(package_name);
161161
let absolute_paths = paths.map(|s| {
162162
let whatever = workspace.join_many([~"src",
163-
pkgid.to_str(),
163+
crateid.to_str(),
164164
s.to_owned()]);
165165
whatever.as_str().unwrap().to_owned()
166166
});
@@ -190,8 +190,8 @@ pub fn my_workspace(context: &Context, package_name: &str) -> Path {
190190
use bad_pkg_id = conditions::bad_pkg_id::cond;
191191

192192
// (this assumes no particular version is requested)
193-
let pkgid = PkgId::new(package_name);
194-
let workspaces = pkg_parent_workspaces(context, &pkgid);
193+
let crateid = CrateId::new(package_name);
194+
let workspaces = pkg_parent_workspaces(context, &crateid);
195195
if workspaces.is_empty() {
196196
bad_pkg_id.raise((Path::new(package_name), package_name.to_owned()));
197197
}

src/librustpkg/conditions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Useful conditions
1212

13-
pub use package_id::PkgId;
13+
pub use crate_id::CrateId;
1414
pub use std::io::FileStat;
1515
pub use std::io::process::ProcessExit;
1616
pub use std::path::Path;
@@ -20,15 +20,15 @@ condition! {
2020
}
2121

2222
condition! {
23-
pub nonexistent_package: (PkgId, ~str) -> Path;
23+
pub nonexistent_package: (CrateId, ~str) -> Path;
2424
}
2525

2626
condition! {
27-
pub missing_pkg_files: (PkgId) -> ();
27+
pub missing_pkg_files: (CrateId) -> ();
2828
}
2929

3030
condition! {
31-
pub bad_pkg_id: (Path, ~str) -> PkgId;
31+
pub bad_pkg_id: (Path, ~str) -> CrateId;
3232
}
3333

3434
condition! {

src/librustpkg/package_id.rs renamed to src/librustpkg/crate_id.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::hash;
1717
/// 'github.com/graydon/test'; path must be a relative
1818
/// path with >=1 component.
1919
#[deriving(Clone)]
20-
pub struct PkgId {
20+
pub struct CrateId {
2121
/// This is a path, on the local filesystem, referring to where the
2222
/// files for this package live. For example:
2323
/// github.com/mozilla/quux-whatever (it's assumed that if we're
@@ -35,14 +35,14 @@ pub struct PkgId {
3535
version: Version
3636
}
3737

38-
impl Eq for PkgId {
39-
fn eq(&self, other: &PkgId) -> bool {
38+
impl Eq for CrateId {
39+
fn eq(&self, other: &CrateId) -> bool {
4040
self.path == other.path && self.version == other.version
4141
}
4242
}
4343

44-
impl PkgId {
45-
pub fn new(s: &str) -> PkgId {
44+
impl CrateId {
45+
pub fn new(s: &str) -> CrateId {
4646
use conditions::bad_pkg_id::cond;
4747

4848
let mut given_version = None;
@@ -60,10 +60,10 @@ impl PkgId {
6060

6161
let path = Path::new(s);
6262
if !path.is_relative() {
63-
return cond.raise((path, ~"absolute pkgid"));
63+
return cond.raise((path, ~"absolute crate_id"));
6464
}
6565
if path.filename().is_none() {
66-
return cond.raise((path, ~"0-length pkgid"));
66+
return cond.raise((path, ~"0-length crate_id"));
6767
}
6868
let short_name = path.filestem_str().expect(format!("Strange path! {}", s));
6969

@@ -78,7 +78,7 @@ impl PkgId {
7878
}
7979
};
8080

81-
PkgId {
81+
CrateId {
8282
path: path.clone(),
8383
short_name: short_name.to_owned(),
8484
version: version
@@ -142,7 +142,7 @@ impl Iterator<(Path, Path)> for Prefixes {
142142
}
143143
}
144144

145-
impl ToStr for PkgId {
145+
impl ToStr for CrateId {
146146
fn to_str(&self) -> ~str {
147147
// should probably use the filestem and not the whole path
148148
format!("{}-{}", self.path.as_str().unwrap(), self.version.to_str())

src/librustpkg/installed_packages.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::os;
1616
use std::io;
1717
use std::io::fs;
1818

19-
pub fn list_installed_packages(f: |&PkgId| -> bool) -> bool {
19+
pub fn list_installed_packages(f: |&CrateId| -> bool) -> bool {
2020
let workspaces = rust_path();
2121
for p in workspaces.iter() {
2222
let binfiles = {
@@ -28,7 +28,7 @@ pub fn list_installed_packages(f: |&PkgId| -> bool) -> bool {
2828
match exec.filestem_str() {
2929
None => (),
3030
Some(exec_path) => {
31-
if !f(&PkgId::new(exec_path)) {
31+
if !f(&CrateId::new(exec_path)) {
3232
return false;
3333
}
3434
}
@@ -50,7 +50,7 @@ pub fn list_installed_packages(f: |&PkgId| -> bool) -> bool {
5050
let rel_path = rel_p.join(basename);
5151
rel_path.display().with_str(|s| {
5252
debug!("Rel name: {}", s);
53-
f(&PkgId::new(s));
53+
f(&CrateId::new(s));
5454
});
5555
}
5656
None => ()
@@ -78,7 +78,7 @@ pub fn has_library(p: &Path) -> Option<~str> {
7878
None
7979
}
8080

81-
pub fn package_is_installed(p: &PkgId) -> bool {
81+
pub fn package_is_installed(p: &CrateId) -> bool {
8282
let mut is_installed = false;
8383
list_installed_packages(|installed| {
8484
if installed == p {

0 commit comments

Comments
 (0)