diff mbox series

[yocto-autobuilder-helper] janitor/clobberdir: Ensure TRASH_DIR exists

Message ID 20250917102333.1876432-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [yocto-autobuilder-helper] janitor/clobberdir: Ensure TRASH_DIR exists | expand

Commit Message

Richard Purdie Sept. 17, 2025, 10:23 a.m. UTC
Rather than letting bad things happen, exit with an error message if
TRASH_DIR doesn't exist.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 janitor/clobberdir | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/janitor/clobberdir b/janitor/clobberdir
index 16b019e..a5f69b9 100755
--- a/janitor/clobberdir
+++ b/janitor/clobberdir
@@ -49,6 +49,10 @@  if "TRASH_DIR" not in ourconfig:
 
 trashdir = utils.getconfig("TRASH_DIR", ourconfig)
 
+if not os.path.exists(trashdir):
+    print("Error, TRASH_DIR %s does not exist" % trashdir)
+    sys.exit(1)
+
 for x in [clobberdir]:
     if os.path.exists(x) and os.path.exists(trashdir):
         if (os.stat(trashdir).st_dev == os.stat(x).st_dev):