mirror of
https://github.com/lingble/meta-tegra.git
synced 2025-10-29 19:42:41 +00:00
* Ran convert-overrides.py to generate the initial changes * Manual cleanup afterwards (which was a lot, due to our extensive use of overrides). Signed-off-by: Matt Madison <matt@madison.systems>
71 lines
2.6 KiB
Plaintext
71 lines
2.6 KiB
Plaintext
CONTAINER_CSV_FILES ??= "${libdir}/*.so*"
|
|
CONTAINER_CSV_EXCLUDE_FILES ??= ""
|
|
CONTAINER_CSV_BASENAME ??= "${PN}"
|
|
CONTAINER_CSV_PKGNAME ?= "${CONTAINER_CSV_BASENAME}-container-csv"
|
|
CONTAINER_CSV_EXTRA ??= ""
|
|
|
|
python populate_container_csv() {
|
|
import os
|
|
import glob
|
|
globs = (d.getVar('CONTAINER_CSV_FILES') or '').split()
|
|
if len(globs) == 0:
|
|
return
|
|
root = d.getVar('D')
|
|
entries = set()
|
|
oldcwd = os.getcwd()
|
|
os.chdir(root)
|
|
for csvglob in globs:
|
|
if os.path.isabs(csvglob):
|
|
csvglob = '.' + csvglob
|
|
if not csvglob.startswith('./'):
|
|
csvglob = './' + csvglob
|
|
globbed = glob.glob(csvglob)
|
|
if globbed and globbed != [ csvglob ]:
|
|
entries.update([entry[2:] for entry in globbed])
|
|
else:
|
|
entries.update([csvglob[2:]])
|
|
excludeglobs = (d.getVar('CONTAINER_CSV_EXCLUDE_FILES') or '').split()
|
|
for csvglob in excludeglobs:
|
|
if os.path.isabs(csvglob):
|
|
csvglob = '.' + csvglob
|
|
if not csvglob.startswith('./'):
|
|
csvglob = './' + csvglob
|
|
globbed = glob.glob(csvglob)
|
|
if globbed and globbed != [ csvglob ]:
|
|
for entry in globbed:
|
|
entries.discard(entry[2:])
|
|
else:
|
|
for entry in globbed:
|
|
entries.discard(csvglob[2:])
|
|
csvlines = (d.getVar('CONTAINER_CSV_EXTRA') or '').split('\n')
|
|
for entry in entries:
|
|
if os.path.isdir(entry):
|
|
csvtype = "dir"
|
|
elif os.path.islink(entry):
|
|
csvtype = "sym"
|
|
elif os.path.isfile(entry):
|
|
csvtype = "lib"
|
|
else:
|
|
bb.warn("Unrecognized file type for container CSV: {}".format(entry))
|
|
continue
|
|
csvlines.append("{}, /{}".format(csvtype, entry))
|
|
|
|
os.chdir(oldcwd)
|
|
csvfiledir = os.path.join(root, d.getVar('sysconfdir')[1:], 'nvidia-container-runtime',
|
|
'host-files-for-container.d')
|
|
bb.utils.remove(csvfiledir, recurse=True)
|
|
bb.utils.mkdirhier(csvfiledir)
|
|
csvfile = os.path.join(csvfiledir, d.getVar('PN') + '.csv')
|
|
with open(csvfile, 'w', encoding='utf-8') as outf:
|
|
outf.write('\n'.join(sorted(csvlines)) + '\n')
|
|
os.chmod(csvfile, 0o644)
|
|
}
|
|
|
|
CONTAINERCSVFUNC = ""
|
|
CONTAINERCSVFUNC:tegra = "populate_container_csv"
|
|
do_install[postfuncs] += "${CONTAINERCSVFUNC}"
|
|
|
|
PACKAGES::prepend:tegra = " ${CONTAINER_CSV_PKGNAME} "
|
|
FILES:${CONTAINER_CSV_PKGNAME} = "${sysconfdir}/nvidia-container-runtime"
|
|
RDEPENDS:${PN}:append:tegra = " ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${CONTAINER_CSV_PKGNAME}', '', d)}"
|