-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_repositories.sh
executable file
·53 lines (41 loc) · 2.19 KB
/
clean_repositories.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Cleans this repository and Flexeme's for the double-blind paper submission.
# Before running this script, create "$artifacts_dir", and manually move untangling result and the analysis results into it.
# The analysis results are generated by `analysis/generate_paper.sh`.
# The untangling results is the folder $UTB_OUTPUT specified in the top-level `README.md` of this repository.
# The untangling results cannot be moved automatically because they may be computed on a remote server.
set -o errexit # Exit immediately if a command exits with a non-zero status
set -o nounset # Exit if script tries to use an uninitialized variable
set -o pipefail # Produce a failure status if any command in the pipeline fails
if [ $# -ne 1 ] ; then
echo 'usage: clean_repositories.sh <artifacts_dir>'
exit 1
fi
export artifacts_dir="$1" # The directory where to put cleaned repositories (e.g., 'artifacts')
mkdir -p "$artifacts_dir"
SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)"
# Clone repositories
echo "Cloning repositories into $artifacts_dir"
export GIT_TERMINAL_PROMPT=0
git -C "$artifacts_dir" clone --filter=blob:none https://github.com/Thomsch/untangling-tools-benchmark \
|| git -C "$artifacts_dir" clone --filter=blob:none git@github.com:Thomsch/untangling-tools-benchmark.git
git -C "$artifacts_dir" clone --filter=blob:none https://github.com/Thomsch/flexeme \
|| git -C "$artifacts_dir" clone --filter=blob:none git@github.com:Thomsch/Flexeme.git
echo "Cloning repositories into $artifacts_dir: DONE"
echo "Cleaning all files in $artifacts_dir"
clean_repo() {
repo_dir="$1"
rm -rf "$repo_dir/.git"
rm -rf "$repo_dir/.github"
rm -rf "$repo_dir/.vscode"
find "$artifacts_dir" -type f -print0 | xargs -0 sed -i -f clean_repositories.sed
}
clean_repo "$artifacts_dir/untangling-tools-benchmark"
clean_repo "$artifacts_dir/flexeme"
echo "Cleaning all files in $artifacts_dir: DONE"
# Move double-blind/README.md to $OUT_DIR
cp "$SCRIPTDIR"/README.md "$artifacts_dir"
# Remove cleaning script and README.MD from the cleaned repository
rm -rf "$artifacts_dir/untangling-tools-benchmark/double-blind"
# Remove MacOS specific files
find "$artifacts_dir" -name ".DS_Store" -type f -delete