Skip to content

Commit bd405fc

Browse files
Simplify script
1 parent 10fa04b commit bd405fc

File tree

1 file changed

+3
-88
lines changed

1 file changed

+3
-88
lines changed

update_cache_ubuntu_20_04.sh

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,7 @@
11
#!/bin/bash
22

3-
[ $# -eq 0 ] && { echo "Usage: $0 <full path to APPLICATION checkout>"; exit 1; }
4-
5-
confirm() {
6-
read -r -p "${1:-Are you sure? [y/N]} " response
7-
case "$response" in
8-
[yY][eE][sS]|[yY])
9-
true
10-
;;
11-
*)
12-
false
13-
;;
14-
esac
15-
}
16-
17-
APPLICATION_DIR="$1"
18-
19-
header() {
20-
echo -e "\e[35m$1\e[0m"
21-
}
22-
23-
echo "APPLICATION dir: " ${APPLICATION_DIR}
24-
25-
[ ! -d ${APPLICATION_DIR} ] && { echo "${APPLICATION_DIR} DOES NOT EXIST"; exit 1; }
26-
27-
export CONAN_USER_HOME="/Code/release/"
28-
29-
[ ! -d ${CONAN_USER_HOME} ] && { echo "${CONAN_USER_HOME} DOES NOT EXIST"; exit 1; }
30-
31-
export CONAN_USER_HOME_SHORT=${CONAN_USER_HOME}/short
32-
33-
[ ! -d ${CONAN_USER_HOME_SHORT} ] && { echo "${CONAN_USER_HOME_SHORT} DOES NOT EXIST"; exit 1; }
34-
35-
export LFS_LIMIT=50
36-
export CONAN_SYSREQUIRES_MODE=enabled
37-
38-
header "Prepare Cache for update"
39-
40-
confirm "Clean cache? [y/N]" && cd ${CONAN_USER_HOME} && git clean -df && git checkout . && git checkout host-Linux-target-Linux-ubuntu-20.04-master
41-
42-
confirm "Update cache? [y/N]" && cd ${CONAN_USER_HOME} && git pull && git lfs pull
43-
44-
confirm "DELETE the whole cache? [y/N]" && cd ${CONAN_USER_HOME} && conan remove -f "*"
45-
46-
confirm "Prepare short paths [y/N]" && cd ${CONAN_USER_HOME} && find .conan/ -name .conan_link -exec perl -pi -e 's=CONAN_USER_HOME_SHORT=$ENV{CONAN_USER_HOME_SHORT}=g' {} +
47-
48-
header "Populate the Cache"
49-
50-
confirm "Update APPLICATION? [y/N]" && cd ${APPLICATION_DIR} && git pull
51-
52-
confirm "Remove old build directory? [y/N]" && cd ${APPLICATION_DIR} && rm -rf build
3+
UBUNTU_VERSION="20.04"
534

54-
confirm "Create build directory? [y/N]" && cd ${APPLICATION_DIR} && mkdir build
55-
56-
confirm "Start build? [y/N]" && cd ${APPLICATION_DIR} && cd build && cmake -DUPDATE_CONAN=ON -DCMAKE_BUILD_TYPE=Release ..
57-
58-
header "Clean Conan"
59-
60-
confirm "Clean Conan builds? [y/N]" && conan remove -f "*" --builds
61-
62-
confirm "Clean Conan src? [y/N]" && conan remove -f "*" --src
63-
64-
confirm "Clean Conan system-reqs? [y/N]" && conan remove -f "*" --system-reqs
65-
66-
header "Prep for cache upload"
67-
68-
confirm "Fix short paths? [y/N]" && cd ${CONAN_USER_HOME} && find .conan/ -name .conan_link -exec perl -pi -e 's=$ENV{CONAN_USER_HOME_SHORT}=CONAN_USER_HOME_SHORT=g' {} +
69-
70-
confirm "Clean up .conan_link.bak? [y/N]" && cd ${CONAN_USER_HOME} && find -name .conan_link.bak -execdir rm {} \;
71-
72-
confirm "List files over ${LFS_LIMIT}M? [y/N]" && cd ${CONAN_USER_HOME} && find .conan short -type f -size +${LFS_LIMIT}M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
73-
74-
confirm "LFS track files over ${LFS_LIMIT}M? [y/N]" && cd ${CONAN_USER_HOME} && find .conan short -type f -size +${LFS_LIMIT}M -execdir git lfs track {} \;
75-
76-
header "Upload cache"
77-
78-
confirm "Add everything to git? [y/N]" && cd ${CONAN_USER_HOME} && git add -A
79-
80-
confirm "Commit to git? [y/N]" && cd ${CONAN_USER_HOME} && git commit -m "Local build"
81-
82-
confirm "Push to GitHub? [y/N]" && cd ${CONAN_USER_HOME} && git push
83-
84-
header "Test cache locally"
85-
86-
confirm "TEST: Prepare short paths [y/N]" && cd ${CONAN_USER_HOME} && find .conan/ -name .conan_link -exec perl -pi -e 's=CONAN_USER_HOME_SHORT=$ENV{CONAN_USER_HOME_SHORT}=g' {} +
87-
88-
confirm "TEST: Remove old build directory? [y/N]" && cd ${APPLICATION_DIR} && rm -rf build
89-
90-
confirm "TEST: Create build directory? [y/N]" && cd ${APPLICATION_DIR} && mkdir build
5+
[ $# -eq 0 ] && { echo "Usage: $0 <full path to APPLICATION checkout>"; exit 1; }
916

92-
confirm "TEST: Start REGULAR build? [y/N]" && cd ${APPLICATION_DIR} && cd build && cmake -DUPDATE_CONAN=OFF -DCMAKE_BUILD_TYPE=Release ..
7+
./update_cache_linux.sh "$1" "$UBUNTU_VERSION"

0 commit comments

Comments
 (0)