sources: check if ostree object exists in cache
The generic ways of checking if an object is in the cache does not apply for ostree as the internal structure of a repo is quite specific. Thus we need to use the ostree executable to ask it to explore its repo for us.
This commit is contained in:
parent
441e67a6f6
commit
ac2a194cd4
1 changed files with 7 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ import os
|
|||
import sys
|
||||
import subprocess
|
||||
import uuid
|
||||
from osbuild.util.ostree import show
|
||||
|
||||
from osbuild import sources
|
||||
|
||||
|
|
@ -122,8 +123,12 @@ class OSTreeSource(sources.SourceService):
|
|||
ostree("config", "set", "repo.locking", "true", repo=self.repo)
|
||||
|
||||
# pylint: disable=[no-self-use]
|
||||
def exists(self, _checksum, _item):
|
||||
return False
|
||||
def exists(self, checksum, _desc):
|
||||
try:
|
||||
show(self.repo, checksum)
|
||||
except RuntimeError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue