mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-24 09:13:37 +01:00
pkgbase: examine METALOG files relative to stage root directory
Previously we stripped the '.' from the beginning of each METALOG entry to determine the path to stat. This meant that we examined files on the build host, not the staged files. Instead, strip off the last part of the specified METALOG pathname to find the stage root directory, and stat files relative to that. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37412
This commit is contained in:
parent
9e6bbe47a5
commit
bca4d27052
@ -257,6 +257,7 @@ end
|
|||||||
--- @param verbose boolean
|
--- @param verbose boolean
|
||||||
--- @param w_notagdirs boolean turn on to also check directories
|
--- @param w_notagdirs boolean turn on to also check directories
|
||||||
function Analysis_session(metalog, verbose, w_notagdirs)
|
function Analysis_session(metalog, verbose, w_notagdirs)
|
||||||
|
local stage_root = {}
|
||||||
local files = {} -- map<string, MetalogRow[]>
|
local files = {} -- map<string, MetalogRow[]>
|
||||||
-- set is map<elem, bool>. if bool is true then elem exists
|
-- set is map<elem, bool>. if bool is true then elem exists
|
||||||
local pkgs = {} -- map<string, set<string>>
|
local pkgs = {} -- map<string, set<string>>
|
||||||
@ -418,17 +419,14 @@ function Analysis_session(metalog, verbose, w_notagdirs)
|
|||||||
if files[filename][1].attrs.type ~= 'file' then
|
if files[filename][1].attrs.type ~= 'file' then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
-- make ./xxx become /xxx so that we can stat
|
local fs = attributes(stage_root .. filename)
|
||||||
filename = filename:sub(2)
|
|
||||||
local fs = attributes(filename)
|
|
||||||
if fs == nil then
|
if fs == nil then
|
||||||
unstatables[#unstatables+1] = filename
|
unstatables[#unstatables+1] = filename
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
local inode = fs.ino
|
local inode = fs.ino
|
||||||
inm[inode] = inm[inode] or {}
|
inm[inode] = inm[inode] or {}
|
||||||
-- add back the dot prefix
|
table.insert(inm[inode], filename)
|
||||||
table.insert(inm[inode], '.'..filename)
|
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -462,6 +460,9 @@ function Analysis_session(metalog, verbose, w_notagdirs)
|
|||||||
return table.concat(warn, ''), table.concat(errs, '')
|
return table.concat(warn, ''), table.concat(errs, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- The METALOG file is assumed to be at the top of the stage directory.
|
||||||
|
stage_root = string.gsub(metalog, '/[^/]*$', '/')
|
||||||
|
|
||||||
do
|
do
|
||||||
local fp, errmsg, errcode = io.open(metalog, 'r')
|
local fp, errmsg, errcode = io.open(metalog, 'r')
|
||||||
if fp == nil then
|
if fp == nil then
|
||||||
|
Loading…
Reference in New Issue
Block a user