[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.
This commit is contained in:
Fabio Erculiani
2013-03-28 18:51:22 +00:00
parent fb76210e41
commit d89f15d760

View File

@@ -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")),