Repository navigation
Expand file tree
/
Copy path0001-kojid-remove-bootstrap-dir.patch
More file actions
81 lines (76 loc) · 3.59 KB
/
Copy path0001-kojid-remove-bootstrap-dir.patch
File metadata and controls
81 lines (76 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From 692780050405ffc6c5be00be00585b62609ce0e9 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Mon, 4 May 2020 17:24:20 +0200
Subject: [PATCH 01/20] kojid: remove bootstrap dir
Fixes: https://pagure.io/koji/issue/1988
---
koji/daemon.py | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/koji/daemon.py b/koji/daemon.py
index 4798500c209a..9a77f20ea13c 100644
--- a/koji/daemon.py
+++ b/koji/daemon.py
@@ -45,7 +45,8 @@ from koji.util import (
base64encode,
dslice,
parseStatus,
- to_list
+ to_list,
+ joinpath,
)
@@ -728,6 +729,9 @@ class TaskManager(object):
continue
else:
age = min(age, time.time() - st.st_mtime)
+ topdir_bootstrap = "%s-bootstrap" % topdir
+ if not os.path.exists(topdir_bootstrap):
+ topdir_bootstrap = None
# note: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=192153)
# If rpmlib is installing in this chroot, removing it entirely
# can lead to a world of hurt.
@@ -736,27 +740,36 @@ class TaskManager(object):
if age > 3600 * 24:
# dir untouched for a day
self.logger.info("Removing buildroot: %s" % desc)
- if topdir and safe_rmtree(topdir, unmount=True, strict=False) != 0:
+ if ((topdir and safe_rmtree(topdir, unmount=True, strict=False) != 0) or
+ (topdir_bootstrap and
+ safe_rmtree(topdir_bootstrap, unmount=True, strict=False) != 0)):
continue
# also remove the config
try:
os.unlink(data['cfg'])
except OSError as e:
self.logger.warning("%s: can't remove config: %s" % (desc, e))
- elif age > 120:
- if rootdir:
+ elif age > 120 and rootdir:
+ for d in (topdir, topdir_bootstrap):
+ if not d:
+ continue
+ if d == topdir_bootstrap:
+ desc2 = "%s [bootstrap]" % desc
+ else:
+ desc2 = desc
+ rootdir = joinpath(d, 'root')
try:
flist = os.listdir(rootdir)
except OSError as e:
- self.logger.warning("%s: can't list rootdir: %s" % (desc, e))
+ self.logger.warning("%s: can't list rootdir: %s" % (desc2, e))
continue
if flist:
- self.logger.info("%s: clearing rootdir" % desc)
+ self.logger.info("%s: clearing rootdir" % desc2)
for fn in flist:
safe_rmtree("%s/%s" % (rootdir, fn), unmount=True, strict=False)
- resultdir = "%s/result" % topdir
+ resultdir = "%s/result" % d
if os.path.isdir(resultdir):
- self.logger.info("%s: clearing resultdir" % desc)
+ self.logger.info("%s: clearing resultdir" % desc2)
safe_rmtree(resultdir, unmount=True, strict=False)
else:
self.logger.debug("Recent buildroot: %s: %i seconds" % (desc, age))
--
2.52.0