summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-21 20:15:16 +0000
committerKarl Berry <karl@freefriends.org>2022-07-21 20:15:16 +0000
commitc121c219ac85e27ca69e396685d6ffde94f96fa7 (patch)
tree41147aec3d183e4f37d20529778ef2b730d41a4a /Build/source
parent530f71fe4b320a38b22fc3a03b0eb3960b785f48 (diff)
texlogsieve (21jul22)
git-svn-id: svn://tug.org/texlive/trunk@63954 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/fmtutil.pl15
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlogsieve/texlogsieve182
2 files changed, 156 insertions, 41 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl b/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
index dc02cdacac5..0db9ab94d81 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# $Id: fmtutil.pl 60154 2021-08-03 21:55:56Z karl $
+# $Id: fmtutil.pl 63934 2022-07-19 01:58:57Z preining $
# fmtutil - utility to maintain format files.
# (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.)
#
@@ -24,11 +24,11 @@ BEGIN {
TeX::Update->import();
}
-my $svnid = '$Id: fmtutil.pl 60154 2021-08-03 21:55:56Z karl $';
-my $lastchdate = '$Date: 2021-08-03 23:55:56 +0200 (Tue, 03 Aug 2021) $';
+my $svnid = '$Id: fmtutil.pl 63934 2022-07-19 01:58:57Z preining $';
+my $lastchdate = '$Date: 2022-07-19 03:58:57 +0200 (Tue, 19 Jul 2022) $';
$lastchdate =~ s/^\$Date:\s*//;
$lastchdate =~ s/ \(.*$//;
-my $svnrev = '$Revision: 60154 $';
+my $svnrev = '$Revision: 63934 $';
$svnrev =~ s/^\$Revision:\s*//;
$svnrev =~ s/\s*\$$//;
my $version = "r$svnrev ($lastchdate)";
@@ -808,6 +808,13 @@ sub rebuild_one_format {
if ($opts{"dry-run"}) {
print_info("would copy log file to: $destdir/$logfile\n");
} else {
+ # Add the actual invocation to the end of the log file
+ if (open(my $fd, ">>", $logfile)) {
+ print $fd "# actual command line used during this run\n# $cmdline\n";
+ close($fd);
+ } else {
+ print_deferred_error("cannot append cmdline to log file");
+ }
# Here and in the following we use copy instead of move
# to make sure that in SElinux enabled cases the rules of
# the destination directory are applied.
diff --git a/Build/source/texk/texlive/linked_scripts/texlogsieve/texlogsieve b/Build/source/texk/texlive/linked_scripts/texlogsieve/texlogsieve
index b93431aa78e..3520efd7448 100755
--- a/Build/source/texk/texlive/linked_scripts/texlogsieve/texlogsieve
+++ b/Build/source/texk/texlive/linked_scripts/texlogsieve/texlogsieve
@@ -784,6 +784,7 @@ function registerHandlers()
table.insert(beginningOfLineHandlers, citationHandler)
table.insert(beginningOfLineHandlers, referenceHandler)
table.insert(beginningOfLineHandlers, labelHandler)
+ table.insert(beginningOfLineHandlers, unusedLabelHandler)
table.insert(beginningOfLineHandlers, genericLatexHandler)
table.insert(beginningOfLineHandlers, latex23MessageHandler)
table.insert(beginningOfLineHandlers, genericLatexVariantIHandler)
@@ -821,6 +822,7 @@ function registerSummaries()
table.insert(summaries, underOverSummary)
table.insert(summaries, missingCharSummary)
table.insert(summaries, repetitionsSummary)
+ table.insert(summaries, unusedLabelsSummary)
table.insert(summaries, citationsSummary)
table.insert(summaries, referencesSummary)
table.insert(summaries, labelsSummary)
@@ -1002,7 +1004,7 @@ Options:
--version
if vars.version then
- print("texlogsieve 1.1.3")
+ print("texlogsieve 1.2.0")
print("Copyright (C) 2021, 2022 Nelson Lago <lago@ime.usp.br>")
print("License GPLv3+: GNU GPL version 3 or later "
.. "<https://gnu.org/licenses/gpl.html>.")
@@ -1443,6 +1445,7 @@ function adjustSeverity(msg)
"The morewrites package is unnecessary",
'Unused \\captionsetup%b[]',
"Unknown feature `' in font %b`'", -- empty feature, not a problem
+ "Package refcheck Warning: Unused label %b`'", -- we process these specially
}
DEFAULT_FORCED_WARNING = {}
@@ -2741,6 +2744,9 @@ beginningOfLineDebugStringsHandler.patterns = {
-- From libertinust1math.sty
'^amsthm loaded',
'^amsthm NOT loaded',
+
+ -- refcheck
+ '^options: showrefs, showcites, msgs, chckunlbld',
}
@@ -2881,6 +2887,8 @@ beginningOfLineInfoStringsHandler.patterns = {
.. '%S+, %S+ Mbit/s\n'
.. 'extracting files from ' .. filepat .. '%.%.%.\n'
.. '======================================================================',
+ "^Label %b`' newly defined as it shall be overriden\n"
+ .. "although it is yet undefined",
}
@@ -3304,6 +3312,7 @@ end
-- citationHandler
-- referenceHandler
-- labelHandler
+-- unusedLabelHandler
-- (from genericLatexHandler)
--
-- They differ from the prototype by the set of patterns to search for, by
@@ -3314,7 +3323,9 @@ citationHandler = genericLatexHandler:new()
citationHandler.patterns = {
"^(LaTeX)%s+(Warning): (Citation) ('.-') on page (.-) undefined",
+ "^(LaTeX)%s+(Warning): (Citation) (%b`') on page (.-) undefined",
"^(LaTeX)%s+(Warning): (Citation) ('.-') undefined",
+ "^(LaTeX)%s+(Warning): (Citation) (%b`') undefined",
}
function citationHandler:unpackData(data)
@@ -3361,6 +3372,34 @@ function labelHandler:newMessage()
return labelMessage:new()
end
+-- These messages are generated by the package refcheck
+unusedLabelHandler = genericLatexHandler:new()
+
+unusedLabelHandler.patterns = {
+ "^(Package)%s+(refcheck)%s+(Warning): Unused label (%b`')",
+}
+
+function unusedLabelHandler:unpackData(data)
+ local last = data[1]
+ local what = data[2]
+ local name = data[3]
+ local severity = data[4]
+ local key = string.sub(data[5], 2, -2) -- remove quotes
+
+ self.message.what = what
+ self.message.name = name
+ self.message.severity = self:parseSeverity(severity)
+ self.message.key = key
+ self:findPrefix(last, name, what)
+ self.message.prefix = self.prefix
+
+ self:unwrapLines()
+ self.message.content = Lines.current
+end
+
+function unusedLabelHandler:newMessage()
+ return unusedLabelMessage:new()
+end
-------------------------------------------------------------------------------
-- providesHandler
@@ -4803,6 +4842,12 @@ function labelMessage:toSummary()
labelsSummary:add(self)
end
+unusedLabelMessage = Message:new()
+
+function unusedLabelMessage:toSummary()
+ unusedLabelsSummary:add(self)
+end
+
--[[ ##################################################################### ]]--
--[[ ############################ SUMMARIES ############################## ]]--
@@ -4849,7 +4894,7 @@ function SummaryPrototype:alreadySeen(msg)
end
-- we use this for --no-ref-detail and --no-cite-detail
-function SummaryPrototype:showDetails()
+function SummaryPrototype:detailed()
return true
end
@@ -4863,7 +4908,7 @@ function SummaryPrototype:toString()
if self.header ~= "" then
if COLOR then self.header = green(self.header) end
- if self:showDetails() then
+ if self:detailed() then
self.header = self.header .. '\n'
else
self.header = self.header .. ' '
@@ -4884,16 +4929,18 @@ function SummaryPrototype:processAllMessages()
for _, messagesSublist in pairsSortedByKeys(self.messages) do
local tmp = self:processSingleMessageList(messagesSublist)
if tmp ~= "" then
- if self:showDetails() then
- allText = allText .. '\n\n' .. tmp
+ if self:detailed() then
+ allText = allText .. '\n' .. tmp
else
allText = allText .. ", " .. tmp
end
end
end
- -- remove leading '\n\n' or ', '
- return string.sub(allText, 3)
+ -- remove leading '\n' or ', '
+ local _, last = string.find(allText, '^[\n, ]+')
+ if last then allText = string.sub(allText, last +1) end
+ return allText
end
-- This is where we process each individual sublist, generating
@@ -4903,23 +4950,35 @@ function SummaryPrototype:processSingleMessageList(messages)
return ""
end
--- This receives a list of (equal) messages and returns
--- the list of pages and files where they were found.
+-- This receives a list of (equal) messages and returns the list of pages
+-- and files where they were found. For messages that the program "sees"
+-- as equal even if they include different line numbers (such as undefined
+-- references), this also shows the line numbers grouped by input file.
+-- If there is a line number but not a file name (this should not really
+-- happen), the line number is *not* shown; not great, but fixing this is
+-- more trouble than it's worth.
function SummaryPrototype:pageAndFileList(messages)
- -- Build a Set with the page numbers to eliminate repetitions...
+ -- Build Sets with the page numbers and file names
+ -- to eliminate repetitions...
local pages = {}
local files = {}
for _, msg in ipairs(messages) do
if msg.physicalPage ~= nil then
pages[msg.physicalPage] = true
end
+
if msg.filename ~= nil then
- files[msg.filename] = true
+ if files[msg.filename] == nil then
+ files[msg.filename] = {}
+ end
+ if msg.linenum ~= "" then
+ table.insert(files[msg.filename], msg.linenum)
+ end
end
end
- -- and convert it to a "normal" table so we can sort it
+ -- and convert them to "normal" tables so we can sort them
local tmp = {}
for page, _ in pairs(pages) do -- not ipairs!
table.insert(tmp, page)
@@ -4928,14 +4987,34 @@ function SummaryPrototype:pageAndFileList(messages)
table.sort(pages)
tmp = {}
- for file, _ in pairs(files) do
- table.insert(tmp, file)
+ for filename, listOfLines in pairs(files) do
+ local text = filename
+ if next(listOfLines) ~= nil then -- check if the table is empty
+ -- same thing here for the list of lines: generate a Set to
+ -- eliminate duplicates, turn it into an array and sort it
+ local setOfLines = {}
+ for _, line in ipairs(listOfLines) do
+ setOfLines[line] = true
+ end
+
+ listOfLines = {}
+ for line, _ in pairs(setOfLines) do
+ table.insert(listOfLines, line)
+ end
+ table.sort(listOfLines)
+
+ local lines = listToCommaSeparatedString(listOfLines,
+ "line", "lines")
+
+ text = text .. ": " .. lines
+ end
+ table.insert(tmp, text)
end
files = tmp
table.sort(files)
- pages = listToCommaSeparatedString(pages)
- files = listToCommaSeparatedString(files)
+ pages = listToCommaSeparatedString(pages, "page", "pages")
+ files = listToCommaSeparatedString(files, "file", "files", ';')
return pages, files
end
@@ -4958,11 +5037,11 @@ function repetitionsSummary:processSingleMessageList(messages)
local where
if pages ~= "" and files ~= "" then
- where = 'in pages ' .. pages .. ' (files ' .. files .. ') - '
+ where = 'in ' .. pages .. ' (' .. files .. ') - '
elseif pages == "" and files ~= "" then
- where = 'in files ' .. files .. ' - '
+ where = 'in ' .. files .. ' - '
elseif pages ~= "" and files == "" then
- where = 'in pages ' .. pages .. ' - '
+ where = 'in ' .. pages .. ' - '
end
local content = messages[1]:toString()
@@ -4988,8 +5067,11 @@ function missingCharSummary:processSingleMessageList(messages)
local char = messages[1].char
local font = messages[1].font
- text = 'char ' .. char .. ', font ' .. font .. '\n'
- .. 'in pages ' .. pages .. " (files " .. files .. ")"
+ text = 'char ' .. char .. ', font ' .. font
+
+ if COLOR then text = red(text) end
+
+ text = text .. ' in ' .. pages .. " (" .. files .. ")"
return text
end
@@ -4999,7 +5081,7 @@ citationsSummary = SummaryPrototype:new()
citationsSummary.bypassMostFilters = true
citationsSummary.header = 'Undefined citations:'
-function citationsSummary:showDetails()
+function citationsSummary:detailed()
return DETAILED_CITATION_SUMMARY
end
@@ -5034,9 +5116,9 @@ function citationsSummary:processSingleMessageList(messages)
local key = messages[1].key
if key == "" then key = '???' end
- if self:showDetails() then
- text = key .. '\n'
- .. 'in pages ' .. pages .. " (files " .. files .. ")"
+ if self:detailed() then
+ if COLOR then key = red(key) end
+ text = key .. ' in ' .. pages .. " (" .. files .. ")"
else
text = key
end
@@ -5048,7 +5130,7 @@ end
referencesSummary = citationsSummary:new()
referencesSummary.header = 'Undefined references:'
-function referencesSummary:showDetails()
+function referencesSummary:detailed()
return DETAILED_REFERENCE_SUMMARY
end
@@ -5057,11 +5139,31 @@ labelsSummary = citationsSummary:new()
labelsSummary.header = 'Multiply defined labels:'
-- LaTeX does not supply details for these
-function labelsSummary:showDetails()
+function labelsSummary:detailed()
return false
end
+unusedLabelsSummary = citationsSummary:new()
+unusedLabelsSummary.header = 'Unused labels:'
+
+function unusedLabelsSummary:processSingleMessageList(messages)
+ local text = ""
+ local pages, files = self:pageAndFileList(messages)
+ local key = messages[1].key
+ if key == "" then key = '???' end
+
+ if self:detailed() then
+ if COLOR then key = red(key) end
+ text = key .. ' in ' .. pages .. " (" .. files .. ")"
+ else
+ text = key
+ end
+
+ return text
+end
+
+
-- This is a little different from the others; we do not want to
-- treat different messages differently, only report that there were
-- under/overfull boxes in pages X, Y, and Z. So we store messages
@@ -5098,8 +5200,7 @@ function underOverSummary:toString()
else
output = "Under/overfull boxes"
if COLOR then output = green(output) end
- output = output .. " in pages "
- .. pages .. " (files " .. files .. ")"
+ output = output .. " in " .. pages .. " (" .. files .. ")"
end
@@ -5194,16 +5295,23 @@ function pairsSortedByKeys (t, f)
return iter
end
-function listToCommaSeparatedString(list)
- local tmp = ""
- for _, item in ipairs(list) do
- tmp = tmp .. ", " .. item
- end
+function listToCommaSeparatedString(list, singular, plural, sep)
+ sep = sep or ','
+ if #list == 0 then return end
- local _, last = string.find(tmp, '^, ')
- if last ~= nil then tmp = string.sub(tmp, last +1) end
+ local tmp
+ if #list == 1 then
+ tmp = singular .. " "
+ else
+ tmp = plural .. " "
+ end
- return tmp
+ for _, item in ipairs(list) do
+ tmp = tmp .. item .. sep .. " "
+ end
+
+ tmp = string.sub(tmp, 1, -3) -- remove the final ", "
+ return tmp
end
function green(s)