aboutsummaryrefslogtreecommitdiff
path: root/gnu
ModeNameSize
-rw-r--r--artwork.scm1587logplainabout
-rw-r--r--bootloader.scm6686logplainabout
d---------bootloader114logplain
d---------build543logplain
-rw-r--r--local.mk59137logplainabout
-rw-r--r--packages.scm12840logplainabout
d---------packages16157logplain
-rw-r--r--services.scm31444logplainabout
d---------services1537logplain
-rw-r--r--system.scm42579logplainabout
d---------system471logplain
-rw-r--r--tests.scm10972logplainabout
d---------tests670logplain
ile__).resolve().parent class Piggybacked: """ Store information about foreign resources in use. Public attributes: 'resource_must_depend' (read-only) 'package_license_files' (read-only) """ def __init__(self, archives: dict[str, Path]={}, roots: dict[str, Path]={}, package_license_files: list[PurePosixPath]=[], resource_must_depend: list[dict]=[]): """ Initialize this Piggybacked object. 'archives' maps piggybacked system names to directories that contain package(s)' archive files. An 'archives' object may look like {'apt': PosixPath('/path/to/dir/with/debs/and/tarballs')}. 'roots' associates directory names to be virtually inserted under Hydrilla source package directory with paths to real filesystem directories that hold their desired contents, i.e. unpacked foreign packages. 'package_license_files' lists paths to license files that should be included with the Haketilo package that will be produced. The paths are to be resolved using 'roots' dictionary. 'resource_must_depend' lists names of Haketilo packages that the produced resources will additionally depend on. This is meant to help distribute common licenses with a separate Haketilo package. """ self.archives = archives self.roots = roots self.package_license_files = package_license_files self.resource_must_depend = resource_must_depend def resolve_file(self, file_ref_name: PurePosixPath) -> Optional[Path]: """ 'file_ref_name' is a path as may appear in an index.json file. Check if the file belongs to one of the roots we have and return either a path to the relevant file under this root or None. It is not being checked whether the file actually exists in the filesystem. """ parts = file_ref_name.parts if not parts: return None root_path = self.roots.get(parts[0]) if root_path is None: return None path = root_path for part in parts[1:]: path = path / part path = path.resolve() if not path.is_relative_to(root_path): raise FileReferenceError(_('loading_{}_outside_piggybacked_dir') .format(file_ref_name)) return path def archive_files(self) -> Iterable[tuple[PurePosixPath, Path]]: """ Yield all archive files in use. Each yielded tuple holds file's desired path relative to the piggybacked archives directory to be created and its current real path. """ for system, real_dir in self.archives.items(): for path in real_dir.rglob('*'): yield PurePosixPath(system) / path.relative_to(real_dir), path