Skip to content

Get build_package_in_chroot target from metadata.default_target. #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions src/docbuilder/chroot_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

use super::DocBuilder;
use super::crates::crates_from_path;
use super::metadata::Metadata;
use utils::{get_package, source_path, copy_dir, copy_doc_dir, update_sources};
use db::{connect_db, add_package_into_database, add_build_into_database, add_path_into_database};
use cargo::core::Package;
Expand Down Expand Up @@ -118,9 +119,23 @@ impl DocBuilder {
use std::error::Error as StdError;
debug!("Building package in chroot");
let (rustc_version, cratesfyi_version) = self.get_versions();
let cmd = format!("cratesfyi doc {} ={}",
package.manifest().name(),
package.manifest().version());

let meta = Metadata::from_package(package).ok();
let target = meta.as_ref().and_then(|meta| meta.default_target.as_ref());
let cmd = match target {
Some(target) if TARGETS.contains(&target.as_str()) => {
format!("cratesfyi doc {} ={} {}",
package.manifest().name(),
package.manifest().version(),
target)
}
_ => {
format!("cratesfyi doc {} ={}",
package.manifest().name(),
package.manifest().version())
}
};

match self.chroot_command(cmd) {
Ok(o) => {
ChrootBuilderResult {
Expand Down