summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/latexpand/LICENCE5
-rw-r--r--support/latexpand/README6
-rwxr-xr-xsupport/latexpand/latexpand121
-rw-r--r--support/latexpand/version.txt4
-rw-r--r--support/pkgcheck/CHANGES.md6
-rw-r--r--support/pkgcheck/Cargo.toml2
-rwxr-xr-xsupport/pkgcheck/bin/pkgcheckbin7927624 -> 7898920 bytes
-rw-r--r--support/pkgcheck/docs/errorsd.tex7
-rw-r--r--support/pkgcheck/docs/pkgcheck.pdfbin65641 -> 66749 bytes
-rw-r--r--support/pkgcheck/docs/title.tex2
-rw-r--r--support/pkgcheck/src/main.rs20
-rw-r--r--support/pkgcheck/src/messages/errorsd.rs10
-rw-r--r--support/pkgcheck/src/messages/mod.rs15
13 files changed, 168 insertions, 30 deletions
diff --git a/support/latexpand/LICENCE b/support/latexpand/LICENCE
index 899fc428bf..206b195a7b 100644
--- a/support/latexpand/LICENCE
+++ b/support/latexpand/LICENCE
@@ -1,5 +1,6 @@
-Copyright (c) 2012, 2013, 2014, 2015, 2016,
- Matthieu Moy <git@matthieu-moy.fr>
+Copyright (c) 2012-2019, Matthieu Moy <git@matthieu-moy.fr> and
+contributors.
+
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/support/latexpand/README b/support/latexpand/README
index d8b0cbe8ef..6f32dfd4e6 100644
--- a/support/latexpand/README
+++ b/support/latexpand/README
@@ -20,6 +20,10 @@ SYNOPSIS
--expand-bbl FILE
Expand the bibliography by inlining FILE
(should be a *.bbl file)
+ --biber FILE Include \bibliography{} with FILE's content,
+ as needed by biblatex with the biber backend.
+ (similar to --expand-bbl FILE, but for
+ biber+biblatex).
--help this help message
--output <file>, -o <file>
generate output in <file>
@@ -117,5 +121,5 @@ SEE ALSO
https://lacl.fr/~caubert/notes/portabilite-du-tex.html#dependances
VERSION
- This is latexpand version v1.5.
+ This is latexpand version v1.6.
diff --git a/support/latexpand/latexpand b/support/latexpand/latexpand
index 1977c46356..e7de1965f1 100755
--- a/support/latexpand/latexpand
+++ b/support/latexpand/latexpand
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Inspired by latexpand by D. Musliner, University of Michigan
-# 2012, 2013, 2014, 2015, 2016, 2017: Matthieu Moy <git@matthieu-moy.fr>
+# 2012-2019: Matthieu Moy <git@matthieu-moy.fr>
# BSD License
use strict;
@@ -10,7 +10,9 @@ use IO::Handle;
use File::Spec;
my $TEXINPUTS = $ENV{'TEXINPUTS'};
-if (!$TEXINPUTS) { $TEXINPUTS = getcwd(); }
+# By default, search in current directory. We use '.' and not getcwd()
+# to avoid issues if the working directory contains a ':' character.
+if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
my $verbose;
my $keep_comments;
@@ -24,6 +26,7 @@ my $show_graphics;
my $graphics_extensions = ":.pdf:.png:.jpg:.eps";
my $expand_usepackage;
my $expand_bbl;
+my $biber;
my $fatal;
my $version;
my $makeatletter;
@@ -44,6 +47,7 @@ GetOptions (
'graphics-extensions' => \$graphics_extensions,
'expand-usepackage' => \$expand_usepackage,
'expand-bbl=s' => \$expand_bbl,
+ 'biber=s' => \$biber,
'fatal' => \$fatal,
'version' => \$version,
'makeatletter' => \$makeatletter,
@@ -80,7 +84,7 @@ sub get_version
{
# $VERSION's value will be substituted by 'make dist', but the
# next line won't (the string has to be broken to avoid it).
- my $VERSION = 'v1.5';
+ my $VERSION = 'v1.6';
if ($VERSION eq '@LATEXPAND' . '_VERSION@') {
my($vol,$dir,$file) = File::Spec->splitpath($0);
chdir($dir);
@@ -130,6 +134,16 @@ foreach my $file (@ARGV)
process_file($file, " ");
}
+sub cat_file
+{
+ my $file = shift;
+ open (my $INFILE, "<", $file) || die "could not open input file '$file'\n";
+ while (<$INFILE>) {
+ print;
+ }
+ close ($INFILE);
+}
+
sub process_file
{
my $file = shift;
@@ -195,8 +209,10 @@ sub process_line
if ($in_preamble && /^[^%]*\\makeatother/) {
$makeatletter_found = 0;
}
+ my $command;
if (!$makeatletter && !$makeatletter_found
- && (my ($command) = /^[^%]*(\\[[:alpha:]]*@[[:alpha:]]*)/)) {
+ && (($command) = /^[^%]*(\\[[:alpha:]]*@[[:alpha:]]*)/)
+ && ($command ne '\@')) {
print STDERR "Warning: command $command containing @ found in\n";
print STDERR "Warning: $file.\n";
print STDERR "Warning: consider using --makeatletter if the result is not compilable.\n";
@@ -235,8 +251,16 @@ sub process_line
}
unless ($keep_includes) {
- if (my ($before, $ignored, $full_filename, $after)
- = /^($NON_COMMENT)\\include[{\s]+(.*?)[\s}](.*)$/) {
+ # \input{foo.tex}
+ my $ARGBRACES = '\{\\s*([^"}\\s][^}]*)(\\s*)\}';
+ # \input{"foo bar.tex"}
+ my $ARGQUOTED = '\{\\s*"([^"]*)"(\\s*)\}';
+ # \input foo.tex
+ my $ARGSPACES = '\\s([^\{\\s][^\\s]+?)\\s()';
+ my $ARGUMENT = "\\s*?(?|$ARGBRACES|$ARGQUOTED|$ARGSPACES)";
+
+ if (my ($before, $ignored, $full_filename, $trailing, $after)
+ = /^($NON_COMMENT)\\include$ARGUMENT(.*)$/) {
$full_filename = find_tex_file($full_filename . ".tex");
if ($full_filename) {
say $prefix . "Found include for file: $full_filename\n";
@@ -253,15 +277,19 @@ sub process_line
print $nl . $after . "\n";
$_ = "";
}
- } elsif (my ($before, $ignored, $full_filename, $after)
- = /^($NON_COMMENT)\\input[{\s]+(.*?)[\s}](.*)$/) {
+ } elsif (my ($before, $ignored, $full_filename, $trailing, $after)
+ = /^($NON_COMMENT)\\input$ARGUMENT(.*)$/) {
if ($inside_import) {
$full_filename = $inside_import . $full_filename;
}
$full_filename = find_tex_file($full_filename, ":.tex");
if ($full_filename) {
say $prefix . "Found input for file: $full_filename\n";
- print $before . $nl;
+ # Surprisingly, space after filename
+ # in \input{foo.tex } is inserted
+ # _before_ the inclusion. Apply this
+ # rule in latexpand.
+ print $before . $trailing . $nl;
print "% start input $full_filename\n" if ($explain);
my $in_comment = process_file($full_filename, $prefix . " ");
if ($explain) {
@@ -277,8 +305,8 @@ sub process_line
}
$_ = "";
}
- } elsif (my ($before, $ignored, $dir, $full_filename, $after)
- = /^($NON_COMMENT)\\(?:sub)?import[{\s]+(.*?)[\s}][{\s]+(.*?)[\s}](.*)$/) {
+ } elsif (my ($before, $ignored, $dir, $ignored, $full_filename, $ignored, $after)
+ = /^($NON_COMMENT)\\(?:sub)?import$ARGUMENT$ARGUMENT(.*)$/) {
if ($explain) {
print "% dir " . $dir ."\n";
print "% full_filename " . $full_filename ."\n";
@@ -312,8 +340,8 @@ sub process_line
}
$_ = "";
}
- } elsif (my ($before, $ignored, $args, $full_filename, $after)
- = /^($NON_COMMENT)\\includegraphics[\[\s]+(.*?)[\s\]][{\s]+(.*?)[\s}](.*)$/) {
+ } elsif (my ($before, $ignored, $args, $full_filename, $ignored, $after)
+ = /^($NON_COMMENT)\\includegraphics[\[\s]+(.*?)[\s\]]$ARGUMENT(.*)$/) {
if ($explain) {
print "% inside_import " . $inside_import ."\n";
print "% before " . $before ."\n";
@@ -327,8 +355,8 @@ sub process_line
print "$before\\includegraphics[$args]{$full_filename}$after\n";
$_ = "";
}
- } elsif (my ($before, $ignored, $args, $full_filename, $after)
- = /^($NON_COMMENT)\\lstinputlisting[\[\s]+(.*?)[\s\]][{\s]+(.*?)[\s}](.*)$/) {
+ } elsif (my ($before, $ignored, $args, $full_filename, $ignored, $after)
+ = /^($NON_COMMENT)\\lstinputlisting[\[\s]+(.*?)[\s\]]$ARGUMENT(.*)$/) {
if ($explain) {
print "% inside_import " . $inside_import ."\n";
print "% before " . $before ."\n";
@@ -373,6 +401,36 @@ sub process_line
$_ = "";
}
}
+ if ($biber) {
+ if (my ($before, $after)
+ = /^(.*)\\(?:addbibresource)\{[^\}]*\}(.*)$/) {
+ # See https://tex.stackexchange.com/questions/166518/biblatex-include-bbl-problem-with-verb-field/166526#166526
+ my $biber_noext = $biber;
+ $biber_noext =~ s/.bbl//;
+ print $before . $nl;
+ say $prefix . "Expanding Biber BBL file: $biber\n";
+ print '\begin{filecontents*}{' . $biber . '}' . "\n";
+ cat_file($biber);
+ print "\n";
+ print '\end{filecontents*}
+
+\usepackage{xpatch}
+
+%Patch the biblatex input command.
+%replace "testinput-bbl" if you change the name above.
+%disable if you want to run biblatex/biber normally
+\makeatletter
+\patchcmd\blx@bblinput{\blx@blxinit}
+ {\blx@blxinit
+ \def\jobname{' . $biber_noext . '}%new jobname
+ }{}{\fail}
+\makeatother
+ ';
+ say $prefix . "End expansion of Biber BBL file: $biber\n";
+ print " " . $nl . $after . "\n";
+ $_ = "";
+ }
+ }
if ($show_graphics) {
if (/\\includegraphics(\[[^\]]*\])?{([^}]*)}/) {
my $full_filename = $2;
@@ -393,10 +451,24 @@ sub process_line
print;
}
+sub unquote
+{
+ my $str = shift;
+ my $x = substr($str, 0, 1);
+ my $y = substr($str, -1, 1);
+ if ($x eq $y && ($x eq '"' || $x eq "'")) {
+ $str = substr($str, 1, -1);
+ }
+ # There's a weird LaTeX syntax: \include{"file\space
+ # with\space spaces"}, so remove these \space when unquoting.
+ $str =~ s/\\space / /g;
+ return $str;
+}
+
# search $1 in $TEXINPUTS, with possible extensions in $2
sub find_tex_file
{
- my $file = shift;
+ my $file = unquote(shift);
my $extensions = (shift || ":");
foreach my $ext (split(':', $extensions, -1)) {
my $full = find_file_global($file . $ext);
@@ -417,15 +489,17 @@ sub find_file_global
my $file = shift;
if (open(my $fh, "-|", "kpsewhich", $file)) {
my $full = <$fh>;
- chomp($full);
+ $full =~ s/\s+$//;
close($fh);
if ($full) {
return $full;
}
}
+ # Should be useless, but fall-back in case kpsewhich fails (or is not installed, or ...):
return find_file($file, $TEXINPUTS);
}
+# Find files, not searching for global files (to allow not expanding global .sty packages)
sub find_file
{
my ($file, $path) = @_;
@@ -436,6 +510,13 @@ sub find_file
return;
}
}
+
+ # TEXINPUTS=...: (trailing :) means "append default search
+ # directories". We don't want global directories here, but
+ # still add . that may be needed.
+ if (substr($path, -1) eq ':') {
+ $path .= '.';
+ }
foreach my $dir (split(':', $path)) {
if (-e "$dir/$file" && ! -d "$dir/$file") {
return("$dir/$file");
@@ -471,6 +552,10 @@ latexpand [options] FILE...
--expand-bbl FILE
Expand the bibliography by inlining FILE
(should be a *.bbl file)
+ --biber FILE Include \bibliography{} with FILE's content,
+ as needed by biblatex with the biber backend.
+ (similar to --expand-bbl FILE, but for
+ biber+biblatex).
--help this help message
--output <file>, -o <file>
generate output in <file>
@@ -577,4 +662,4 @@ https://lacl.fr/~caubert/notes/portabilite-du-tex.html#dependances
=head1 VERSION
-This is latexpand version v1.5.
+This is latexpand version v1.6.
diff --git a/support/latexpand/version.txt b/support/latexpand/version.txt
index c7660606cf..ae263a2919 100644
--- a/support/latexpand/version.txt
+++ b/support/latexpand/version.txt
@@ -1,2 +1,2 @@
-latexpand version v1.5 (be890116022866564388af207e11f4b5b962d57d).
-Committed on Sat Feb 16 08:42:38 2019 +0100.
+latexpand version v1.6 (ce086093a2413c99af11cc08aceab8e5483d65ff).
+Committed on Thu Dec 12 09:37:27 2019 +0000.
diff --git a/support/pkgcheck/CHANGES.md b/support/pkgcheck/CHANGES.md
index 084a17581a..ac5dc5a1e6 100644
--- a/support/pkgcheck/CHANGES.md
+++ b/support/pkgcheck/CHANGES.md
@@ -67,4 +67,8 @@
Both features are regarded as experimental because both contain a hard coded check. If required
things will be changed in the future.
-
+2019-11-04 (1.9.0)
+ - (Experimental) for latex-base, latex-tools, latex-graphics and latex-amsmath use the real
+ package name 'latex' when checking path names in the TDS zip archive
+ - New error message e0035 if a TDS zip archive is found in the unpacked directory tree
+ - add testcases for w0005, w0006 and e0035
diff --git a/support/pkgcheck/Cargo.toml b/support/pkgcheck/Cargo.toml
index b682eec3e8..7908036125 100644
--- a/support/pkgcheck/Cargo.toml
+++ b/support/pkgcheck/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pkgcheck"
-version = "1.8.3"
+version = "1.9.0"
authors = ["Manfred Lotz <manfred@ctan.org>"]
description = "Command-line tool to check packages uploaded to CTAN."
license = "MIT/Apache-2.0"
diff --git a/support/pkgcheck/bin/pkgcheck b/support/pkgcheck/bin/pkgcheck
index 09397b1a1a..1ac3e63302 100755
--- a/support/pkgcheck/bin/pkgcheck
+++ b/support/pkgcheck/bin/pkgcheck
Binary files differ
diff --git a/support/pkgcheck/docs/errorsd.tex b/support/pkgcheck/docs/errorsd.tex
index 1557460ea1..25a68c1d79 100644
--- a/support/pkgcheck/docs/errorsd.tex
+++ b/support/pkgcheck/docs/errorsd.tex
@@ -330,3 +330,10 @@ archive}\label{e0034----unwanted-file-detected-in-the-top-level-directory-in-tds
A top level directory of a TDS archive should only contain certain
directories but no files.
+
+\hypertarget{e0035----unwanted-tds-archive-detected-in-package-directory-tree}{%
+\subsection{E0035 -\/- Unwanted TDS archive detected in package
+directory
+tree}\label{e0035----unwanted-tds-archive-detected-in-package-directory-tree}}
+
+A package directory should not contain a TDS zip archive.
diff --git a/support/pkgcheck/docs/pkgcheck.pdf b/support/pkgcheck/docs/pkgcheck.pdf
index d8c8a02bc9..87d258b13d 100644
--- a/support/pkgcheck/docs/pkgcheck.pdf
+++ b/support/pkgcheck/docs/pkgcheck.pdf
Binary files differ
diff --git a/support/pkgcheck/docs/title.tex b/support/pkgcheck/docs/title.tex
index 0955e7d594..9961a041b9 100644
--- a/support/pkgcheck/docs/title.tex
+++ b/support/pkgcheck/docs/title.tex
@@ -1 +1 @@
-\title{pkgcheck Utility, v1.8.3}
+\title{pkgcheck Utility, v1.9.0}
diff --git a/support/pkgcheck/src/main.rs b/support/pkgcheck/src/main.rs
index c69423252d..6fb4136f91 100644
--- a/support/pkgcheck/src/main.rs
+++ b/support/pkgcheck/src/main.rs
@@ -587,13 +587,21 @@ fn check_tds_archive(
// which yields a false test when checking for the package name
// the path names of the TDS zip archive files.
// Therefore, we correct here.
- let real_pkg_name = if pkg_name == "babel-base" {
- "babel"
+ // latex-tools, latex-graphics, latex-amsmath, latex-base => latex
+ //let mut pkg_replacements: HashMap<String,String> = HashMap::default();
+ //pkg_replacements.insert("babel-base".to_string(), "babel".to_string());
+ let mut pkg_replacements: HashMap<&str,&str> = HashMap::default();
+ pkg_replacements.insert("babel-base", "babel");
+ pkg_replacements.insert("latex-base", "latex");
+ pkg_replacements.insert("latex-tools", "latex");
+ pkg_replacements.insert("latex-graphics", "latex");
+ pkg_replacements.insert("latex-amsmath", "latex");
+ let real_pkg_name = if let Some(real_name) = pkg_replacements.get(pkg_name) {
+ real_name
} else {
pkg_name
};
-
let tmp_dir = TempDir::new("pkgcheck")?;
let tmp_dir_offset = tmp_dir.path().to_str().unwrap().len() + 1;
unzip_tds_archive(tds_zip, tmp_dir.path().to_str().unwrap());
@@ -1180,7 +1188,11 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<Hashes> {
}
filemagic::Mimetype::Archive | filemagic::Mimetype::Zip => {
- w0001!(dir_entry_str);
+ if dir_entry_str.ends_with(".tds.zip") {
+ e0035!(dir_entry_str);
+ } else {
+ w0001!(dir_entry_str);
+ }
check_and_correct_perms(dir_entry_str, p);
}
diff --git a/support/pkgcheck/src/messages/errorsd.rs b/support/pkgcheck/src/messages/errorsd.rs
index bd726754c0..f839f5538b 100644
--- a/support/pkgcheck/src/messages/errorsd.rs
+++ b/support/pkgcheck/src/messages/errorsd.rs
@@ -443,3 +443,13 @@ directories but no files.
)
}
+pub fn e0035d() {
+ println!(
+ r#"
+E0035 -- Unwanted TDS archive detected in package directory tree
+
+A package directory should not contain a TDS zip archive.
+"#
+ )
+}
+
diff --git a/support/pkgcheck/src/messages/mod.rs b/support/pkgcheck/src/messages/mod.rs
index 0a77e14c1e..2edda3c536 100644
--- a/support/pkgcheck/src/messages/mod.rs
+++ b/support/pkgcheck/src/messages/mod.rs
@@ -437,6 +437,19 @@ macro_rules! e0034 {
};
}
+macro_rules! e0035 {
+ ($fmt:expr) => {
+ error_occured!();
+ print!(
+ "{} Unwanted TDS archive `{}` detected in package directory tree\n",
+ msgid!("E0035"),
+ $fmt
+ );
+ };
+}
+
+
+
macro_rules! w0001 {
($fmt:expr) => {
print!(
@@ -604,6 +617,7 @@ pub fn explains(err: &str) {
"E0031" => e0031d(),
"E0033" => e0033d(),
"E0034" => e0034d(),
+ "E0035" => e0035d(),
// "I0001" => i0001d!(),
"I0001" => i0001d(),
@@ -668,6 +682,7 @@ pub fn explains_all() {
explains("E0031");
explains("E0033");
explains("E0034");
+ explains("E0035");
explains("I0001");
explains("I0002");