utils/ostree: deployment path helper
Add a simple helper method that returns the path for a deployment, given the sysroot, the osname, the reference or commit and the deployment serial. Path might not exist. `
This commit is contained in:
parent
dc201d45fd
commit
54fe67ece5
1 changed files with 14 additions and 0 deletions
|
|
@ -125,3 +125,17 @@ def rev_parse(repo: PathLike, ref: str) -> str:
|
|||
raise RuntimeError(msg)
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def deployment_path(root: PathLike, osname: str, ref: str, serial: int):
|
||||
"""Return the path to a deployment given the parameters"""
|
||||
|
||||
base = os.path.join(root, "ostree")
|
||||
|
||||
repo = os.path.join(base, "repo")
|
||||
stateroot = os.path.join(base, "deploy", osname)
|
||||
|
||||
commit = rev_parse(repo, ref)
|
||||
sysroot = f"{stateroot}/deploy/{commit}.{serial}"
|
||||
|
||||
return sysroot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue