Browse code

Improve performance by rememebering what has been fetched

Nat! authored on 02-02-2017 18:52:18
Showing 2 changed files
... ...
@@ -150,7 +150,7 @@ mode=${1:-755}
150 150
 [ $# -eq 0 ] || shift
151 151
 
152 152
 bin="${prefix}/bin"
153
-libexec="${prefix}/libexec/mulle-bootstrap-3"
153
+libexec="${prefix}/libexec/mulle-bootstrap"
154 154
 
155 155
 if [ "$prefix" = "" ] || [ "$bin" = "" ] || [ "$libexec" = "" ] || [ "$mode" = "" ]
156 156
 then
... ...
@@ -168,7 +168,7 @@ then
168 168
 fi
169 169
 
170 170
 
171
-for i in mulle*bootstrap-3
171
+for i in mulle*bootstrap
172 172
 do
173 173
    install -m "${mode}" "${i}" "${bin}/$i" || exit 1
174 174
    printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
... ...
@@ -1063,6 +1063,16 @@ work_clones()
1063 1063
          continue
1064 1064
       fi
1065 1065
 
1066
+      #
1067
+      # optimization, try to no redo fetches
1068
+      #
1069
+      echo "${__IGNORE__}" | fgrep -s -q -x "${clone}" > /dev/null
1070
+      if [ $? -eq 0 ]
1071
+      then
1072
+         continue
1073
+      fi
1074
+      __REFRESHED__="`add_line "${__REFRESHED__}" "${clone}"`"
1075
+
1066 1076
       parse_clone "${clone}" "${stashrootdir}" || exit 1
1067 1077
 
1068 1078
       actionitems="`required_action_for_clone "${clone}" \
... ...
@@ -1230,6 +1240,8 @@ work_all_repositories()
1230 1240
       loops=""
1231 1241
       before=""
1232 1242
 
1243
+      __IGNORE__=""
1244
+
1233 1245
       while :
1234 1246
       do
1235 1247
          loops="${loops}X"
... ...
@@ -1247,9 +1259,13 @@ work_all_repositories()
1247 1259
             break
1248 1260
          fi
1249 1261
 
1262
+         __REFRESHED__=""
1263
+
1250 1264
          fetched="`work_clones "${REPOS_DIR}" "${before}" "YES"`" || exit 1
1251 1265
          all_fetched="`add_line "${all_fetched}" "${fetched}"`"
1252 1266
 
1267
+         __IGNORE__="`add_line "${__IGNORE__}" "${__REFRESHED__}"`"
1268
+
1253 1269
          log_fluff "Get back in the ring to take another swing"
1254 1270
       done
1255 1271