|
|
|
@ -8,7 +8,8 @@ from typing import Optional, List
|
|
|
|
|
from calculate.templates.template_processor import DirectoryProcessor,\
|
|
|
|
|
TemplateWrapper
|
|
|
|
|
from calculate.utils.package import PackageAtomName, Version, Package,\
|
|
|
|
|
NonePackage, PackageCreator
|
|
|
|
|
NonePackage, PackageCreator,\
|
|
|
|
|
PackageAtomParser
|
|
|
|
|
from calculate.utils.files import join_paths
|
|
|
|
|
from calculate.utils.io_module import IOModule
|
|
|
|
|
from calculate.templates.template_engine import Variables
|
|
|
|
@ -91,7 +92,8 @@ datavars = Variables({'install': install,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show_tree(dir_path: str, indent: int = 0,
|
|
|
|
|
test_names: Optional[List[str]] = None) -> None:
|
|
|
|
|
test_names: Optional[List[str]] = None,
|
|
|
|
|
check_cfg: bool = False) -> None:
|
|
|
|
|
last_names = dict()
|
|
|
|
|
if test_names is not None:
|
|
|
|
|
for name in test_names:
|
|
|
|
@ -107,9 +109,12 @@ def show_tree(dir_path: str, indent: int = 0,
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
if last_names:
|
|
|
|
|
node_name = node.name
|
|
|
|
|
if node_name.startswith("._cfg") and check_cfg:
|
|
|
|
|
node_name = node.name[len("._cfg0000_"):]
|
|
|
|
|
for name in test_names:
|
|
|
|
|
if node.name.startswith(name):
|
|
|
|
|
number = int(node.name[len(name) + 1:])
|
|
|
|
|
if node_name.startswith(name):
|
|
|
|
|
number = int(node_name[len(name) + 1:])
|
|
|
|
|
if number > last_names[name]:
|
|
|
|
|
last_names[name] = number
|
|
|
|
|
break
|
|
|
|
@ -1846,11 +1851,30 @@ class TestDirectoryProcessor:
|
|
|
|
|
assert os.path.lexists(join_paths(CHROOT_PATH,
|
|
|
|
|
'/etc/._cfg0000_link_5'))
|
|
|
|
|
|
|
|
|
|
def test_for_debug_packages_error(self):
|
|
|
|
|
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
|
|
|
|
|
'templates_64')
|
|
|
|
|
|
|
|
|
|
directory_processor = DirectoryProcessor('install',
|
|
|
|
|
datavars_module=datavars)
|
|
|
|
|
directory_processor.process_template_directories()
|
|
|
|
|
|
|
|
|
|
atom_parser = PackageAtomParser(chroot_path=CHROOT_PATH)
|
|
|
|
|
vim_pkg = Package(
|
|
|
|
|
atom_parser.parse_package_parameter(">app-editors/vim-8.0"),
|
|
|
|
|
chroot_path=CHROOT_PATH)
|
|
|
|
|
vim_core_pkg = Package(
|
|
|
|
|
atom_parser.parse_package_parameter("app-editors/vim-core"),
|
|
|
|
|
chroot_path=CHROOT_PATH)
|
|
|
|
|
assert '/etc/file_26' in vim_pkg
|
|
|
|
|
assert '/etc/file_26' not in vim_core_pkg
|
|
|
|
|
|
|
|
|
|
def test_view_tree(self):
|
|
|
|
|
list_path = join_paths(CHROOT_PATH, '/etc')
|
|
|
|
|
test_names = ['dir', 'file', 'link']
|
|
|
|
|
last_names = show_tree(list_path,
|
|
|
|
|
test_names=test_names)
|
|
|
|
|
test_names=test_names,
|
|
|
|
|
check_cfg=True)
|
|
|
|
|
if last_names:
|
|
|
|
|
print('last names:')
|
|
|
|
|
print("\n".join(
|
|
|
|
|