Browse code

better update now should notice new dependencies. Dirty Harry became a bit more soft

Nat! authored on 07/06/2016 11:44:22
Showing 2 changed files
... ...
@@ -5,7 +5,11 @@
5 5
 * Skip Dirty Harry with -f flag.
6 6
 * improve FAQ a little
7 7
 * Reverse oder of repositories when updating, because this catches deep
8
-  renames.
8
+  renames. Update now also fetches repositories, if they aren't there
9
+  yet.
10
+* Make the Dirty Harry check less foolproof, but also less annoying.
11
+
12
+
9 13
 
10 14
 0.25
11 15
 ===
... ...
@@ -759,8 +759,12 @@ ${clone}"
759 759
                branch="`branch_from_clone "${clone}"`"
760 760
                scm="`scm_from_clone "${clone}"`"
761 761
 
762
+               create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
763
+
762 764
                clone_repository "${name}" "${url}" "${branch}" "${scm}"
763 765
 
766
+               remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
767
+
764 768
                if [ $? -eq 1 ]
765 769
                then
766 770
                   stop=0
... ...
@@ -826,6 +830,8 @@ install_embedded_repositories()
826 826
          dstdir="${dstprefix}${name}"
827 827
          log_fetch_action "${name}" "${dstdir}"
828 828
 
829
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
830
+
829 831
          if [ ! -d "${dstdir}" ]
830 832
          then
831 833
             #
... ...
@@ -868,6 +874,9 @@ install_embedded_repositories()
868 868
            log_fluff "Repository \"${dstdir}\" already exists"
869 869
          fi
870 870
       done
871
+
872
+      remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
873
+
871 874
    fi
872 875
 
873 876
    IFS="${old}"
... ...
@@ -949,10 +958,11 @@ update()
949 949
    after_r=`modification_timestamp "${dstdir}/${BOOTSTRAP_SUBDIR}/repositories"`
950 950
    after_e=`modification_timestamp "${dstdir}/${BOOTSTRAP_SUBDIR}/embedded_repositories"`
951 951
 
952
-   if [ "${before_r}" = "${after_r}" -a "${before_e}" = "${after_e}" ]
952
+   if [ "${before_r}" != "${after_r}" -o "${before_e}" != "${after_e}" ]
953 953
    then
954 954
       rval="`expr "$rval" + 2`"
955 955
    fi
956
+
956 957
    return "$rval"
957 958
 }
958 959
 
... ...
@@ -962,22 +972,21 @@ update_repository()
962 962
    local name
963 963
    local url
964 964
    local branch
965
+   local dstdir
965 966
 
966 967
    name="$1"
967 968
    url="$2"
968 969
    branch="$3"
970
+   dstdir="${CLONESFETCH_SUBDIR}/${name}"
969 971
 
970 972
    local name
971 973
    local tag
972
-   local dstdir
973 974
    local rval
974 975
 
975 976
 
976 977
    tag="`read_repo_setting "${name}" "tag"`" #repo (sic)
977 978
 
978
-   dstdir="${CLONESFETCH_SUBDIR}/${name}"
979
-   exekutor [ -e "${dstdir}" ] || fail "You need to fetch \"${name}\" first, before updating"
980
-   exekutor [ -x "${dstdir}" ] || fail "\"${name}\" is not anymore in \"repositories\""
979
+   exekutor [ -x "${dstdir}" ] || fail "\"${name}\" is not accesible anymore in \"repositories\""
981 980
 
982 981
    log_fetch_action "${url}" "${dstdir}"
983 982
 
... ...
@@ -1052,7 +1061,9 @@ update_repositories()
1052 1052
       for name in "$@"
1053 1053
       do
1054 1054
          IFS="${old}"
1055
-         update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1055
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1056
+            update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1057
+         remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1056 1058
       done
1057 1059
 
1058 1060
       IFS="
... ...
@@ -1060,8 +1071,10 @@ update_repositories()
1060 1060
       for name in "$@"
1061 1061
       do
1062 1062
          IFS="${old}"
1063
-         did_update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1064
-      done
1063
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1064
+            did_update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1065
+         remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1066
+         done
1065 1067
       IFS="${old}"
1066 1068
       return
1067 1069
    fi
... ...
@@ -1072,6 +1085,8 @@ update_repositories()
1072 1072
    local match
1073 1073
    local branch
1074 1074
    local scm
1075
+   local dstdir
1076
+   local rval
1075 1077
 
1076 1078
    updated=""
1077 1079
 
... ...
@@ -1096,16 +1111,31 @@ update_repositories()
1096 1096
 
1097 1097
             if [ "${match}" != "${clone}" ]
1098 1098
             then
1099
-               fetched="${updated}
1099
+               updated="${updated}
1100 1100
 ${clone}"
1101 1101
 
1102 1102
                name="`canonical_name_from_clone "${clone}"`"
1103 1103
                url="`url_from_clone "${clone}"`"
1104 1104
                branch="`branch_from_clone "${clone}"`"
1105 1105
 
1106
-               update_repository "${name}" "${url}" "${branch}"
1106
+               dstdir="${CLONESFETCH_SUBDIR}/${name}"
1107 1107
 
1108
-               if [ $? -eq 1 ]
1108
+               create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1109
+
1110
+                  if [ -e "${dstdir}" ]
1111
+                  then
1112
+                     update_repository "${name}" "${url}" "${branch}"
1113
+                     rval=$?
1114
+                  else
1115
+                     scm="`scm_from_clone "${clone}"`"
1116
+                     clone_repository  "${name}" "${url}" "${branch}" "${scm}"
1117
+                     rval=1
1118
+                  fi
1119
+
1120
+               remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1121
+
1122
+
1123
+               if [ $rval -eq 1 ]
1109 1124
                then
1110 1125
                   stop=0
1111 1126
                   break
... ...
@@ -1155,7 +1185,11 @@ update_embedded_repositories()
1155 1155
          dstdir="${dstprefix}${name}"
1156 1156
          log_fetch_action "${name}" "${dstdir}"
1157 1157
 
1158
-         update "${name}" "${url}" "${dstdir}" "${branch}" "${tag}"
1158
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1159
+
1160
+            update "${name}" "${url}" "${dstdir}" "${branch}" "${tag}"
1161
+
1162
+         remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1159 1163
       done
1160 1164
    fi
1161 1165
 
... ...
@@ -1203,15 +1237,11 @@ main()
1203 1203
       install_gems
1204 1204
       install_pips
1205 1205
 
1206
-      create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1207
-
1208 1206
       clone_repositories
1209 1207
       install_embedded_repositories
1210 1208
 
1211 1209
       check_tars
1212 1210
    else
1213
-      create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1214
-
1215 1211
       update_repositories "$@"
1216 1212
       update_embedded_repositories
1217 1213
    fi
... ...
@@ -1219,6 +1249,8 @@ main()
1219 1219
    #
1220 1220
    # Run prepare scripts if present
1221 1221
    #
1222
+   create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1223
+
1222 1224
    run_fetch_settings_script "post-${COMMAND}" "$@"
1223 1225
 
1224 1226
    remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"