Drop the dnf Base object deletion code and use reset

It appears that reset+fill_sack will now do the right thing and load the
state of the installed packages. Drop the hack with deleting the object.

Also add a double-check to make sure there really is a list of files
for anaconda-core before we run off and make an image without removing
anything.
This commit is contained in:
Brian C. Lane 2015-02-10 12:05:36 -08:00
parent 9ff5897eee
commit 13de711548
1 changed files with 6 additions and 15 deletions

View File

@ -556,22 +556,13 @@ class LoraxTemplateRunner(object):
logger.info("Performing post-installation setup tasks")
process.join()
# close down the base and re-init it to pick up changes
self.dbo.close()
del self.dbo
# Reset the package sack to pick up the installed packages
self.dbo.reset(repos=False)
self.dbo.fill_sack(load_system_repo=True, load_available_repos=False)
self.dbo = dnf.Base()
conf = self.dbo.conf
# Point inside the installroot
conf.installroot = self.outroot
conf.prepend_installroot('persistdir')
conf.debuglevel = 10
conf.errorlevel = 0
RELEASEVER = dnf.rpm.detect_releasever(self.dbo.conf.installroot)
self.dbo.conf.substitutions['releasever'] = RELEASEVER
self.dbo.read_all_repos()
self.dbo.fill_sack(load_system_repo=False)
self.dbo.read_comps()
# At this point dnf should know about the installed files. Double check that it really does.
if len(self._filelist("anaconda-core")) == 0:
raise Exception("Failed to reset dbo to installed package set")
def removefrom(self, pkg, *globs):
'''