From d89f15d7603de7016b16d3ba3de487dea9d0f475 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Thu, 28 Mar 2013 18:51:22 +0000 Subject: [PATCH] [solo.commands.rescue] fix "equo rescue generate" The database file was not written on disk because Entropy forwarded any API call to the in-RAM database. If we generate a generic repository and then reload the entropy installed packages one everything will work as expected. --- client/solo/commands/rescue.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/solo/commands/rescue.py b/client/solo/commands/rescue.py index faa38855f..7aef53660 100644 --- a/client/solo/commands/rescue.py +++ b/client/solo/commands/rescue.py @@ -21,6 +21,7 @@ from entropy.output import red, bold, brown, blue, darkred, darkgreen, \ from entropy.const import etpConst from entropy.exceptions import SystemDatabaseError from entropy.db.exceptions import OperationalError, DatabaseError +from entropy.client.interfaces.db import InstalledPackagesRepository from solo.commands.descriptor import SoloCommandDescriptor from solo.commands.command import SoloCommand @@ -428,8 +429,18 @@ Tools to rescue the running system. brown(repo_path), header=" ") - inst_repo.initializeRepository() - inst_repo.commit() + # open a repository at the old path, if repo_path is + # not in place, Entropy will forward us to the in-RAM + # database (for sqlite), which is not what we want. + gen_repo = entropy_client.open_generic_repository( + repo_path, dbname=InstalledPackagesRepository.NAME, + xcache=False, skip_checks=True) + gen_repo.initializeRepository() + gen_repo.commit() + gen_repo.close() + + entropy_client.reopen_installed_repository() + inst_repo = entropy_client.installed_repository() entropy_client.output( purple(_("Repository initialized, generating metadata")),