janitor/clobberdir: Ensure TRASH_DIR exists

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>
This commit is contained in:
Richard Purdie 2025-09-17 11:22:51 +01:00
parent fa3e15fba7
commit f8fe275c36

View File

@ -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):