packaging-move-dev-to-attic.py: remove hardcoded list of supported
authorWard Vandewege <ward@curii.com>
Mon, 4 Jan 2021 18:27:21 +0000 (13:27 -0500)
committerWard Vandewege <ward@curii.com>
Mon, 4 Jan 2021 18:27:21 +0000 (13:27 -0500)
distributions, instead validate the distribution name by pattern.

refs #17219

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

jenkins/packaging-move-dev-to-attic.py

index 5dac3c08893d49ce42d68eda73d18972c1e2384f..4cc0d394005cb8284d091972551b00b6caa59934 100755 (executable)
@@ -95,9 +95,15 @@ class CollectPackageName:
 
     return return_value
 
+def distro(astring):
+    if re.fullmatch(r'.*-dev', astring) == None:
+        raise ValueError
+    return astring
+
 parser = argparse.ArgumentParser(description='List the packages to delete.')
-parser.add_argument('distro', choices=['bionic-dev','jessie-dev','precise-dev','stretch-dev','trusty-dev','wheezy-dev','xenial-dev','buster-dev'],
-                    help='distro to do the clean up')
+parser.add_argument('distro',
+                    type=distro,
+                    help='distro to process, must be a dev repository, e.g. buster-dev')
 parser.add_argument('--repo_dir',
                     default='/var/www/aptly_public/',
                     help='parent directory of the aptly repositories (default:  %(default)s)')