| |
@@ -0,0 +1,46 @@
|
| |
+ #! /usr/bin/python3
|
| |
+
|
| |
+ """
|
| |
+ Helper script for reading the output from
|
| |
+ /usr/bin/copr_prune_srpms.py --dry-run --stdout
|
| |
+ """
|
| |
+
|
| |
+ import sys
|
| |
+ import re
|
| |
+
|
| |
+ def _main():
|
| |
+ exp_len = None
|
| |
+
|
| |
+ allowed = [
|
| |
+ re.compile(r'^\d+'),
|
| |
+ re.compile(r"^build-\d+.log"),
|
| |
+ re.compile("tmp"),
|
| |
+ re.compile("cache"),
|
| |
+ re.compile("repodata"),
|
| |
+ re.compile("appdata"),
|
| |
+ ]
|
| |
+
|
| |
+ file = open(sys.argv[1], "r")
|
| |
+ for line in file:
|
| |
+ line = line.strip()
|
| |
+ path, _ = line.split()
|
| |
+ parts = path.split("/")
|
| |
+
|
| |
+ # re-assure we have nice output
|
| |
+ if exp_len is None:
|
| |
+ exp_len = len(parts)
|
| |
+ else:
|
| |
+ assert exp_len == len(parts)
|
| |
+
|
| |
+ last_part = parts[-1]
|
| |
+
|
| |
+ def _matcher(pattern, item=last_part):
|
| |
+ return pattern.match(item)
|
| |
+ if any(map(_matcher, allowed)):
|
| |
+ continue
|
| |
+
|
| |
+ # keep printing only what is needed
|
| |
+ print(line)
|
| |
+
|
| |
+ if __name__ == "__main__":
|
| |
+ _main()
|
| |
This is unlikely to be merged :)