createrepo/__init__.py
[email protected] Fri, 12 Aug 2011 16:17:39 +0000 (UTC)
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <[email protected]> |
createrepo/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit b6c41bc9997b6adcb9e5ccd218a8bd938c04983d Author: Seth Vidal <[email protected]> Date: Fri Aug 12 12:16:57 2011 -0400 I think this is the last of the tmp files which are, apparently, terribly important to clean up closes: https://bugzilla.redhat.com/show_bug.cgi?id=730330 diff --git a/createrepo/__init__.py b/createrepo/__init__.py index 2c63bad..e3c18aa 100644 --- a/createrepo/__init__.py +++ b/createrepo/__init__.py @@ -589,7 +589,7 @@ class MetaDataGenerator: # waitfor the workers to finish and as each one comes in # open the files they created and write them out to our metadata # add up the total pkg counts and return that value - worker_tmp_path = tempfile.mkdtemp() + self._worker_tmp_path = tempfile.mkdtemp() # setting this in the base object so we can clean it up later worker_chunks = split_list_into_equal_chunks(pkgfiles, self.conf.workers) worker_cmd_dict = {} worker_jobs = {} @@ -611,7 +611,7 @@ class MetaDataGenerator: # make the worker directory workercmdline = [] workercmdline.extend(base_worker_cmdline) - thisdir = worker_tmp_path + '/' + str(worker_num) + thisdir = self._worker_tmp_path + '/' + str(worker_num) if checkAndMakeDir(thisdir): workercmdline.append('--tmpmdpath=%s' % thisdir) else: @@ -658,7 +658,7 @@ class MetaDataGenerator: for (fn, fo) in (('primary.xml', self.primaryfile), ('filelists.xml', self.flfile), ('other.xml', self.otherfile)): - fnpath = worker_tmp_path + '/' + str(num) + '/' + fn + fnpath = self._worker_tmp_path + '/' + str(num) + '/' + fn if os.path.exists(fnpath): fo.write(open(fnpath, 'r').read()) @@ -1189,6 +1189,9 @@ class MetaDataGenerator: % dirbase) self.errorlog(_('Error was %s') % e) self.errorlog(_('Please clean up this directory manually.')) + # our worker tmp path + if hasattr(self, '_worker_tmp_path') and os.path.exists(self._worker_tmp_path): + shutil.rmtree(self._worker_tmp_path, ignore_errors=True) def setup_sqlite_dbs(self, initdb=True): """sets up the sqlite dbs w/table schemas and db_infos"""