diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-02-08 18:59:18 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-02-08 18:59:18 +0100 |
commit | 479187c950a1ee0d456c0439c7936e91a617d6a8 (patch) | |
tree | da02db929f6b165b8fd698f055632ac2bb4365bc | |
parent | 8b6e5ea4e83991fc0958def2da396c1e337f87a1 (diff) | |
download | gemato-479187c950a1ee0d456c0439c7936e91a617d6a8.tar.gz |
recursiveloader: Control storing Manifest device explicitly
Add an explicit keyword argument to control when st_dev of Manifest
is stored as Manifest device. It does not make any real difference
at the moment (since st_dev of sub-Manifests is forced to match that
of top Manifest) but it will be useful in the future.
-rw-r--r-- | gemato/recursiveloader.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py index b89df87..bbc298f 100644 --- a/gemato/recursiveloader.py +++ b/gemato/recursiveloader.py @@ -258,12 +258,12 @@ class ManifestRecursiveLoader(object): # TODO: allow catching OpenPGP exceptions somehow? m = self.load_manifest(self.top_level_manifest_filename, - allow_create=allow_create) + allow_create=allow_create, store_dev=True) self.openpgp_signed = m.openpgp_signed self.openpgp_signature = m.openpgp_signature def load_manifest(self, relpath, verify_entry=None, - allow_create=False): + allow_create=False, store_dev=False): """ Load a single Manifest file whose relative path within Manifest tree is @relpath. If @verify_entry is not null, the Manifest @@ -273,6 +273,9 @@ class ManifestRecursiveLoader(object): If @allow_create is True and the Manifest does not exist, a new Manifest will be added. Otherwise, opening a non-existing file will cause an exception. + + If @store_dev is True, the st_dev for this Manifest will + be stored for cross-device checks. Defaults to false. """ try: @@ -295,7 +298,8 @@ class ManifestRecursiveLoader(object): else: raise err - self.manifest_device = st.st_dev + if store_dev: + self.manifest_device = st.st_dev self.loaded_manifests[relpath] = m return m |