diff options
author | Aurimas Liutikas <aurimas@google.com> | 2023-11-10 15:23:16 -0800 |
---|---|---|
committer | Aurimas Liutikas <aurimas@google.com> | 2023-11-10 15:23:16 -0800 |
commit | 3a67c3424d423647d419e8208242707fabe71be8 (patch) | |
tree | a793289b0eb27abb889db94e08df262912e9f032 | |
parent | d3b889e106148b54f754cd311f93cad741e866a5 (diff) | |
download | internal-3a67c3424d423647d419e8208242707fabe71be8.tar.gz |
Enhance prune script to also support rc releases
Test: ./prune.py -> next CL
Change-Id: I806862ef677d1de2b5c10a0fabab5cfb41fdf599
-rwxr-xr-x | prune.py | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,9 +1,9 @@ #!/usr/bin/python3 -"""A script to remove old alpha/beta version prebuilts. +"""A script to remove old alpha/beta/rc version prebuilts. -Script deletes all alpha/beta unless they are the last two released versions -of the artifacts. +Script deletes all alpha/beta/rc unless they are the last two released versions +of the artifacts. All stable releases are kept. """ import os @@ -16,13 +16,15 @@ SCRIPT_PATH = os.path.realpath(os.path.dirname(__file__)) directories = [x for x in os.walk(SCRIPT_PATH)] for directory in directories: # Use Version to sort so we handle 1.9.0 and 1.10.0 correctly - # Drop last two alphas as they still might be used # fixeddocs is excluded due to androidx/concurrent/concurrent-futures/1.0.0-fixeddocs01 versionDirs = sorted([subdir for subdir in directory[1] if versionPattern.match(subdir) and "fixeddocs" not in subdir ], key=Version)[:-2] - alphaBetaVersionDirs = [subdir for subdir in versionDirs if "alpha" in subdir or "beta" in subdir] + alphaBetaVersionDirs = [subdir + for subdir in versionDirs + if "-alpha" in subdir or "-beta" in subdir or "-rc" in subdir + ] if any(alphaBetaVersionDirs): for version in alphaBetaVersionDirs: shutil.rmtree(directory[0] + "/" + version) |