-
Notifications
You must be signed in to change notification settings - Fork 27
/
clean-repo-ci
25 lines (23 loc) · 1014 Bytes
/
clean-repo-ci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh -e
[ "X$REPO_PATH" = X ] && { echo Make sure REPO_PATH is correctly set; exit 1; }
# Defaults for the CI repo
ARCHITECTURES=${ARCHITECTURES:-slc7_x86-64}
PACKAGES=${PACKAGES:-ROOT O2 AliRoot Clang Python-modules}
# Eliminate files for a given subset of packages
# Keep files in the same month and in any case at least 10 of each.
# This should guarantee that all the files which are currently involved in the PRs
# are actually still there. If this is not the case, we consider the PR
# based on a too old alidist tag.
for arch in $ARCHITECTURES; do
rm -rf delete.list
for x in $PACKAGES; do
find $REPO_PATH/TARS/$arch/store -type f -name "$x*" -printf "%T+\t%p\n" | sort -r | grep -v "^`date +%Y-%m`" | tail -n +10 | awk '{print $2;}' | tee -a delete.list
done
echo Files to delete
cat delete.list
if [ "X$DO_IT" = X1 ]; then
while IFS= read -r file ; do rm -- "$file" ; done < delete.list
else
echo Dry run. Will not touch anything for $REPO_PATH/TARS/$arch/store
fi
done