Browse Source

Warning messages while processing packages from 'merge' parameters was

fixed #63
master
Иванов Денис 2 years ago
parent
commit
74e9ef8b9f
  1. 6
      calculate/templates/template_processor.py
  2. 5
      calculate/utils/package.py
  3. 17
      tests/templates/test_directory_processor.py
  4. 1
      tests/templates/testfiles/test_dir_processor_root/templates_48/install/.calculate_directory
  5. 2
      tests/templates/testfiles/test_dir_processor_root/templates_48/install/dir_66/.calculate_directory
  6. 2
      tests/templates/testfiles/test_dir_processor_root/templates_48/install/dir_66/file_0

6
calculate/templates/template_processor.py

@ -2231,10 +2231,10 @@ class DirectoryProcessor:
# настройки еще есть -- заново проходимся по списку.
for package in self.packages_to_merge.difference(
self.packages_file_trees):
self.output.set_error(
("Error: package '{0}' not found for"
self.output.set_warning(
("Warning: package '{0}' not found for"
" action{1} '{2}'.").format(
package,
str(package),
's' if len(self.action) > 1 else '',
', '.join(self.action)))
self.packages_to_merge.remove(package)

5
calculate/utils/package.py

@ -447,6 +447,11 @@ class PackageAtomName:
def __hash__(self) -> bool:
return hash(self._package_directory)
def __str__(self) -> str:
category_path, name = os.path.split(self._package_directory)
category = os.path.basename(category_path)
return f'{category}/{name}'
NonePackage = PackageAtomName({'pkg_path': None, 'version': None})

17
tests/templates/test_directory_processor.py

@ -1474,6 +1474,23 @@ class TestDirectoryProcessor:
directory_processor.process_template_directories()
assert os.path.exists(join_paths(CHROOT_PATH, '/etc/dir_65/file_0'))
def test_warning_while_merge(self):
datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH,
'templates_48')
io = IOModule(save_messages=True)
directory_processor = DirectoryProcessor(
'install',
datavars_module=datavars,
package='test-category/test-package',
output_module=io
)
directory_processor.process_template_directories()
assert os.path.exists(join_paths(CHROOT_PATH, '/etc/dir_66/file_0'))
assert io.messages[-2] ==\
("warning",
"Warning: package 'test-category/new-package-0.1.1'"
" not found for action 'install'.")
def test_view_tree(self):
list_path = join_paths(CHROOT_PATH, '/etc')
show_tree(list_path)

1
tests/templates/testfiles/test_dir_processor_root/templates_48/install/.calculate_directory

@ -0,0 +1 @@
{% calculate action = "install", append = "skip" %}

2
tests/templates/testfiles/test_dir_processor_root/templates_48/install/dir_66/.calculate_directory

@ -0,0 +1,2 @@
{% calculate package = "test-category/test-package",
merge = "test-category/new/package" %}

2
tests/templates/testfiles/test_dir_processor_root/templates_48/install/dir_66/file_0

@ -0,0 +1,2 @@
{% calculate append = 'join', format = 'raw' %}
Something I can never have
Loading…
Cancel
Save