2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Support relative path on < include

For pkglist and syncfile, detect
relative path and interpret relative
to the file that does the include.
This commit is contained in:
Jarrod Johnson 2021-11-15 11:34:34 -05:00
parent 7b23ee9c7c
commit d59ac74f3a
2 changed files with 11 additions and 1 deletions

View File

@ -47,7 +47,12 @@ def get_entries(filename):
if ent in ('APPENDONCE:', 'MERGE:', 'REPLACE:'):
secname = ent
if ent[0] == '<':
for subent in get_entries(ent[1:]):
subfilename = ent[1:]
if subfilename[-1] == '>':
subfilename = subfilename[:-1]
if subfilename[0] != '/':
subfilename = os.path.join(os.path.dirname(filename), subfilename)
for subent in get_entries(subfilename):
yield subent
yield secname
else:

View File

@ -424,6 +424,11 @@ class OsHandler(object):
if not pkg:
continue
if pkg[0] == '<': # Include from specified file
subfilename = pkg[1:]
if subfilename[-1] == '>':
subfilename = subfilename[:-1]
if subfilename[0] != '/':
subfilename = os.path.join(os.path.dirname(pkglistfile), subfilename)
retpkgs.extend(self.list_packages(pkg[1:]))
else:
retpkgs.append(pkg)