diff --git a/apt_ostree/bootstrap.py b/apt_ostree/bootstrap.py index 4c02621..f609d0c 100644 --- a/apt_ostree/bootstrap.py +++ b/apt_ostree/bootstrap.py @@ -148,7 +148,10 @@ class Bootstrap: if r.returncode != 0: self.logging.info(f"Failed to commit {self.state.branch} to " f"{self.state.repo}.") - self.logging.info(f"Commited {self.state.repo} to {self.state.repo}.") + else: + self.logging.info(f"Commited {self.state.branch} to " + f"{self.state.repo}.") + self.ostree.ostree_summary_update(self.state.repo) def create_ostree(self, rootdir): """Create an ostree branch from a rootfs.""" diff --git a/apt_ostree/compose.py b/apt_ostree/compose.py index 5fa6c5d..820a06a 100644 --- a/apt_ostree/compose.py +++ b/apt_ostree/compose.py @@ -46,6 +46,8 @@ class Compose: self.logging.info(f"Rollback back to {commit}.") self.ostree.ostree_rollback(commit) + self.ostree.ostree_summary_update() + def backup(self, export_dir): """Export branch to a new ostree repo.""" export_dir = pathlib.Path(export_dir) @@ -58,6 +60,8 @@ class Compose: f"Pulling from {self.state.branch} to {export_dir}.") self.ostree.ostree_pull(export_dir) + self.ostree.ostree_summary_update(export_dir) + def restore(self, import_dir): """Import a branch into a repostiory.""" import_dir = pathlib.Path(import_dir) @@ -70,6 +74,8 @@ class Compose: f"Pulling from {self.state.branch} to {import_dir}.") self.ostree.ostree_pull(import_dir) + self.ostree.ostree_summary_update(import_dir) + def enablerepo(self): """Enable Debian package feed.""" try: @@ -112,6 +118,7 @@ class Compose: self.logging.info(f"Successfully commited {self.state.branch}" f"({rev[:10]}) from {parent}.") + self.ostree.ostree_summary_update(self.state.repo) self.logging.info("Cleaning up.") try: shutil.rmtree(self.rootfs) diff --git a/apt_ostree/ostree.py b/apt_ostree/ostree.py index c6f9275..8332bb1 100644 --- a/apt_ostree/ostree.py +++ b/apt_ostree/ostree.py @@ -193,6 +193,14 @@ class Ostree: return refspec + def ostree_summary_update(self, repo=None): + """Update the summary""" + if not repo: + repo = self.state.repo + return run_command( + ["ostree", "summary", "-u", f"--repo={repo}"], + check=True) + def remotes_list(self): """Fetch list of remote hosts.""" try: diff --git a/apt_ostree/packages.py b/apt_ostree/packages.py index e1bbfa8..e879e2d 100644 --- a/apt_ostree/packages.py +++ b/apt_ostree/packages.py @@ -80,6 +80,7 @@ class Packages: subject="New packages", msg=commit, ) + self.ostree.ostree_summary_update(self.state.repo) # Step 7 - Cleanup self.deploy.cleanup(rootfs) @@ -142,6 +143,7 @@ class Packages: subject="Package Upgrade", msg=commit, ) + self.ostree.ostree_summary_update(self.state.repo) # Step 7 - Cleanup self.deploy.cleanup(rootfs) @@ -184,6 +186,7 @@ class Packages: subject="Uninstall packages", msg=commit, ) + self.ostree.ostree_summary_update(self.state.repo) # Step 7 - Cleanup self.deploy.cleanup(rootfs) diff --git a/apt_ostree/rebase.py b/apt_ostree/rebase.py index daa68b6..3ce36fe 100644 --- a/apt_ostree/rebase.py +++ b/apt_ostree/rebase.py @@ -120,6 +120,7 @@ class Rebase: subject=subject, msg=commit ) + self.ostree.ostree_summary_update(self.state.repo) self.deploy.cleanup(rootfs) @@ -130,8 +131,9 @@ class Rebase: if refs != "origin"] def _fetch(self, remote, branch): - """Wrapper around ostree fertch.""" + """Wrapper around ostree fetch.""" self.ostree.fetch(remote, branch) + self.ostree.ostree_summary_update() def get_current_packages(self, branch, ref): """Steps to prepare the systeem before a rebase.""" diff --git a/apt_ostree/repo.py b/apt_ostree/repo.py index b46ff19..32730d7 100644 --- a/apt_ostree/repo.py +++ b/apt_ostree/repo.py @@ -169,6 +169,8 @@ class Repo: ) if r.returncode != 0: self.logging.error("Failed to commit to repository.") + else: + self.ostree.ostree_summary_update(self.state.repo) self.deploy.cleanup(str(rootfs)) def add_repo(self): @@ -205,4 +207,6 @@ class Repo: ) if r.returncode != 0: self.logging.error("Failed to commit to repository") + else: + self.ostree.ostree_summary_update(self.state.repo) self.deploy.cleanup(str(rootfs))