diff options
author | Norbert Preining <norbert@preining.info> | 2022-01-16 03:01:19 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-01-16 03:01:19 +0000 |
commit | a574e957682cad50981ddb567c2a106213dc8672 (patch) | |
tree | cd02ecf7773fd7bad8e7b6cdb07cf2ff437ba59f /support/pkgcheck/src/main.rs | |
parent | 0cb730e5737ffa35f797eaf75c2613e5ac88617c (diff) |
CTAN sync 202201160301
Diffstat (limited to 'support/pkgcheck/src/main.rs')
-rw-r--r-- | support/pkgcheck/src/main.rs | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/support/pkgcheck/src/main.rs b/support/pkgcheck/src/main.rs index bb8e90b76e..b18fd8793b 100644 --- a/support/pkgcheck/src/main.rs +++ b/support/pkgcheck/src/main.rs @@ -49,7 +49,6 @@ use std::path::Path; use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; -use blake2::{Blake2b, Digest}; use rustc_hash::{FxHashMap, FxHashSet}; use std::sync::mpsc::{channel, Sender}; @@ -80,14 +79,14 @@ const BLOCKSIZE: usize = 4096; fn hash_file_inner(path: &Path) -> io::Result<Vec<u8>> { let mut buf = [0u8; BLOCKSIZE]; let mut fp = File::open(&path)?; - let mut digest = Blake2b::default(); + let mut digest = blake3::Hasher::new(); loop { match fp.read(&mut buf)? { 0 => break, - n => digest.update(&buf[..n]), + n => { digest.update(&buf[..n]); }, } } - Ok(digest.finalize().to_vec()) + Ok(digest.finalize().as_bytes().to_vec()) } fn hash_file(fsize: u64, path: PathBuf, tx: &HashSender) { @@ -576,22 +575,22 @@ fn check_tds_archive_name(tds_zip: &Option<String>) -> Option<String> { } } -fn unzip_tds_archive(tds_zip: &str, tmp_dir: &str) { - match run_cmd("unzip", &["-q", "-d", tmp_dir, tds_zip]) { - CmdReturn { status: true, .. } => (), - CmdReturn { - status: false, - output: out, - } => { - if let Some(o) = out { - e0033!(&tds_zip, o); - } else { - e0033!(&tds_zip, "<no error given"); - } - process::exit(1); - } - } -} +// fn unzip_tds_archive(tds_zip: &str, tmp_dir: &str) { +// match run_cmd("unzip", &["-q", "-d", tmp_dir, tds_zip]) { +// CmdReturn { status: true, .. } => (), +// CmdReturn { +// status: false, +// output: out, +// } => { +// if let Some(o) = out { +// e0033!(&tds_zip, o); +// } else { +// e0033!(&tds_zip, "<no error given"); +// } +// process::exit(1); +// } +// } +// } fn check_tds_archive(pkg_name: &str, tds_zip: &str, hashes: &DupHashes) { i0003!(tds_zip); @@ -619,11 +618,13 @@ fn check_tds_archive(pkg_name: &str, tds_zip: &str, hashes: &DupHashes) { let mut pkg_replacements: FxHashMap<&str, &str> = FxHashMap::default(); pkg_replacements.insert("babel-base", "babel"); pkg_replacements.insert("latex-base", "latex"); + pkg_replacements.insert("latex-lab", "latex"); pkg_replacements.insert("latex-tools", "latex"); pkg_replacements.insert("latex-graphics", "latex"); pkg_replacements.insert("latex-amsmath", "latex"); pkg_replacements.insert("latex-firstaid", "latex/firstaid"); pkg_replacements.insert("latex-base-dev", "latex-dev"); + pkg_replacements.insert("latex-lab-dev", "latex-dev"); pkg_replacements.insert("latex-tools-dev", "latex-dev"); pkg_replacements.insert("latex-graphics-dev", "latex-dev"); pkg_replacements.insert("latex-amsmath-dev", "latex-dev"); @@ -643,7 +644,17 @@ fn check_tds_archive(pkg_name: &str, tds_zip: &str, hashes: &DupHashes) { }; let tmp_dir_offset = tmp_dir.path().to_str().unwrap().len() + 1; - unzip_tds_archive(tds_zip, tmp_dir.path().to_str().unwrap()); + let tmp_dir_str = tmp_dir.path().to_str().unwrap(); + // unzip the TDS zip archive into a temporary directory + match ut.unzip(tds_zip, tmp_dir_str) { + Ok(_) => {}, + Err(e) => { + println!("Could not unpack `{}` into directory `{}`", tds_zip, tmp_dir_str); + println!("Error from unzip: {}", e); + e0033!(&tds_zip, e); + process::exit(1) + } + } // in order to compare the package files with the content of the // tds zip archive we need to checksum the files in the tds zip @@ -896,7 +907,7 @@ fn fix_perms(entry: &str) { } i0005!(entry); - let rc = run_cmd("/bin/chmod", &["-v", "ug=rwX,o=rX", entry]); + let rc = run_cmd("chmod", &["-v", "ug=rwX,o=rX", entry]); if rc.status { if let Some(op) = rc.output { |