}
impl Manifest {
- pub fn new(summary: Summary, targets: Vec<Target>,
+ pub fn new(summary: Summary,
+ targets: Vec<Target>,
exclude: Vec<String>,
include: Vec<String>,
links: Option<String>,
}));
let mut src = PathSource::new(&path, &self.source_id, self.config);
try!(src.update());
- src.download(package)
+ let pkg = try!(src.download(package));
+
+ // Unfortunately the index and the actual Cargo.toml in the index can
+ // differ due to historical Cargo bugs. To paper over these we trash the
+ // *summary* loaded from the Cargo.toml we just downloaded with the one
+ // we loaded from the index.
+ let summaries = try!(self.index.summaries(package.name()));
+ let summary = summaries.iter().map(|s| &s.0).find(|s| {
+ s.package_id() == package
+ }).expect("summary not found");
+ let mut manifest = pkg.manifest().clone();
+ manifest.set_summary(summary.clone());
+ Ok(Package::new(manifest, pkg.manifest_path()))
}
fn fingerprint(&self, pkg: &Package) -> CargoResult<String> {
map.insert("name".to_string(), dep.name.to_json());
map.insert("req".to_string(), dep.vers.to_json());
map.insert("features".to_string(), dep.features.to_json());
- map.insert("default_features".to_string(), false.to_json());
+ map.insert("default_features".to_string(), true.to_json());
map.insert("target".to_string(), dep.target.to_json());
map.insert("optional".to_string(), false.to_json());
map.insert("kind".to_string(), dep.kind.to_json());
for dep in self.deps.iter() {
let target = match dep.target {
None => String::new(),
- Some(ref s) => format!("target.{}.", s),
+ Some(ref s) => format!("target.'{}'.", s),
};
let kind = match &dep.kind[..] {
"build" => "build-",
Package::new("foo", "0.1.0").publish();
Package::new("bar", "0.1.0")
- .target_dep("foo", "0.1.0", "'cfg(unix)'")
- .target_dep("foo", "0.1.0", "'cfg(windows)'")
+ .target_dep("foo", "0.1.0", "cfg(unix)")
+ .target_dep("foo", "0.1.0", "cfg(windows)")
.publish();
let p = project("a")
#[macro_use]
extern crate cargotest;
extern crate hamcrest;
+extern crate url;
use std::fs::{self, File};
use std::io::prelude::*;
+use std::path::PathBuf;
use cargotest::cargo_process;
use cargotest::support::git;
use cargotest::support::registry::{self, Package};
use cargotest::support::{project, execs};
use hamcrest::assert_that;
+use url::Url;
+
+fn registry_path() -> PathBuf { paths::root().join("registry") }
+fn registry() -> Url { Url::from_file_path(&*registry_path()).ok().unwrap() }
#[test]
fn simple() {
.file("src/main.rs", r#"
fn main() {}
"#);
- assert_that(p.cargo_process("publish").arg("-v"),
+ assert_that(p.cargo_process("publish")
+ .arg("-v")
+ .arg("--host").arg(registry().to_string()),
execs().with_status(101)
.with_stderr_contains("\
[ERROR] the license file `foo` does not exist"));
[FINISHED] [..]
"));
}
+
+#[test]
+fn toml_lies_but_index_is_truth() {
+ Package::new("foo", "0.2.0").publish();
+ Package::new("bar", "0.3.0")
+ .dep("foo", "0.2.0")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.3.0"
+ authors = []
+
+ [dependencies]
+ foo = "0.1.0"
+ "#)
+ .file("src/lib.rs", "extern crate foo;")
+ .publish();
+
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.5.0"
+ authors = []
+
+ [dependencies]
+ bar = "0.3"
+ "#)
+ .file("src/main.rs", "fn main() {}");
+ p.build();
+
+ assert_that(p.cargo("build").arg("-v"),
+ execs().with_status(0));
+}