swh.loader.core.nar module#
- class swh.loader.core.nar.Nar(hash_names: List[str], format_output: str = 'hex', exclude_vcs: bool = False, vcs_type: str | None = 'git', debug: bool = False)[source]#
- Bases: - object- NAR serializer. - This builds the NAR structure and serializes it as per the phd thesis from Eelco Dolstra thesis. See https://edolstra.github.io/pubs/phd-thesis.pdf. - For example, this tree on a filesystem: - $ tree foo foo ├── bar │ └── exe └── baz 1 directory, 2 files - serializes as: - nix-archive-1(typedirectoryentry(namebarnode(typedirectoryentry(nameexenode(typeregularexecutablecontents<Content of file foo/bar/exe>))))entry(namebaznode(typeregularcontents<Content of file foo/baz>))) - For reability, the debug mode prints the following: - nix-archive-1 ( type directory entry ( name bar node ( type directory entry ( name exe node ( type regular executable contents <Content of file foo/bar/exe> ) ) ) ) entry ( name baz node ( type regular contents <Content of file foo/baz> ) ) ) - Note: “<Content of file $name>” is a placeholder for the actual file content