aboutsummaryrefslogtreecommitdiff
path: root/share/mk/meta2deps.py
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2024-03-14 05:51:08 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2024-03-14 05:51:08 +0000
commitf974ced38a4a264bb78b4f067b44bf587f7887db (patch)
tree111a3d83d11ce64cb1bbc7ac11e3535e125447bd /share/mk/meta2deps.py
parent3ff501040ba79894a3b4ed712d7ae4252590fc84 (diff)
downloadsrc-f974ced38a4a264bb78b4f067b44bf587f7887db.tar.gz
src-f974ced38a4a264bb78b4f067b44bf587f7887db.zip
Diffstat (limited to 'share/mk/meta2deps.py')
-rwxr-xr-xshare/mk/meta2deps.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/share/mk/meta2deps.py b/share/mk/meta2deps.py
index 334a008a2ab5..f188d0f01de8 100755
--- a/share/mk/meta2deps.py
+++ b/share/mk/meta2deps.py
@@ -36,8 +36,10 @@ We only pay attention to a subset of the information in the
"""
"""
+SPDX-License-Identifier: BSD-2-Clause
+
RCSid:
- $Id: meta2deps.py,v 1.45 2023/01/18 01:35:24 sjg Exp $
+ $Id: meta2deps.py,v 1.47 2024/02/17 17:26:57 sjg Exp $
Copyright (c) 2011-2020, Simon J. Gerraty
Copyright (c) 2011-2017, Juniper Networks, Inc.
@@ -74,8 +76,10 @@ import stat
def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
"""
Return an absolute path, resolving via cwd or last_dir if needed.
+
+ Cleanup any leading ``./`` and trailing ``/.``
"""
- if path.endswith('/.'):
+ while path.endswith('/.'):
path = path[0:-2]
if len(path) > 0 and path[0] == '/':
if os.path.exists(path):
@@ -86,7 +90,9 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
if path == '.':
return cwd
if path.startswith('./'):
- return cwd + path[1:]
+ while path.startswith('./'):
+ path = path[1:]
+ return cwd + path
if last_dir == cwd:
last_dir = None
for d in [last_dir, cwd]:
@@ -144,6 +150,7 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
return None
if (path.find('/') < 0 or
path.find('./') > 0 or
+ path.find('/../') > 0 or
path.endswith('/..')):
path = cleanpath(path)
return path
@@ -197,7 +204,7 @@ class MetaFile:
def __init__(self, name, conf={}):
"""if name is set we will parse it now.
- conf can have the following keys:
+ conf can have the follwing keys:
SRCTOPS list of tops of the src tree(s).