Skip to content

Remove sources path and fix Vagrant vm #279

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

Merged
merged 5 commits into from
Dec 20, 2018
Merged
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
13 changes: 0 additions & 13 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Vagrant.configure("2") do |config|
############################################################
lxc-attach -n cratesfyi-container -- apt-get update
lxc-attach -n cratesfyi-container -- apt-get install -y --no-install-recommends curl ca-certificates binutils gcc libc6-dev libmagic1
lxc-attach -n cratesfyi-container -- su - cratesfyi -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2018-10-20'
lxc-attach -n cratesfyi-container -- su - cratesfyi -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly'

############################################################
# Installing extra targets into cratesfyi-container #
Expand Down
15 changes: 1 addition & 14 deletions src/docbuilder/chroot_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,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,
use utils::{get_package, source_path, copy_doc_dir,
update_sources, parse_rustc_version, command_result};
use db::{connect_db, add_package_into_database, add_build_into_database, add_path_into_database};
use cargo::core::Package;
Expand Down Expand Up @@ -181,19 +181,6 @@ impl DocBuilder {
}


/// Copies source files of a package into source_path
#[allow(dead_code)] // I've been using this function before storing files in database
fn copy_sources(&self, package: &Package) -> Result<()> {
debug!("Copying sources");
let destination =
PathBuf::from(&self.options.sources_path).join(format!("{}/{}",
package.manifest().name(),
package.manifest().version()));
// unwrap is safe here, this function will be always called after get_package
copy_dir(source_path(&package).unwrap(), &destination)
}


/// Copies documentation to destination directory
fn copy_documentation(&self,
package: &Package,
Expand Down
18 changes: 5 additions & 13 deletions src/docbuilder/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub struct DocBuilderOptions {
pub chroot_user: String,
pub container_name: String,
pub crates_io_index_path: PathBuf,
pub sources_path: PathBuf,
pub skip_if_exists: bool,
pub skip_if_log_exists: bool,
pub skip_oldest_versions: bool,
Expand All @@ -28,15 +27,14 @@ impl Default for DocBuilderOptions {

let cwd = env::current_dir().unwrap();

let (prefix, destination, chroot_path, crates_io_index_path, sources_path) =
let (prefix, destination, chroot_path, crates_io_index_path) =
generate_paths(cwd);

DocBuilderOptions {
prefix: prefix,
destination: destination,
chroot_path: chroot_path,
crates_io_index_path: crates_io_index_path,
sources_path: sources_path,

chroot_user: "cratesfyi".to_string(),
container_name: "cratesfyi-container".to_string(),
Expand All @@ -57,13 +55,12 @@ impl fmt::Debug for DocBuilderOptions {
write!(f,
"DocBuilderOptions {{ destination: {:?}, chroot_path: {:?}, \
crates_io_index_path: {:?}, \
sources_path: {:?}, container_name: {:?}, chroot_user: {:?}, \
container_name: {:?}, chroot_user: {:?}, \
keep_build_directory: {:?}, skip_if_exists: {:?}, \
skip_if_log_exists: {:?}, debug: {:?} }}",
self.destination,
self.chroot_path,
self.crates_io_index_path,
self.sources_path,
self.container_name,
self.chroot_user,
self.keep_build_directory,
Expand All @@ -77,14 +74,13 @@ impl fmt::Debug for DocBuilderOptions {
impl DocBuilderOptions {
/// Creates new DocBuilderOptions from prefix
pub fn from_prefix(prefix: PathBuf) -> DocBuilderOptions {
let (prefix, destination, chroot_path, crates_io_index_path, sources_path) =
let (prefix, destination, chroot_path, crates_io_index_path) =
generate_paths(prefix);
DocBuilderOptions {
prefix: prefix,
destination: destination,
chroot_path: chroot_path,
crates_io_index_path: crates_io_index_path,
sources_path: sources_path,

..Default::default()
}
Expand All @@ -101,21 +97,17 @@ impl DocBuilderOptions {
if !self.crates_io_index_path.exists() {
bail!("crates.io-index path '{}' does not exist", self.crates_io_index_path.display());
}
if !self.sources_path.exists() {
bail!("sources path '{}' does not exist", self.sources_path.display());
}
Ok(())
}
}



fn generate_paths(prefix: PathBuf) -> (PathBuf, PathBuf, PathBuf, PathBuf, PathBuf) {
fn generate_paths(prefix: PathBuf) -> (PathBuf, PathBuf, PathBuf, PathBuf) {

let destination = PathBuf::from(&prefix).join("documentations");
let chroot_path = PathBuf::from(&prefix).join("cratesfyi-container/rootfs");
let crates_io_index_path = PathBuf::from(&prefix).join("crates.io-index");
let sources_path = PathBuf::from(&prefix).join("sources");

(prefix, destination, chroot_path, crates_io_index_path, sources_path)
(prefix, destination, chroot_path, crates_io_index_path)
}
1 change: 0 additions & 1 deletion src/web/sitemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use rustc_serialize::json::Json;
use super::page::Page;
use super::pool::Pool;
use time;
use db::connect_db;

pub fn sitemap_handler(req: &mut Request) -> IronResult<Response> {
let conn = extension!(req, Pool);
Expand Down