Explicitly remove all temporary files
There is no guarantee __del__ will ever be called, and we were leaving a ton of stuff in /tmp. With this patch we pass the temporary directories explictly and make sure they are deleted at the end. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
fe026bb588
commit
35e72df99f
3 changed files with 9 additions and 14 deletions
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
from distutils.version import LooseVersion
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import dnf
|
||||
|
||||
|
|
@ -56,12 +54,6 @@ class DnfWrapper(dnf.Base):
|
|||
super(DnfWrapper, self).__init__(*args, **kwargs)
|
||||
self.arch_wrapper = ArchWrapper(self.conf.substitutions["arch"])
|
||||
self.comps_wrapper = CompsWrapper(self)
|
||||
# use a custom cachedir, delete it after use
|
||||
self.conf.cachedir = tempfile.mkdtemp(prefix="pungi_dnf_")
|
||||
|
||||
def __del__(self):
|
||||
if self.conf.cachedir.startswith("/tmp/"):
|
||||
shutil.rmtree(self.conf.cachedir)
|
||||
|
||||
def add_repo(self, repoid, baseurl=None, mirrorlist=None, ignoregroups=False, lookaside=False):
|
||||
if "://" not in baseurl:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue