Browse Source

additional logging

feat/mass-publish-tool
Jonathan Strong 1 year ago
parent
commit
9545b350a4
  1. 13
      src/publish.rs

13
src/publish.rs

@ -734,6 +734,7 @@ fn parse_manifests(
// .into_iter() // .into_iter()
.map(|(crate_name, versions)| -> Result<(String, Vec<VersionMeta>), Error> { .map(|(crate_name, versions)| -> Result<(String, Vec<VersionMeta>), Error> {
let begin = Instant::now(); let begin = Instant::now();
debug!(%crate_name, "parsing manifests");
let mut version_metas = Vec::new(); let mut version_metas = Vec::new();
for index_meta in versions { for index_meta in versions {
let version = index_meta.vers.clone(); let version = index_meta.vers.clone();
@ -765,14 +766,22 @@ fn parse_manifests(
let mut readme: Option<String> = None; let mut readme: Option<String> = None;
if let Some(readme_path) = manifest.package.readme.as_ref() { if let Some(readme_path) = manifest.package.readme.as_ref() {
let decoder = flate2::read::GzDecoder::new(&dot_crate_bytes[..]); let decoder = flate2::read::GzDecoder::new(&dot_crate_bytes[..]);
if let Some(readme_content) = extract_readme_from_tar(decoder, readme_path)? { if let Some(readme_content) = extract_readme_from_tar(decoder, readme_path).map_err(|err| {
error!(%crate_name, vers = %index_meta.vers, ?err, "failed to extract readme");
err
})? {
trace!(length = readme_content.len(), "extracted readme file content from .crate targz archive"); trace!(length = readme_content.len(), "extracted readme file content from .crate targz archive");
readme = Some(readme_content); readme = Some(readme_content);
} }
} }
let tmp = TempDir::new()?; let tmp = TempDir::new()?;
let decoder = flate2::read::GzDecoder::new(&dot_crate_bytes[..]); let decoder = flate2::read::GzDecoder::new(&dot_crate_bytes[..]);
tar::Archive::new(decoder).unpack(tmp.path())?; tar::Archive::new(decoder).unpack(tmp.path())
.map_err(|err| {
error!(%crate_name, vers = %index_meta.vers, ?err, "failed to unpack to temp dir");
err
})?;
trace!(tmpdir = ?tmp.path(), "unpacked .crate archive to temp dir"); trace!(tmpdir = ?tmp.path(), "unpacked .crate archive to temp dir");
let target_dir = tmp.path().join("target"); let target_dir = tmp.path().join("target");
std::fs::create_dir(&target_dir)?; std::fs::create_dir(&target_dir)?;

Loading…
Cancel
Save