Ejemplo n.º 1
0
 def test_unmatched_requirement(self):
     item = InstallFileItem(from_target='', source='x', dest='y')
     with self.assertRaises(
             RuntimeError,
             msg='^At /: nothing in set() matches the requirement '
             f'{ItemReq(requires=require_directory("/"), item=item)}$',
     ):
         ValidatedReqsProvs([item])
Ejemplo n.º 2
0
 def test_duplicate_paths_provided(self):
     with self.assertRaisesRegex(
             RuntimeError,
             '^Both .* and .* from .* provide the same path$'):
         ValidatedReqsProvs([
             InstallFileItem(from_target='', source='x', dest='y/x'),
             MakeDirsItem(from_target='', into_dir='/', path_to_make='y/x'),
         ])
Ejemplo n.º 3
0
    'foo/face':
    SymlinkToDirItem(
        from_target=T_SYMLINKS,
        dest='/foo/face',
        source='/foo/bar',
    ),
    'foo/bar/baz/bar':
    SymlinkToDirItem(  # Rsync style
        from_target=T_SYMLINKS,
        dest='/foo/bar/baz/',
        source='/foo/bar',
    ),
    'foo/hello_world.tar':
    InstallFileItem(
        from_target=T_SYMLINKS,
        source=Path(TARGET_TO_PATH[T_HELLO_WORLD_TAR]),
        dest='/foo/hello_world.tar',
    ),
    'foo/symlink_to_hello_world.tar':
    SymlinkToFileItem(
        from_target=T_SYMLINKS,
        dest='/foo/symlink_to_hello_world.tar',
        source='/foo/hello_world.tar',
    ),
    'foo/symlink_to_dev_null':
    SymlinkToFileItem(
        from_target=T_SYMLINKS,
        dest='/foo/symlink_to_dev_null',
        source='/dev/null',
    ),
Ejemplo n.º 4
0
from ..dep_graph import (
    DependencyGraph,
    ItemProv,
    ItemReq,
    ItemReqsProvs,
    ValidatedReqsProvs,
)
from ..provides import ProvidesDirectory, ProvidesDoNotAccess, ProvidesFile
from ..requires import require_directory

PATH_TO_ITEM = {
    '/a/b/c': MakeDirsItem(from_target='', into_dir='/', path_to_make='a/b/c'),
    '/a/d/e': MakeDirsItem(from_target='', into_dir='a', path_to_make='d/e'),
    '/a/b/c/F': InstallFileItem(
        from_target='',
        source='x',
        dest='a/b/c/F',
    ),
    '/a/d/e/G': InstallFileItem(
        from_target='',
        source='G',
        dest='a/d/e/G',
    ),
}


def _fs_root_phases(item):
    return [(FilesystemRootItem.get_phase_builder, (item, ))]


class ValidateReqsProvsTestCase(unittest.TestCase):
Ejemplo n.º 5
0
    ItemReqsProvs,
    ValidatedReqsProvs,
)
from ..requires_provides import (ProvidesDirectory, ProvidesDoNotAccess,
                                 ProvidesFile, require_directory)

# Since the constructor of `InstallFileItem` tries to `os.stat` its input,
# we need to give it filenames that exist.
_FILE1 = '/etc/passwd'
_FILE2 = '/etc/group'
PATH_TO_ITEM = {
    '/a/b/c': MakeDirsItem(from_target='', into_dir='/', path_to_make='a/b/c'),
    '/a/d/e': MakeDirsItem(from_target='', into_dir='a', path_to_make='d/e'),
    '/a/b/c/F': InstallFileItem(
        from_target='',
        source=_FILE1,
        dest='a/b/c/F',
    ),
    '/a/d/e/G': InstallFileItem(
        from_target='',
        source=_FILE2,
        dest='a/d/e/G',
    ),
}


def _fs_root_phases(item):
    return [(FilesystemRootItem.get_phase_builder, (item, ))]


class ValidateReqsProvsTestCase(unittest.TestCase):