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 830
          dstdir="${dstprefix}${name}"
827 831
          log_fetch_action "${name}" "${dstdir}"
828 832
 
833
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
834
+
829 835
          if [ ! -d "${dstdir}" ]
830 836
          then
831 837
             #
... ...
@@ -868,6 +874,9 @@ install_embedded_repositories()
868 874
            log_fluff "Repository \"${dstdir}\" already exists"
869 875
          fi
870 876
       done
877
+
878
+      remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
879
+
871 880
    fi
872 881
 
873 882
    IFS="${old}"
... ...
@@ -949,10 +958,11 @@ update()
949 958
    after_r=`modification_timestamp "${dstdir}/${BOOTSTRAP_SUBDIR}/repositories"`
950 959
    after_e=`modification_timestamp "${dstdir}/${BOOTSTRAP_SUBDIR}/embedded_repositories"`
951 960
 
952
-   if [ "${before_r}" = "${after_r}" -a "${before_e}" = "${after_e}" ]
961
+   if [ "${before_r}" != "${after_r}" -o "${before_e}" != "${after_e}" ]
953 962
    then
954 963
       rval="`expr "$rval" + 2`"
955 964
    fi
965
+
956 966
    return "$rval"
957 967
 }
958 968
 
... ...
@@ -962,22 +972,21 @@ update_repository()
962 972
    local name
963 973
    local url
964 974
    local branch
975
+   local dstdir
965 976
 
966 977
    name="$1"
967 978
    url="$2"
968 979
    branch="$3"
980
+   dstdir="${CLONESFETCH_SUBDIR}/${name}"
969 981
 
970 982
    local name
971 983
    local tag
972
-   local dstdir
973 984
    local rval
974 985
 
975 986
 
976 987
    tag="`read_repo_setting "${name}" "tag"`" #repo (sic)
977 988
 
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\""
989
+   exekutor [ -x "${dstdir}" ] || fail "\"${name}\" is not accesible anymore in \"repositories\""
981 990
 
982 991
    log_fetch_action "${url}" "${dstdir}"
983 992
 
... ...
@@ -1052,7 +1061,9 @@ update_repositories()
1052 1061
       for name in "$@"
1053 1062
       do
1054 1063
          IFS="${old}"
1055
-         update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1064
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1065
+            update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1066
+         remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1056 1067
       done
1057 1068
 
1058 1069
       IFS="
... ...
@@ -1060,8 +1071,10 @@ update_repositories()
1060 1071
       for name in "$@"
1061 1072
       do
1062 1073
          IFS="${old}"
1063
-         did_update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1064
-      done
1074
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1075
+            did_update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
1076
+         remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1077
+         done
1065 1078
       IFS="${old}"
1066 1079
       return
1067 1080
    fi
... ...
@@ -1072,6 +1085,8 @@ update_repositories()
1072 1085
    local match
1073 1086
    local branch
1074 1087
    local scm
1088
+   local dstdir
1089
+   local rval
1075 1090
 
1076 1091
    updated=""
1077 1092
 
... ...
@@ -1096,16 +1111,31 @@ update_repositories()
1096 1111
 
1097 1112
             if [ "${match}" != "${clone}" ]
1098 1113
             then
1099
-               fetched="${updated}
1114
+               updated="${updated}
1100 1115
 ${clone}"
1101 1116
 
1102 1117
                name="`canonical_name_from_clone "${clone}"`"
1103 1118
                url="`url_from_clone "${clone}"`"
1104 1119
                branch="`branch_from_clone "${clone}"`"
1105 1120
 
1106
-               update_repository "${name}" "${url}" "${branch}"
1121
+               dstdir="${CLONESFETCH_SUBDIR}/${name}"
1107 1122
 
1108
-               if [ $? -eq 1 ]
1123
+               create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1124
+
1125
+                  if [ -e "${dstdir}" ]
1126
+                  then
1127
+                     update_repository "${name}" "${url}" "${branch}"
1128
+                     rval=$?
1129
+                  else
1130
+                     scm="`scm_from_clone "${clone}"`"
1131
+                     clone_repository  "${name}" "${url}" "${branch}" "${scm}"
1132
+                     rval=1
1133
+                  fi
1134
+
1135
+               remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1136
+
1137
+
1138
+               if [ $rval -eq 1 ]
1109 1139
                then
1110 1140
                   stop=0
1111 1141
                   break
... ...
@@ -1155,7 +1185,11 @@ update_embedded_repositories()
1155 1185
          dstdir="${dstprefix}${name}"
1156 1186
          log_fetch_action "${name}" "${dstdir}"
1157 1187
 
1158
-         update "${name}" "${url}" "${dstdir}" "${branch}" "${tag}"
1188
+         create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1189
+
1190
+            update "${name}" "${url}" "${dstdir}" "${branch}" "${tag}"
1191
+
1192
+         remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1159 1193
       done
1160 1194
    fi
1161 1195
 
... ...
@@ -1203,15 +1237,11 @@ main()
1203 1237
       install_gems
1204 1238
       install_pips
1205 1239
 
1206
-      create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1207
-
1208 1240
       clone_repositories
1209 1241
       install_embedded_repositories
1210 1242
 
1211 1243
       check_tars
1212 1244
    else
1213
-      create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1214
-
1215 1245
       update_repositories "$@"
1216 1246
       update_embedded_repositories
1217 1247
    fi
... ...
@@ -1219,6 +1249,8 @@ main()
1219 1249
    #
1220 1250
    # Run prepare scripts if present
1221 1251
    #
1252
+   create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1253
+
1222 1254
    run_fetch_settings_script "post-${COMMAND}" "$@"
1223 1255
 
1224 1256
    remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"