From 6d157ca8095ea2110fea25783b9fed5756e42f64 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Wed, 25 Sep 2024 14:31:32 +0300 Subject: [PATCH] fix: do not copy own database during pyalpm initialization Previous implementation lead to warning in logs in case if the repository itself wasn't configured on the host --- src/ahriman/core/alpm/pacman.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ahriman/core/alpm/pacman.py b/src/ahriman/core/alpm/pacman.py index 31bdebdb..ede52d26 100644 --- a/src/ahriman/core/alpm/pacman.py +++ b/src/ahriman/core/alpm/pacman.py @@ -91,9 +91,8 @@ class Pacman(LazyLogging): database = self.database_init(handle, repository, self.repository_id.architecture) self.database_copy(handle, database, pacman_root, use_ahriman_cache=use_ahriman_cache) - # install repository database too - local_database = self.database_init(handle, self.repository_id.name, self.repository_id.architecture) - self.database_copy(handle, local_database, pacman_root, use_ahriman_cache=use_ahriman_cache) + # install repository database too (without copying) + self.database_init(handle, self.repository_id.name, self.repository_id.architecture) if use_ahriman_cache and refresh_database: self.database_sync(handle, force=refresh_database == PacmanSynchronization.Force) @@ -115,6 +114,7 @@ class Pacman(LazyLogging): if not use_ahriman_cache: return + # copy root database if no local copy found pacman_db_path = Path(handle.dbpath) if not pacman_db_path.is_dir(): @@ -123,11 +123,13 @@ class Pacman(LazyLogging): if dst.is_file(): return # file already exists, do not copy dst.parent.mkdir(mode=0o755, exist_ok=True) # create sync directory if it doesn't exist + src = repository_database(pacman_root) if not src.is_file(): self.logger.warning("repository %s is set to be used, however, no working copy was found", database.name) return # database for some reason deos not exist - self.logger.info("copy pacman database from operating system root to ahriman's home") + + self.logger.info("copy pacman database %s from operating system root to ahriman's home %s", src, dst) shutil.copy(src, dst) self.repository_paths.chown(dst)