diff options
author | Norbert Preining <norbert@preining.info> | 2020-04-15 03:02:52 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-04-15 03:02:52 +0000 |
commit | e768cc604852d6fe8821592cea67835f67eab0db (patch) | |
tree | 06dc26d3571570f9578f59825f6ecc2186dfb47c /support/pkgcheck | |
parent | c7235aafe4ddb8f9800cdf784212d4c53bb53e32 (diff) |
CTAN sync 202004150302
Diffstat (limited to 'support/pkgcheck')
-rw-r--r-- | support/pkgcheck/CHANGES.md | 17 | ||||
-rw-r--r-- | support/pkgcheck/Cargo.toml | 9 | ||||
-rwxr-xr-x | support/pkgcheck/bin/pkgcheck | bin | 7026480 -> 6109008 bytes | |||
-rw-r--r-- | support/pkgcheck/docs/errorsd.tex | 7 | ||||
-rw-r--r-- | support/pkgcheck/docs/pkgcheck.pdf | bin | 69832 -> 75087 bytes | |||
-rw-r--r-- | support/pkgcheck/docs/title.tex | 2 | ||||
-rw-r--r-- | support/pkgcheck/src/generate.pest.md | 4 | ||||
-rw-r--r-- | support/pkgcheck/src/main.rs | 66 | ||||
-rw-r--r-- | support/pkgcheck/src/messages/errorsd.rs | 5 | ||||
-rw-r--r-- | support/pkgcheck/src/utils.rs | 2 |
10 files changed, 69 insertions, 43 deletions
diff --git a/support/pkgcheck/CHANGES.md b/support/pkgcheck/CHANGES.md index ba15e0ae9e..dab0c748ab 100644 --- a/support/pkgcheck/CHANGES.md +++ b/support/pkgcheck/CHANGES.md @@ -122,6 +122,21 @@ check for latex-dev in the path names in the TDS zip archive - if a file in a generated file statement contains a directory part it was correctly recognized but not compared correctly to the contents of the TDS zip archive + 2020-02-07 (2.0.1) - - Use the `-a` (convert text files) flag when unzipping the TDS archive + - use the `-a` (convert text files) flag when temporarily unzipping the TDS archive - crates update + +2020-04-12 (2.1.0) + - add new test case e0033 + - don't issue error messages when a .bat file has 0755 permission + - improvements regarding detection of generated files (error message e0019) + - generated REAME files caused e0019 error message when they were specified with + a relative path name in the `\generate` statement in the .dtx resp. .ins file + - don't issue error message when a pdf file, generated by .dtx/.ins, exists + - don't issue error message when an existing .ins file is generated by a .dtx file + - improved text in error message e0019 + - call pdfinfo and unzip without specifying an absolute path so that it gets found + when it is outside of /usr/bin (reported by Arthur Reutenauer) + + diff --git a/support/pkgcheck/Cargo.toml b/support/pkgcheck/Cargo.toml index 0943bc76d7..39fe8901b5 100644 --- a/support/pkgcheck/Cargo.toml +++ b/support/pkgcheck/Cargo.toml @@ -1,11 +1,16 @@ [package] name = "pkgcheck" -version = "2.0.1" +version = "2.1.0" authors = ["Manfred Lotz <manfred@ctan.org>"] description = "Command-line tool to check packages uploaded to CTAN." license = "MIT/Apache-2.0" edition = "2018" +# with this option binaries are smaller +# https://doc.rust-lang.org/edition-guide/rust-2018/error-handling-and-panics/aborting-on-panic.html +[profile.release] +panic = "abort" + [dependencies] structopt = "0.3" walkdir = "2.3" @@ -23,7 +28,7 @@ reqwest = { version = "0.10", features = ["blocking", "gzip"] } lazy_static = "1" tempdir = "0.3" -assert_cmd = "0.12" +assert_cmd = "1" predicates = "1" openssl-probe = "0.1.2" pest = "2.1" diff --git a/support/pkgcheck/bin/pkgcheck b/support/pkgcheck/bin/pkgcheck Binary files differindex 5ab0dfe212..c00875db43 100755 --- a/support/pkgcheck/bin/pkgcheck +++ b/support/pkgcheck/bin/pkgcheck diff --git a/support/pkgcheck/docs/errorsd.tex b/support/pkgcheck/docs/errorsd.tex index e3e9cc9b5f..33e2ea6fd9 100644 --- a/support/pkgcheck/docs/errorsd.tex +++ b/support/pkgcheck/docs/errorsd.tex @@ -183,10 +183,11 @@ package which easily can be generated from other files in the submission. Exceptions are the \texttt{README} files of the package, i.e. -\texttt{README}, \texttt{README.md} or \texttt{README.txt}. +\texttt{README}, \texttt{README.md} or \texttt{README.txt}, or +\texttt{.pdf} files. -Starting with version 1.1.0 \texttt{pkgcheck} also detects generated -files if they are in a different directory in the package. +\texttt{pkgcheck} detects generated files anywhere in the package +directory tree. For more details refer to: \href{http://mirror.ctan.org/help/ctan/CTAN-upload-addendum.html\#nogeneratedfiles}{http://mirror.ctan.org/help/ctan/CTAN-upload-addendum.html\#nogeneratedfiles} diff --git a/support/pkgcheck/docs/pkgcheck.pdf b/support/pkgcheck/docs/pkgcheck.pdf Binary files differindex dd1f384a45..cbad89da3d 100644 --- a/support/pkgcheck/docs/pkgcheck.pdf +++ b/support/pkgcheck/docs/pkgcheck.pdf diff --git a/support/pkgcheck/docs/title.tex b/support/pkgcheck/docs/title.tex index 5840449306..de019a5346 100644 --- a/support/pkgcheck/docs/title.tex +++ b/support/pkgcheck/docs/title.tex @@ -1 +1 @@ -\title{pkgcheck Utility, v2.0.1} +\title{pkgcheck Utility, v2.1.0} diff --git a/support/pkgcheck/src/generate.pest.md b/support/pkgcheck/src/generate.pest.md index 643fe57750..8891a57f93 100644 --- a/support/pkgcheck/src/generate.pest.md +++ b/support/pkgcheck/src/generate.pest.md @@ -1,4 +1,4 @@ -# Some notes about gparser.pest +# Some notes about generate.pest ## COMMENT and WHITESPACE @@ -11,5 +11,5 @@ The Pest book at https://pest.rs/book/grammars/syntax.html says: > they will be implicitly inserted at every sequence and between every repetition (except in atomic rules). -Therefore COMMENT and WHITESPACE are defined in `gparser.pest`. +Therefore COMMENT and WHITESPACE are defined in `generate.pest`. diff --git a/support/pkgcheck/src/main.rs b/support/pkgcheck/src/main.rs index de0d3b3cb6..cbb678729f 100644 --- a/support/pkgcheck/src/main.rs +++ b/support/pkgcheck/src/main.rs @@ -177,10 +177,8 @@ fn check_readme_inner(fname: &str, f: &std::fs::File) -> bool { result } -fn is_readme(entry: &DirEntry) -> bool { - let r = entry.file_name().to_str().unwrap(); - - match r { +fn is_readme(entry: &str) -> bool { + match entry { "README" | "README.txt" | "README.md" => true, _ => false, } @@ -466,6 +464,7 @@ fn check_generated_files(entry: &str, generated: &mut GeneratedHashMap) { // unwrap() is ok here as we only call this function for files, // specifically .ins or .dtx files let entry_fname = filename(entry).unwrap().to_string(); + // the name of the .ins resp. .dtx without extension let entry_base = &entry_fname[0..entry_fname.len() - 4]; let fhdl = File::open(&entry); @@ -479,32 +478,35 @@ fn check_generated_files(entry: &str, generated: &mut GeneratedHashMap) { gparser::parse_generate(&String::from_utf8_lossy(&buf.clone())) { for fname in found { + // If the filename in the 'file{} statement contains `\jobname` + // we replace jobname with the .dtx resp. .ins filename (without extension) + // before we investigate further + let fname1 = fname.replace("\\jobname", entry_base); + + // If the filename in the generate statement contains a path component + // we ignore it so that a generated file will be reported even if it is + // in a different place in the package directory which sometimes + // happens in uploaded packages + let fname_opt = utils::filename(&fname1); + if fname_opt.is_none() { + continue; + } + let filename = fname_opt.unwrap(); + // As we request a README in the top level directory of // a package we ignore if a README was generated by an // .ins or .dtx file // CAVEAT: If this happens in a subdirectory it could be an error!!!! - if fname == "README" || fname == "README.txt" || fname == "README.md" { + if is_readme(&filename) { continue; } - // If the filename in the 'file{} statement is jobname.<ext> - // we replace jobname with the filename before we investigate further - let fname_x = if fname.starts_with("\\jobname") { - let ext = match get_extension_from_filename(&fname) { - Some(e) => e, - None => "", - }; - format!("{}.{}", entry_base, ext) - } else { - fname.to_string() - }; - - // If the filename in the generate statement contains a path component - // we ignore it so that a generated file will be reported even if it is - // in a different place in the package directory - if let Some(pb) = utils::filename(&fname_x) { - generated.entry(pb.to_string()).or_insert_with(|| entry.to_string()); + // Ignore generated pdf files + if fname.ends_with(".pdf") { + continue; } + + generated.entry(filename.to_string()).or_insert_with(|| entry.to_string()); } }; } @@ -542,7 +544,7 @@ fn check_tds_archive_name(tds_zip: &Option<String>) -> Option<String> { } fn unzip_tds_archive(tds_zip: &str, tmp_dir: &str) { - match run_cmd("/usr/bin/unzip", &["-a", "-q", "-d", tmp_dir, &tds_zip]) { + match run_cmd("unzip", &["-a", "-q", "-d", tmp_dir, &tds_zip]) { CmdReturn { status: true, .. } => (), CmdReturn { status: false, @@ -955,7 +957,7 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<DupHashes> { FileKind::Symlink(pd.clone()), )); } - if is_readme(&dir_entry) { + if is_readme(&file_name) { readme_found = true; file_names.insert( p, @@ -1018,7 +1020,7 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<DupHashes> { .push(PathBuf::from(&dir_entry_str)); } - if is_readme(&dir_entry) { + if is_readme(&file_name) { // We want to deal with README files only if they are // in the root directory of the package. let f = format!( @@ -1302,12 +1304,16 @@ fn print_casefolding(hashes: &HashMap<PathBuf, Vec<(PathBuf, FileKind)>>) { } } -fn print_generated(hashes: &HashMap<PathBuf, Vec<PathBuf>>, generated: &GeneratedHashMap) { +fn print_generated(doublenames: &HashMap<PathBuf, Vec<PathBuf>>, generated: &GeneratedHashMap) { + // `k` is generated by `gen` for (k, gen) in generated.iter() { - let mut path = PathBuf::new(); - path.push(k); - if hashes.contains_key(&path) { - let v = &hashes[&path]; + let path = PathBuf::from(k); + if doublenames.contains_key(&path) { + if k.ends_with(".ins") || k.ends_with(".pdf") { + //println!("key {}, gen {}", k, gen); + continue; + } + let v = &doublenames[&path]; for fname in v { e0019!(fname.to_str().unwrap(), gen.as_str()); } diff --git a/support/pkgcheck/src/messages/errorsd.rs b/support/pkgcheck/src/messages/errorsd.rs index 09c2f4cc53..b80e4d1245 100644 --- a/support/pkgcheck/src/messages/errorsd.rs +++ b/support/pkgcheck/src/messages/errorsd.rs @@ -256,10 +256,9 @@ package which easily can be generated from other files in the submission. Exceptions are the README files of the package, i.e. README, README.md -or README.txt. +or README.txt, or .pdf files. -Starting with version 1.1.0 pkgcheck also detects generated files if -they are in a different directory in the package. +pkgcheck detects generated files anywhere in the package directory tree. For more details refer to: http://mirror.ctan.org/help/ctan/CTAN-upload-addendum.html#nogeneratedfiles diff --git a/support/pkgcheck/src/utils.rs b/support/pkgcheck/src/utils.rs index 8a34bfe7c1..d047a97cb0 100644 --- a/support/pkgcheck/src/utils.rs +++ b/support/pkgcheck/src/utils.rs @@ -333,7 +333,7 @@ pub fn _is_symlink_broken(entry: &DirEntry) -> Result<bool, io::Error> { // returns non zero we assume that the PDF document is // corrupted. pub fn is_pdf_ok(fname: &str) -> CmdReturn { - run_cmd("/usr/bin/pdfinfo", &[fname]) + run_cmd("pdfinfo", &[fname]) } pub fn get_perms(path: &Path) -> u32 { |