Commit 7c9f14af authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Remove dependency resolution in tar.gz package case

parent bd70b968
[root]
name = "pkgutils"
version = "0.1.1"
dependencies = [
"bidir-map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-rustls 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"liner 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"octavo 0.1.1 (git+https://github.com/libOctavo/octavo.git)",
"ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"pbr 1.0.0 (git+https://github.com/ids1024/pb?branch=duration)",
"petgraph 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.13 (git+https://github.com/redox-os/tar-rs)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"version-compare 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "adler32"
version = "1.0.2"
......@@ -307,6 +286,27 @@ dependencies = [
"ordermap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pkgutils"
version = "0.1.1"
dependencies = [
"bidir-map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-rustls 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"liner 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"octavo 0.1.1 (git+https://github.com/libOctavo/octavo.git)",
"ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"pbr 1.0.0 (git+https://github.com/ids1024/pb?branch=duration)",
"petgraph 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.13 (git+https://github.com/redox-os/tar-rs)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"version-compare 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.3.15"
......@@ -314,7 +314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.3.17"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -339,7 +339,7 @@ dependencies = [
"lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -637,7 +637,7 @@ dependencies = [
"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356"
"checksum petgraph 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "28d0872a49ce3ee71b345f4fa675afe394d9e0d077f8eeeb3d04081724065d67"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "61efcbcd9fa8d8fbb07c84e34a8af18a1ff177b449689ad38a6e9457ecc7b2ae"
"checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd"
"checksum rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c51c07654ddd93f6cb543c7a849863b03abc7e82591afda6dc8ad4ac3ac4a"
"checksum rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7febc28567082c345f10cddc3612c6ea020fc3297a1977d472cf9fdb73e6e493"
"checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509"
......
......@@ -196,70 +196,31 @@ fn main() {
let path = env::current_dir().unwrap().join(&package);
// Extract package report errors
let extracted_pkg = match Package::from_path(&path) {
Ok(p) => Some(p),
match Package::from_path(&path) {
Ok(p) => {
tar_gz_pkgs.push(p);
},
Err(e) => {
eprintln!("error: {}", e);
eprintln!("error during package open: {}", e);
if let Some(cause) = e.cause() {
eprintln!("cause: {}", cause);
}
success = false;
None
}
};
// Try to calculate dependencies for package if extraction was
// successful.
if let Some(mut pkg) = extracted_pkg {
// Obtain meta data from package to figure out its dependencies
let res: Option<()> = match pkg.meta() {
Ok(m) => {
// Calculate all dependencies and check for errors
if let Err(e) = database.calculate_depends(&m.name, &mut dependencies) {
eprintln!("error: {}", e);
if let Some(cause) = e.cause() {
eprintln!("cause: {}", cause);
success = false;
}
None
} else { // Dependency calculation was successful
Some(())
}
},
// Something went wrong when the meta data was obtained
Err(e) => {
eprintln!("error: {}", e);
if let Some(cause) = e.cause() {
eprintln!("cause: {}", cause);
}
success = false;
None
}
};
// Only install package if dependency calculation was successful
match res {
Some(_) => tar_gz_pkgs.push(pkg),
None => (),
}
}
} else {
// Package is not in current directory so calculate dependencies
// Package is not in current directory so calculate dependencies
// from database
match database.calculate_depends(package, &mut dependencies) {
Ok(_) => {
Ok(_) => {
dependencies.insert(package.to_string(), ());
},
Err(e) => {
eprintln!("error during dependency calculation: {}", e);
if let Some(cause) = e.cause() {
eprintln!("cause: {}", cause);
success = false;
}
success = false;
},
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment