This is an automated email from the git hooks/post-receive script.
praiskup pushed a commit to branch master
in repository copr/copr.
commit 8aae8477ffb3d670d1469c1222432eb0a64f727c
Author: Jakub Kadlcik <frostyx(a)email.cz>
AuthorDate: Mon Feb 3 13:04:41 2020 +0100
rpmbuild: don't create unnecessary tmp directory
Relates: #1245
---
rpmbuild/copr_rpmbuild/providers/base.py | 16 +++++-----------
rpmbuild/main.py | 2 ++
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/rpmbuild/copr_rpmbuild/providers/base.py
b/rpmbuild/copr_rpmbuild/providers/base.py
index 8a6a85a..6baa67f 100644
--- a/rpmbuild/copr_rpmbuild/providers/base.py
+++ b/rpmbuild/copr_rpmbuild/providers/base.py
@@ -1,7 +1,6 @@
import os
import logging
import tempfile
-import shutil
from ..helpers import string2list
log = logging.getLogger("__main__")
@@ -12,7 +11,11 @@ class Provider(object):
self.outdir = outdir
self.config = config
- self.workdir = tempfile.mkdtemp(prefix="copr-rpmbuild-")
+ self.workdir = os.path.join(outdir, "obtain-sources")
+ try:
+ os.mkdir(self.workdir)
+ except FileExistsError:
+ pass
# Change home directory to workdir and create .rpmmacros there
os.environ["HOME"] = self.workdir
@@ -25,12 +28,3 @@ class Provider(object):
enabled_protocols = string2list(self.config.get("main",
"enabled_source_protocols"))
rpmmacros.write("%__urlhelper_localopts --proto -all,{0}\n"
.format(','.join(["+"+protocol for protocol
in enabled_protocols])))
-
- def __del__(self):
- self.cleanup()
-
- def cleanup(self):
- try:
- shutil.rmtree(self.workdir)
- except OSError as e:
- pass
diff --git a/rpmbuild/main.py b/rpmbuild/main.py
index f348c28..a05ddba 100755
--- a/rpmbuild/main.py
+++ b/rpmbuild/main.py
@@ -157,6 +157,8 @@ def produce_srpm(task, config, resultdir):
task["source_json"], tempdir, config)
provider.produce_srpm()
for item in os.listdir(tempdir):
+ if item in ["obtain-sources"]:
+ continue
shutil.copy(os.path.join(tempdir, item), resultdir)
finally:
shutil.rmtree(tempdir)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.