git: ee0c57076688 - stable/13 - pkgbase: examine METALOG files relative to stage root directory
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Nov 2022 03:07:20 UTC
The branch stable/13 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=ee0c57076688642e2e9d5173850dd245803e0754
commit ee0c57076688642e2e9d5173850dd245803e0754
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-11-16 19:53:42 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-11-19 19:12:47 +0000
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
(cherry picked from commit bca4d27052bf5735725449cd0be51bd58cf0cb80)
---
tools/pkgbase/metalog_reader.lua | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/pkgbase/metalog_reader.lua b/tools/pkgbase/metalog_reader.lua
index c3b5b6039873..02f8c4ab65bd 100644
--- a/tools/pkgbase/metalog_reader.lua
+++ b/tools/pkgbase/metalog_reader.lua
@@ -257,6 +257,7 @@ end
--- @param verbose boolean
--- @param w_notagdirs boolean turn on to also check directories
function Analysis_session(metalog, verbose, w_notagdirs)
+ local stage_root = {}
local files = {} -- map<string, MetalogRow[]>
-- set is map<elem, bool>. if bool is true then elem exists
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
goto continue
end
- -- make ./xxx become /xxx so that we can stat
- filename = filename:sub(2)
- local fs = attributes(filename)
+ local fs = attributes(stage_root .. filename)
if fs == nil then
unstatables[#unstatables+1] = filename
goto continue
end
local inode = fs.ino
inm[inode] = inm[inode] or {}
- -- add back the dot prefix
- table.insert(inm[inode], '.'..filename)
+ table.insert(inm[inode], filename)
::continue::
end
@@ -462,6 +460,9 @@ function Analysis_session(metalog, verbose, w_notagdirs)
return table.concat(warn, ''), table.concat(errs, '')
end
+ -- The METALOG file is assumed to be at the top of the stage directory.
+ stage_root = string.gsub(metalog, '/[^/]*$', '/')
+
do
local fp, errmsg, errcode = io.open(metalog, 'r')
if fp == nil then