Skip to content

Commit 017c47c

Browse files
Merge pull request #279 from onur/remove-sources-path
Remove sources path and fix Vagrant vm
2 parents 2f681cd + 98b2283 commit 017c47c

File tree

5 files changed

+7
-42
lines changed

5 files changed

+7
-42
lines changed

Cargo.lock

-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Vagrantfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Vagrant.configure("2") do |config|
4747
############################################################
4848
lxc-attach -n cratesfyi-container -- apt-get update
4949
lxc-attach -n cratesfyi-container -- apt-get install -y --no-install-recommends curl ca-certificates binutils gcc libc6-dev libmagic1
50-
lxc-attach -n cratesfyi-container -- su - cratesfyi -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2018-10-20'
50+
lxc-attach -n cratesfyi-container -- su - cratesfyi -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly'
5151
5252
############################################################
5353
# Installing extra targets into cratesfyi-container #

src/docbuilder/chroot_builder.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use super::DocBuilder;
33
use super::crates::crates_from_path;
44
use super::metadata::Metadata;
5-
use utils::{get_package, source_path, copy_dir, copy_doc_dir,
5+
use utils::{get_package, source_path, copy_doc_dir,
66
update_sources, parse_rustc_version, command_result};
77
use db::{connect_db, add_package_into_database, add_build_into_database, add_path_into_database};
88
use cargo::core::Package;
@@ -181,19 +181,6 @@ impl DocBuilder {
181181
}
182182

183183

184-
/// Copies source files of a package into source_path
185-
#[allow(dead_code)] // I've been using this function before storing files in database
186-
fn copy_sources(&self, package: &Package) -> Result<()> {
187-
debug!("Copying sources");
188-
let destination =
189-
PathBuf::from(&self.options.sources_path).join(format!("{}/{}",
190-
package.manifest().name(),
191-
package.manifest().version()));
192-
// unwrap is safe here, this function will be always called after get_package
193-
copy_dir(source_path(&package).unwrap(), &destination)
194-
}
195-
196-
197184
/// Copies documentation to destination directory
198185
fn copy_documentation(&self,
199186
package: &Package,

src/docbuilder/options.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub struct DocBuilderOptions {
1313
pub chroot_user: String,
1414
pub container_name: String,
1515
pub crates_io_index_path: PathBuf,
16-
pub sources_path: PathBuf,
1716
pub skip_if_exists: bool,
1817
pub skip_if_log_exists: bool,
1918
pub skip_oldest_versions: bool,
@@ -28,15 +27,14 @@ impl Default for DocBuilderOptions {
2827

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

31-
let (prefix, destination, chroot_path, crates_io_index_path, sources_path) =
30+
let (prefix, destination, chroot_path, crates_io_index_path) =
3231
generate_paths(cwd);
3332

3433
DocBuilderOptions {
3534
prefix: prefix,
3635
destination: destination,
3736
chroot_path: chroot_path,
3837
crates_io_index_path: crates_io_index_path,
39-
sources_path: sources_path,
4038

4139
chroot_user: "cratesfyi".to_string(),
4240
container_name: "cratesfyi-container".to_string(),
@@ -57,13 +55,12 @@ impl fmt::Debug for DocBuilderOptions {
5755
write!(f,
5856
"DocBuilderOptions {{ destination: {:?}, chroot_path: {:?}, \
5957
crates_io_index_path: {:?}, \
60-
sources_path: {:?}, container_name: {:?}, chroot_user: {:?}, \
58+
container_name: {:?}, chroot_user: {:?}, \
6159
keep_build_directory: {:?}, skip_if_exists: {:?}, \
6260
skip_if_log_exists: {:?}, debug: {:?} }}",
6361
self.destination,
6462
self.chroot_path,
6563
self.crates_io_index_path,
66-
self.sources_path,
6764
self.container_name,
6865
self.chroot_user,
6966
self.keep_build_directory,
@@ -77,14 +74,13 @@ impl fmt::Debug for DocBuilderOptions {
7774
impl DocBuilderOptions {
7875
/// Creates new DocBuilderOptions from prefix
7976
pub fn from_prefix(prefix: PathBuf) -> DocBuilderOptions {
80-
let (prefix, destination, chroot_path, crates_io_index_path, sources_path) =
77+
let (prefix, destination, chroot_path, crates_io_index_path) =
8178
generate_paths(prefix);
8279
DocBuilderOptions {
8380
prefix: prefix,
8481
destination: destination,
8582
chroot_path: chroot_path,
8683
crates_io_index_path: crates_io_index_path,
87-
sources_path: sources_path,
8884

8985
..Default::default()
9086
}
@@ -101,21 +97,17 @@ impl DocBuilderOptions {
10197
if !self.crates_io_index_path.exists() {
10298
bail!("crates.io-index path '{}' does not exist", self.crates_io_index_path.display());
10399
}
104-
if !self.sources_path.exists() {
105-
bail!("sources path '{}' does not exist", self.sources_path.display());
106-
}
107100
Ok(())
108101
}
109102
}
110103

111104

112105

113-
fn generate_paths(prefix: PathBuf) -> (PathBuf, PathBuf, PathBuf, PathBuf, PathBuf) {
106+
fn generate_paths(prefix: PathBuf) -> (PathBuf, PathBuf, PathBuf, PathBuf) {
114107

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

120-
(prefix, destination, chroot_path, crates_io_index_path, sources_path)
112+
(prefix, destination, chroot_path, crates_io_index_path)
121113
}

src/web/sitemap.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_serialize::json::Json;
55
use super::page::Page;
66
use super::pool::Pool;
77
use time;
8-
use db::connect_db;
98

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

0 commit comments

Comments
 (0)