summaryrefslogtreecommitdiffstats
path: root/scripts/dl_cleanup.py
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2022-11-12 09:50:36 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2022-11-15 14:45:50 +0100
commit9a2d362bf7296d955b3cb8ab625bf1ec25703f89 (patch)
tree9c3095bbc9cb66565da7579efd668cc468aca157 /scripts/dl_cleanup.py
parentc984fc762412f206ebeb3e873742988ff760fb90 (diff)
downloadopenwrt-9a2d362bf7296d955b3cb8ab625bf1ec25703f89.tar.gz
openwrt-9a2d362bf7296d955b3cb8ab625bf1ec25703f89.tar.bz2
openwrt-9a2d362bf7296d955b3cb8ab625bf1ec25703f89.zip
scripts: fix dl_cleanup.py argument handling
The -w|--whitelist and -D|--download-dir arguments pass an additional value, properly evaluate that. Also allow to pass the download directory without -D|--download-dir, just as the usage describes. Finally fix spitting out the wrong error messages about those args. Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'scripts/dl_cleanup.py')
-rwxr-xr-xscripts/dl_cleanup.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/dl_cleanup.py b/scripts/dl_cleanup.py
index b15a9bb1a7..cdbcb83f20 100755
--- a/scripts/dl_cleanup.py
+++ b/scripts/dl_cleanup.py
@@ -224,7 +224,7 @@ def main(argv):
try:
(opts, args) = getopt.getopt(
argv[1:],
- "hdBwDb:",
+ "hdBw:D:b:",
[
"help",
"dry-run",
@@ -268,12 +268,15 @@ def main(argv):
if o in ("-b", "--build-dir"):
builddir = v
+ if args:
+ directory = args[0]
+
if not os.path.exists(directory):
- print("Can't find dl path", directory)
+ print("Can't find download directory", directory)
return 1
if not os.path.exists(builddir):
- print("Can't find dl path", builddir)
+ print("Can't find build directory", builddir)
return 1
# Create a directory listing and parse the file names.