Browse code

Remove obsolete -project.sh But warnings in a safer place, you can turn he off now. Add mulle-bootstrap config

Nat! authored on 25-09-2016 22:36:19
Showing 11 changed files
... ...
@@ -20,7 +20,13 @@ be helpful, when building brew packages (for example).
20 20
 * fixed some as of yet unknown bugs, by improving some path functions
21 21
 * new -c switch to enable checking `/usr/local/include for dependency libraries conveniently from the command line. Fix build to add /usr/local/include to build, if check_usr_local_include is YES.
22 22
 * allow build and fetch options to be passed to `bootstrap`
23
-* improved comments in repositories and embedded_repositories templates
23
+* improved comments in repositories` and `embedded_repositories` templates
24
+* pass ADDICTIONS_DIR to build systems
25
+* renamed hidden option -r to -l (sorry)
26
+* remove obsolete mulle-bootstrap-project.sh
27
+* call warn scripts earlier, when bootstrapping
28
+* started on mulle-bootstrap config, first settings "warn_scripts"
29
+* turn off scripts warning, with `mulle-bootstrap config -on dont_warn_scripts`
24 30
 
25 31
 
26 32
 2.0.1
... ...
@@ -123,6 +123,8 @@ bootstrap_nomagic_main()
123 123
    # used for option handling only
124 124
    MULLE_BOOTSTRAP_WILL_BUILD="YES"
125 125
 
126
+   warn_scripts_main "${BOOTSTRAP_SUBDIR}" || exit 1
127
+
126 128
    if [ -z "${DONT_RECURSE}" ]
127 129
    then
128 130
       fetch_main "$@" || exit 1
... ...
@@ -132,8 +134,6 @@ bootstrap_nomagic_main()
132 134
       refresh_main nonrecursive       || exit 1
133 135
    fi
134 136
 
135
-   warn_scripts_main "${BOOTSTRAP_SUBDIR}" || exit 1
136
-
137 137
    # used for option handling only
138 138
    MULLE_BOOTSTRAP_DID_FETCH="YES"
139 139
 
... ...
@@ -187,14 +187,14 @@ bootstrap_main()
187 187
             MULLE_BOOTSTRAP_ANSWER="NO"
188 188
           ;;
189 189
 
190
-         -c|--check-usr-local-include)
191
-            MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE="YES"
192
-         ;;
193
-
194 190
          -y|--prefer-local)
195 191
             MULLE_BOOTSTRAP_ANSWER="YES"
196 192
          ;;
197 193
 
194
+         -c|--check-usr-local-include)
195
+            MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE="YES"
196
+         ;;
197
+
198 198
          -f|--force-fetch)
199 199
             MULLE_BOOTSTRAP_DIRTY_HARRY="NO"
200 200
          ;;
... ...
@@ -203,6 +203,10 @@ bootstrap_main()
203 203
             MULLE_EXECUTOR_DRY_RUN="YES"
204 204
          ;;
205 205
 
206
+         -l|--optimistic|--lucky)
207
+            MULLE_BOOTSTRAP_OPTIMISTIC="YES"
208
+         ;;
209
+
206 210
          -ig|--ignore-graveyard)
207 211
             MULLE_BOOTSTRAP_IGNORE_GRAVEYARD="YES"
208 212
          ;;
... ...
@@ -251,10 +255,6 @@ bootstrap_main()
251 255
             GITFLAGS="-v"
252 256
          ;;
253 257
 
254
-         -r|--refresh)
255
-            MULLE_BOOTSTRAP_SKIP_INITIAL_REFRESH="YES"
256
-         ;;
257
-
258 258
          -s|--silent)
259 259
             MULLE_BOOTSTRAP_TRACE=
260 260
             MULLE_BOOTSTRAP_TERSE="YES"
... ...
@@ -356,7 +356,7 @@ bootstrap_main()
356 356
    fi
357 357
 
358 358
    # some commands refresh before execution
359
-   if [ "${MULLE_BOOTSTRAP_SKIP_INITIAL_REFRESH}" != "YES" ]
359
+   if [ "${MULLE_BOOTSTRAP_OPTIMISTIC}" != "YES" ]
360 360
    then
361 361
       case "${command}" in
362 362
          bootstrap|nomagic|fetch)
... ...
@@ -389,39 +389,27 @@ bootstrap_main()
389 389
          bootstrap_nomagic_main "${command}" "$@"
390 390
       ;;
391 391
 
392
-      # experimental stuff
393
-      project)
394
-         . mulle-bootstrap-project.sh
395
-
396
-         project_main "$@" || exit 1
397
-      ;;
398
-
399
-      install)
400
-         . mulle-bootstrap-install.sh
401
-
402
-         install_main "$@" || exit 1
403
-      ;;
404
-
405 392
       build)
406 393
          . mulle-bootstrap-build.sh
407 394
 
408 395
          build_main "$@" || exit 1
409 396
       ;;
410 397
 
411
-      refresh)
412
-         refresh_main "$@" || exit 1
413
-      ;;
414
-
415 398
       clean)
416 399
          . mulle-bootstrap-clean.sh
417 400
 
418
-         clean_main "$@"    || exit 1
401
+         clean_main "$@" || exit 1
402
+      ;;
403
+
404
+      config)
405
+         . mulle-bootstrap-settings.sh
406
+         config_main "$@" || exit 1
419 407
       ;;
420 408
 
421 409
       dist)
422 410
          . mulle-bootstrap-clean.sh
423 411
 
424
-         clean_main "dist"    || exit 1
412
+         clean_main "dist" || exit 1
425 413
       ;;
426 414
 
427 415
       fetch)
... ...
@@ -431,6 +419,27 @@ bootstrap_main()
431 419
          refresh_main || exit 1
432 420
       ;;
433 421
 
422
+      init)
423
+         . mulle-bootstrap-init.sh
424
+
425
+         init_main "$@" || exit 1
426
+      ;;
427
+
428
+      install)
429
+         . mulle-bootstrap-install.sh
430
+
431
+         install_main "$@" || exit 1
432
+      ;;
433
+
434
+      library-path)
435
+         echo "$PATH" | tr ':' '\012' | head -1
436
+         exit 0
437
+      ;;
438
+
439
+      refresh)
440
+         refresh_main "$@" || exit 1
441
+      ;;
442
+
434 443
       update)
435 444
          . mulle-bootstrap-fetch.sh
436 445
 
... ...
@@ -438,12 +447,6 @@ bootstrap_main()
438 447
          refresh_main || exit 1
439 448
       ;;
440 449
 
441
-      init)
442
-         . mulle-bootstrap-init.sh
443
-
444
-         init_main "$@" || exit 1
445
-      ;;
446
-
447 450
       setup-xcode|xcode)
448 451
          . mulle-bootstrap-xcode.sh
449 452
 
... ...
@@ -456,11 +459,6 @@ bootstrap_main()
456 459
          tag_main "$@" || exit 1
457 460
       ;;
458 461
 
459
-      library-path)
460
-         echo "$PATH" | tr ':' '\012' | head -1
461
-         exit 0
462
-      ;;
463
-
464 462
       version)
465 463
          echo "${MULLE_BOOTSTRAP_VERSION}" || exit 1
466 464
       ;;
... ...
@@ -817,12 +817,14 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
817 817
       local relative_srcdir
818 818
       local prefixbuild
819 819
       local dependenciesdir
820
+      local addictionsdir
820 821
       local cmakemodulepath
821 822
 
822 823
       relative_srcdir="`relative_path_between "${owd}/${srcdir}" "${PWD}"`"
823 824
 
824 825
       prefixbuild="`add_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCY_SUBDIR}"`"
825 826
       dependenciesdir="`add_path "${dependenciesdir}" "${nativewd}/${REFERENCE_DEPENDENCY_SUBDIR}"`"
827
+      addictionsdir="`add_path "${addictionsdir}" "${nativewd}/${REFERENCE_ADDICTION_SUBDIR}"`"
826 828
 
827 829
 #      cmakemodulepath="\${CMAKE_MODULE_PATH}"
828 830
 #      if [ ! -z "${CMAKE_MODULE_PATH}" ]
... ...
@@ -895,21 +897,23 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
895 897
       oldpath="$PATH"
896 898
       PATH="${BUILDPATH}"
897 899
 
898
-      logging_exekutor "${CMAKE}" -G "${CMAKE_GENERATOR}" "-DCMAKE_BUILD_TYPE=${mapped}" \
899
-"${sdkparameter}" \
900
+      logging_exekutor "${CMAKE}" -G "${CMAKE_GENERATOR}" \
901
+"-DCMAKE_BUILD_TYPE=${mapped}" \
900 902
 "-DDEPENDENCIES_DIR=${dependenciesdir}" \
903
+"-DADDICTIONS_DIR=${addictionsdir}" \
901 904
 "-DCMAKE_INSTALL_PREFIX:PATH=${prefixbuild}"  \
902 905
 "-DCMAKE_INCLUDE_PATH=${includelines}" \
903 906
 "-DCMAKE_LIBRARY_PATH=${librarylines}" \
904 907
 "-DCMAKE_FRAMEWORK_PATH=${frameworklines}" \
905
-"${c_compiler_line}" \
906
-"${cxx_compiler_line}" \
907 908
 "-DCMAKE_C_FLAGS=${other_cflags}" \
908 909
 "-DCMAKE_CXX_FLAGS=${other_cxxflags}" \
909 910
 "-DCMAKE_EXE_LINKER_FLAGS=${other_ldflags}" \
910 911
 "-DCMAKE_SHARED_LINKER_FLAGS=${other_ldflags}" \
911
-${CMAKE_FLAGS} \
912
+"${sdkparameter}" \
913
+"${c_compiler_line}" \
914
+"${cxx_compiler_line}" \
912 915
 ${localcmakeflags} \
916
+${CMAKE_FLAGS} \
913 917
 "${relative_srcdir}" > "${logfile1}"
914 918
       rval=$?
915 919
 
... ...
@@ -1082,10 +1086,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1082 1086
 
1083 1087
       local prefixbuild
1084 1088
       local dependenciesdir
1089
+      local addictionsdir
1085 1090
       #local linker
1086 1091
 
1087 1092
       pathrefixbuild="`add_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCY_SUBDIR}"`"
1088 1093
       dependenciesdir="`add_path "${dependenciesdir}" "${nativewd}/${REFERENCE_DEPENDENCY_SUBDIR}"`"
1094
+      addictionsdir="`add_path "${addictionsdir}" "${nativewd}/${REFERENCE_ADDICTION_SUBDIR}"`"
1089 1095
 
1090 1096
       case "${UNAME}" in
1091 1097
          darwin)
... ...
@@ -1131,6 +1137,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1131 1137
 
1132 1138
       # use absolute paths for configure, safer (and easier to read IMO)
1133 1139
       DEPENDENCIES_DIR="'${dependenciesdir}'" \
1140
+      ADDICTIONS_DIR="'${addictionsdir}'" \
1134 1141
       CC="${C_COMPILER:-${CC}}" \
1135 1142
       CXX="${CXX_COMPILER:-${CXX}}" \
1136 1143
       CFLAGS="${other_cflags}" \
... ...
@@ -31,19 +31,43 @@
31 31
 MULLE_BOOTSTRAP_CLEAN_SH="included"
32 32
 
33 33
 
34
+setup_clean_environment()
35
+{
36
+   [ -z "${DEPENDENCY_SUBDIR}"  ] && internal_fail "DEPENDENCY_SUBDIR is empty"
37
+   [ -z "${CLONESBUILD_SUBDIR}" ] && internal_fail "CLONESBUILD_SUBDIR is empty"
38
+   [ -z "${ADDICTION_SUBDIR}"   ] && internal_fail "ADDICTION_SUBDIR is empty"
34 39
 
35
-clean_usage()
40
+   CLEAN_EMPTY_PARENTS="`read_config_setting "clean_empty_parent_folders" "YES"`"
41
+
42
+   BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_SUBDIR}
43
+${DEPENDENCY_SUBDIR}/tmp"`"
44
+   OUTPUT_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "output_clean_folders" "${DEPENDENCY_SUBDIR}"`"
45
+   INSTALL_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "install_clean_folders" "${CLONES_SUBDIR}
46
+.bootstrap.auto"`"
47
+   DIST_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "dist_clean_folders" "${CLONES_SUBDIR}
48
+${ADDICTION_SUBDIR}
49
+.bootstrap.auto"`"
50
+   EMBEDDED="`embedded_repository_directories_from_repos`"
51
+
52
+   if [ ! -z "$EMBEDDED" ]
53
+   then
54
+      DIST_CLEANABLE_SUBDIRS="${DIST_CLEANABLE_SUBDIRS}
55
+${EMBEDDED}"
56
+   fi
57
+}
58
+
59
+
60
+_clean_usage()
36 61
 {
37
-   cat <<EOF >&2
38
-usage:
39
-   mulle-bootstrap clean [build|dist|install|output]
62
+   setup_clean_environment
40 63
 
64
+   cat <<EOF >&2
41 65
    build   : useful to remove intermediate build files. it cleans
42 66
 ---
43 67
 ${BUILD_CLEANABLE_SUBDIRS}
44 68
 ---
45 69
 
46
-   output  : useful to rebuild. This is the default. It cleans
70
+   output  : useful to rebuild. It cleans
47 71
 ---
48 72
 ${BUILD_CLEANABLE_SUBDIRS}
49 73
 ${OUTPUT_CLEANABLE_SUBDIRS}
... ...
@@ -58,9 +82,21 @@ ${DIST_CLEANABLE_SUBDIRS}
58 82
 
59 83
    install  : useful if you know, you don't want to rebuild ever. It cleans
60 84
 ---
85
+${BUILD_CLEANABLE_SUBDIRS}
61 86
 ${INSTALL_CLEANABLE_SUBDIRS}
62 87
 ---
63 88
 EOF
89
+}
90
+
91
+
92
+clean_usage()
93
+{
94
+   cat <<EOF >&2
95
+usage:
96
+   mulle-bootstrap clean [build|dist|install|output]
97
+
98
+EOF
99
+   _clean_usage
64 100
    exit 1
65 101
 }
66 102
 
... ...
@@ -139,16 +175,16 @@ clean_directories()
139 175
 }
140 176
 
141 177
 
178
+#
179
+# for mingw its faster, if we have separate clean functions
142 180
 #
143 181
 # cleanability is checked, because in some cases its convenient
144 182
 # to have other tools provide stuff besides /include and /lib
145 183
 # and sometimes  projects install other stuff into /share
146
-# for mingw its easier if we have separate clean functions
147 184
 #
148 185
 _clean_execute()
149 186
 {
150 187
    local flag
151
-   local old
152 188
 
153 189
    [ -z "${DEPENDENCY_SUBDIR}"  ] && internal_fail "DEPENDENCY_SUBDIR is empty"
154 190
    [ -z "${CLONESBUILD_SUBDIR}" ] && internal_fail "CLONESBUILD_SUBDIR is empty"
... ...
@@ -237,16 +273,50 @@ clean_main()
237 273
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ] && . mulle-bootstrap-settings.sh
238 274
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
239 275
 
240
-   COMMAND=${1:-"output"}
241
-   [ $# -eq 0 ] || shift
276
+   COMMAND=
277
+
278
+   while [ $# -ne 0 ]
279
+   do
280
+      case "$1" in
281
+         -h|-help|--help)
282
+            COMMAND=help
283
+         ;;
284
+
285
+         -*)
286
+            log_error "unknown option $1"
287
+            COMMAND=help
288
+         ;;
289
+
290
+         *)
291
+            break
292
+         ;;
293
+      esac
294
+
295
+      shift
296
+   done
297
+
298
+   if [ -z "${COMMAND}" ]
299
+   then
300
+      COMMAND=${1:-"output"}
301
+      [ $# -eq 0 ] || shift
302
+   fi
303
+
242 304
 
243 305
    case "$COMMAND" in
244 306
       output|dist|build|install)
245 307
          clean_execute "$@"
246 308
       ;;
247 309
 
310
+      help)
311
+         clean_usage
312
+      ;;
313
+
314
+      _help)
315
+         _clean_usage
316
+      ;;
317
+
248 318
       *)
249
-         log_error "Unknown command \${COMMAND}\""
319
+         log_error "Unknown command \"${COMMAND}\""
250 320
          clean_usage
251 321
       ;;
252 322
    esac
... ...
@@ -250,72 +250,6 @@ check_tars()
250 250
 }
251 251
 
252 252
 
253
-#
254
-# Use gems for stuff we don't tag
255
-#
256
-# install_gems()
257
-# {
258
-#    local gems
259
-#    local gem
260
-
261
-#    log_fluff "Looking for gems"
262
-
263
-#    gems="`read_fetch_setting "gems" | sort | sort -u`"
264
-#    if [ "${gems}" != "" ]
265
-#    then
266
-#       local old
267
-
268
-#       old="${IFS:-" "}"
269
-#       IFS="
270
-# "
271
-#       for gem in ${gems}
272
-#       do
273
-#          IFS="${old}"
274
-#          log_fluff "gem install \"${gem}\""
275
-
276
-#          echo "gem needs sudo to install ${gem}" >&2
277
-#          exekutor sudo gem install "${gem}" || exit 1
278
-#       done
279
-#       IFS="${old}"
280
-#    else
281
-#       log_fluff "No gems found"
282
-#    fi
283
-# }
284
-
285
-
286
-#
287
-# Use pips for stuff we don't tag
288
-#
289
-# install_pips()
290
-# {
291
-#    local pips
292
-#    local pip
293
-
294
-#    log_fluff "Looking for pips"
295
-
296
-#    pips="`read_fetch_setting "pips" | sort | sort -u`"
297
-#    if [ "${pips}" != "" ]
298
-#    then
299
-#       local old
300
-
301
-#       old="${IFS:-" "}"
302
-#       IFS="
303
-# "
304
-#       for pip in ${pips}
305
-#       do
306
-#          IFS="${old}"
307
-#          log_fluff "pip install \"${gem}\""
308
-
309
-#          echo "pip needs sudo to install ${pip}" >&2
310
-#          exekutor sudo pip install "${pip}" || exit 1
311
-#       done
312
-#       IFS="${old}"
313
-#    else
314
-#       log_fluff "No pips found"
315
-#    fi
316
-# }
317
-
318
-
319 253
 #
320 254
 ###
321 255
 #
... ...
@@ -435,7 +369,6 @@ NO is safe, but you often say YES here."
435 369
 }
436 370
 
437 371
 
438
-
439 372
 log_fetch_action()
440 373
 {
441 374
    local url
... ...
@@ -618,6 +551,7 @@ checkout()
618 551
 
619 552
       scmflags="`read_repo_setting "${name}" "checkout" "${scmflagsdefault}"`"
620 553
       "${operation}" "${src}" "${dstdir}" "${branch}" "${tag}" "${scmflags}"
554
+
621 555
       warn_scripts_main "${dstdir}/.bootstrap" "${dstdir}" || fail "Ok, aborted"  #sic
622 556
    fi
623 557
 }
... ...
@@ -664,6 +598,7 @@ did_clone_repository()
664 598
    fetch__run_build_settings_script "${name}" "${url}" "${dstdir}" "did-install" "${dstdir}" "${name}"
665 599
 }
666 600
 
601
+
667 602
 #
668 603
 # Use git clones for stuff that gets tagged
669 604
 # if you specify ../ it will assume you have
... ...
@@ -1425,7 +1360,7 @@ _common_main()
1425 1360
    done
1426 1361
 
1427 1362
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
1428
-   [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ] && . mulle-bootstrap-settings.sh
1363
+   [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
1429 1364
 
1430 1365
    case "${UNAME}" in
1431 1366
       mingw)
... ...
@@ -1437,10 +1372,10 @@ _common_main()
1437 1372
       ;;
1438 1373
    esac
1439 1374
 
1440
-   [ -z "${MULLE_BOOTSTRAP_SCM_SH}" ] && . mulle-bootstrap-scm.sh
1441
-   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
1375
+   [ -z "${MULLE_BOOTSTRAP_SCM_SH}" ]          && . mulle-bootstrap-scm.sh
1376
+   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ]      && . mulle-bootstrap-scripts.sh
1442 1377
    [ -z "${MULLE_BOOTSTRAP_WARN_SCRIPTS_SH}" ] && . mulle-bootstrap-warn-scripts.sh
1443
-   [ -z "${MULLE_BOOTSTRAP_AUTO_UPDATE_SH}" ] && . mulle-bootstrap-auto-update.sh
1378
+   [ -z "${MULLE_BOOTSTRAP_AUTO_UPDATE_SH}" ]  && . mulle-bootstrap-auto-update.sh
1444 1379
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
1445 1380
 
1446 1381
    #
... ...
@@ -346,7 +346,7 @@ realpath()
346 346
 # stolen from: https://stackoverflow.com/questions/2564634/convert-absolute-path-into-relative-path-given-a-current-directory-using-bash
347 347
 # because the python dependency irked me
348 348
 #
349
-_relative_path_between()
349
+__relative_path_between()
350 350
 {
351 351
     [ $# -ge 1 ] && [ $# -le 2 ] || return 1
352 352
 
... ...
@@ -377,6 +377,23 @@ _relative_path_between()
377 377
 }
378 378
 
379 379
 
380
+_relative_path_between()
381
+{
382
+   local a
383
+   local b
384
+
385
+   # remove trailing '/' it upsets the code
386
+
387
+   a="`echo "$1" | sed -e 's|/$||g'`"
388
+   b="`echo "$2" | sed -e 's|/$||g'`"
389
+
390
+   [ -z "${a}" ] && internal_fail "Empty path (\$1)"
391
+   [ -z "${b}" ] && internal_fail "Empty path (\$2)"
392
+
393
+   __relative_path_between "${b}" "${a}"   # flip args (historic)
394
+}
395
+
396
+
380 397
 #
381 398
 # $1 is the directory, that we want to access relative from root
382 399
 # $2 is the root
... ...
@@ -385,24 +402,20 @@ _relative_path_between()
385 402
 # ex.   /usr/include /  -> /usr/include
386 403
 #
387 404
 # the routine can not deal with ../ and ./
405
+# but is a bit faster than perfect_relative_path_between
406
+# which uses simplify_path
388 407
 #
389 408
 relative_path_between()
390 409
 {
391 410
    local  a
392 411
    local  b
393 412
 
394
-   # remove trailing '/' it upsets the code
395
-
396
-   a="`echo "$1" | sed -e 's|/$||g'`"
397
-   b="`echo "$2" | sed -e 's|/$||g'`"
413
+   a="$1"
414
+   b="$2"
398 415
 
399 416
    # the function can't do mixed paths
400 417
 
401 418
    case "${a}" in
402
-      "")
403
-         internal_fail "Empty path"
404
-      ;;
405
-
406 419
       ../*|*/..|*/../*|..)
407 420
          internal_fail "Path \"${a}\" mustn't contain ../"
408 421
       ;;
... ...
@@ -414,10 +427,6 @@ relative_path_between()
414 427
 
415 428
       /*)
416 429
          case "${b}" in
417
-            "")
418
-               internal_fail "Empty path"
419
-            ;;
420
-
421 430
             ../*|*/..|*/../*|..)
422 431
                internal_fail "Path \"${b}\" mustn't contain ../"
423 432
             ;;
... ...
@@ -438,10 +447,6 @@ relative_path_between()
438 447
 
439 448
       *)
440 449
          case "${b}" in
441
-            "")
442
-               internal_fail "Empty path"
443
-            ;;
444
-
445 450
             ../*|*/..|*/../*|..)
446 451
                internal_fail "Path \"${b}\" mustn't contain ../"
447 452
             ;;
... ...
@@ -460,10 +465,15 @@ relative_path_between()
460 465
       ;;
461 466
    esac
462 467
 
463
-   _relative_path_between "${b}" "${a}"
468
+   _relative_path_between "${a}" "${b}"
464 469
 }
465 470
 
466 471
 
472
+
473
+#
474
+# compute number of .. needed to return from path
475
+# e.g.  cd "a/b/c" -> cd ../../..
476
+#
467 477
 compute_relative()
468 478
 {
469 479
    local depth
... ...
@@ -528,6 +538,23 @@ absolutepath()
528 538
 }
529 539
 
530 540
 
541
+#
542
+# this does relative_path_between perfectly
543
+# but its much slower than relative_path_between
544
+#
545
+perfect_relative_path_between()
546
+{
547
+   local a
548
+   local b
549
+
550
+   a="`absolutepath "$1"`"
551
+   b="`absolutepath "$2"`"
552
+
553
+   _relative_path_between "${a}" "${b}"
554
+}
555
+
556
+
557
+
531 558
 escaped_spaces()
532 559
 {
533 560
    echo "$1" | sed 's/ /\\ /g'
... ...
@@ -35,8 +35,9 @@ init_usage()
35 35
 {
36 36
     cat <<EOF >&2
37 37
 usage:
38
-  mulle_bootstrap init [options]
38
+  mulle-bootstrap init [options]
39 39
 
40
+  Options
40 41
     -n :  don't ask for editor
41 42
     -e :  create example files
42 43
 EOF
... ...
@@ -90,7 +91,6 @@ init_main()
90 91
       shift
91 92
    done
92 93
 
93
-
94 94
    if [ -d "${BOOTSTRAP_SUBDIR}" ]
95 95
    then
96 96
       log_warning "\"${BOOTSTRAP_SUBDIR}\" already exists"
... ...
@@ -102,9 +102,10 @@ local_environment_initialize()
102 102
            MULLE_BOOTSTRAP_VERBOSE="YES"
103 103
          fi
104 104
 
105
-         if [ -z "${MULLE_BOOTSTRAP_SKIP_INITIAL_REFRESH}" ]
105
+         # be optimistic because it's too slow on windows
106
+         if [ -z "${MULLE_BOOTSTRAP_OPTIMISTIC}" ]
106 107
          then
107
-           MULLE_BOOTSTRAP_SKIP_INITIAL_REFRESH="YES"
108
+           MULLE_BOOTSTRAP_OPTIMISTIC="YES"
108 109
          fi
109 110
 
110 111
          PATH_SEPARATOR=';'
111 112
deleted file mode 100644
... ...
@@ -1,107 +0,0 @@
1
-#! /bin/sh
2
-#
3
-#   Copyright (c) 2016 Nat! - Mulle kybernetiK
4
-#   All rights reserved.
5
-#
6
-#   Redistribution and use in source and binary forms, with or without
7
-#   modification, are permitted provided that the following conditions are met:
8
-#
9
-#   Redistributions of source code must retain the above copyright notice, this
10
-#   list of conditions and the following disclaimer.
11
-#
12
-#   Redistributions in binary form must reproduce the above copyright notice,
13
-#   this list of conditions and the following disclaimer in the documentation
14
-#   and/or other materials provided with the distribution.
15
-#
16
-#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
-#   may be used to endorse or promote products derived from this software
18
-#   without specific prior written permission.
19
-#
20
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
-#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
-#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
-#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
-#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
-#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
-#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
-#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
-#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
-#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
-#
31
-MULLE_BOOTSTRAP_PROJECT_SH="included"
32
-
33
-
34
-project_usage()
35
-{
36
-   cat <<EOF >&2
37
-usage:
38
-   mulle-bootstrap project <clone|build|install> <options>
39
-
40
-   clone   : clone a remote git repoistory and try to build something
41
-   build   : execute ./build.sh, if missing do a mulle-bootstrap build
42
-   install : execute ./install.sh, if missing execute ./build.sh install
43
-EOF
44
-   exit 1
45
-}
46
-
47
-
48
-project_main()
49
-{
50
-   local command
51
-
52
-   if [ "$1" = "" -o "$1" = "-h" -o "$1" = "--help" ]
53
-   then
54
-      project_usage
55
-   fi
56
-
57
-   command="$1"
58
-   case  "${command}" in
59
-      http:*|https:*)
60
-         command="clone";
61
-         ;;
62
-      *)
63
-         [ $# -eq 0 ] || shift
64
-         ;;
65
-   esac
66
-
67
-   case  "${command}" in
68
-   clone)
69
-      set -e
70
-      git clone "$1"
71
-      cd "`basename -- "$1"`"
72
-      mulle-bootstrap-fetch.sh || exit 1
73
-      if [ -x "./build.sh" ]
74
-      then
75
-         ./build.sh
76
-      else
77
-         COMMAND="install" mulle-bootstrap-build.sh || exit 1
78
-      fi
79
-      ;;
80
-
81
-   build)
82
-      if [ -x "./build.sh" ]
83
-      then
84
-         ./build.sh
85
-      fi
86
-      ;;
87
-
88
-   install)
89
-      if [ -x "./install.sh" ]
90
-      then
91
-         ./install.sh
92
-      else
93
-         if [ -x "./build.sh" ]
94
-         then
95
-            ./build.sh install
96
-         fi
97
-      fi
98
-      ;;
99
-
100
-   *)
101
-      log_error "unknown command \"${command}\""
102
-      project_usage
103
-      ;;
104
-
105
-   esac
106
-}
107
-
... ...
@@ -31,6 +31,16 @@
31 31
 MULLE_BOOTSTRAP_SETTINGS_SH="included"
32 32
 
33 33
 
34
+config_usage()
35
+{
36
+    cat <<EOF >&2
37
+usage:
38
+   mulle-bootstrap config <name> [value]
39
+EOF
40
+  exit 1
41
+}
42
+
43
+
34 44
 warn_user_setting()
35 45
 {
36 46
    local file
... ...
@@ -680,6 +690,112 @@ ${keys6}" | sort | sort -u | egrep -v '^[ ]*$'
680 690
    return 0
681 691
 }
682 692
 
693
+#
694
+# "config" interface sorta like git config
695
+# obviously need to "vet" the keys sometime
696
+#
697
+config_read()
698
+{
699
+   read_config_setting "$1"
700
+}
701
+
702
+
703
+config_write()
704
+{
705
+   mkdir_if_missing "${BOOTSTRAP_SUBDIR}.local/config"
706
+   exekutor echo "$2" > "${BOOTSTRAP_SUBDIR}.local/config/$1"
707
+}
708
+
709
+
710
+config_delete()
711
+{
712
+   if [ -f "${BOOTSTRAP_SUBDIR}.local/config/$1" ]
713
+   then
714
+      exekutor rm "${BOOTSTRAP_SUBDIR}.local/config/$1"
715
+   fi
716
+}
717
+
718
+
719
+
720
+config_main()
721
+{
722
+   local name
723
+   local value
724
+   local command
725
+
726
+   command="read"
727
+
728
+   while [ $# -ne 0 ]
729
+   do
730
+      case "$1" in
731
+         -h|-help|--help)
732
+            config_usage
733
+         ;;
734
+
735
+         -d)
736
+            command="delete"
737
+         ;;
738
+
739
+         -n|--off|--no|--NO)
740
+            command="write"
741
+            value="NO"
742
+         ;;
743
+
744
+         -y|--on|--yes|--YES)
745
+            command="write"
746
+            value="YES"
747
+         ;;
748
+
749
+         -*)
750
+            log_error "unknown option $1"
751
+            config_usage
752
+         ;;
753
+
754
+         *)
755
+            break
756
+         ;;
757
+      esac
758
+
759
+      shift
760
+   done
761
+
762
+   name="$1"
763
+   [ $# -ne 0 ] && shift
764
+
765
+   if [ -z "${name}" ]
766
+   then
767
+      config_usage
768
+   fi
769
+
770
+   if [ $# -ne 0 ]
771
+   then
772
+      [ "${command}" != "read" ] && config_usage
773
+
774
+      command="write"
775
+      value="$1"
776
+      shift
777
+   fi
778
+
779
+   [ -z "${MULLE_BOOTSTRAP_REFRESH_SH}" ] && . mulle-bootstrap-refresh.sh
780
+
781
+   case "${command}" in
782
+      read)
783
+         config_read "${name}"
784
+      ;;
785
+
786
+      delete)
787
+         config_delete "${name}"
788
+         refresh_main || exit 1
789
+      ;;
790
+
791
+      write)
792
+         config_write "${name}" "${value}"
793
+         refresh_main || exit 1
794
+
795
+      ;;
796
+   esac
797
+}
798
+
683 799
 
684 800
 # read some config stuff now
685 801
 
... ...
@@ -34,15 +34,23 @@ MULLE_BOOTSTRAP_WARN_SCRIPTS_SH="included"
34 34
 
35 35
 warn_scripts()
36 36
 {
37
+   local bootstrapdir
38
+   local repodir
39
+
40
+   bootstrapdir="$1"
41
+   repodir="$2"
42
+
37 43
    local scripts
38 44
    local phases
39 45
    local ack
40 46
    local i
41 47
    local old
42 48
 
43
-   if [ -d "$1" ]
49
+   log_info "warn_scripts $1:$2:${DONT_ASK_AFTER_WARNING}:${MULLE_BOOTSTRAP_ANSWER}"
50
+
51
+   if [ -d "${bootstrapdir}" ]
44 52
    then
45
-      scripts="`find "$1" -name "*.sh" \( -perm +u+x -o -perm +g+x -o -perm +o+x \) -type f -print`"
53
+      scripts="`find "${bootstrapdir}" -name "*.sh" \( -perm +u+x -o -perm +g+x -o -perm +o+x \) -type f -print`"
46 54
       if [ ! -z "${scripts}" ]
47 55
       then
48 56
          log_warning "this .bootstrap contains shell scripts:"
... ...
@@ -64,14 +72,14 @@ warn_scripts()
64 72
 
65 73
    case "${UNAME}" in
66 74
       darwin)
67
-         if [ ! -z "$2" ]
75
+         if [ ! -z "${repodir}" ]
68 76
          then
69
-             exekutor [ -e "$2" ] || fail "Expected directory \"$2\" is missing.
77
+             exekutor [ -e "${repodir}" ] || fail "Expected directory \"${repodir}\" is missing.
70 78
 (hint: use fetch instead of update to track renames)"
71 79
 
72
-            if dir_has_files "$2"
80
+            if dir_has_files "${repodir}"
73 81
             then
74
-               phases="`(find "$2"/* -name "project.pbxproj" -exec grep -q 'PBXShellScriptBuildPhase' '{}' \; -print)`"
82
+               phases="`(find "${repodir}"/* -name "project.pbxproj" -exec grep -q 'PBXShellScriptBuildPhase' '{}' \; -print)`"
75 83
                if [ ! -z "${phases}" ]
76 84
                then
77 85
                   log_warning "This repository contains xcode projects with shellscript phases"
... ...
@@ -97,21 +105,25 @@ warn_scripts()
97 105
       ;;
98 106
    esac
99 107
 
100
-   if  [ "${DONT_ASK_AFTER_WARNING}" != "YES" ]
108
+   if [ -z "$phases" -a -z "$scripts" ]
101 109
    then
102
-      if [ "$phases" != "" -o "$scripts" != "" ]
103
-      then
104
-         user_say_yes "You should probably inspect them before continuing.
110
+      return 0
111
+   fi
112
+
113
+   if [ "${DONT_ASK_AFTER_WARNING}" = "YES" ]
114
+   then
115
+      return 0
116
+   fi
117
+
118
+   user_say_yes "You should probably inspect them before continuing.
105 119
 Abort now ?"
106
-         if [ $? -eq 0 ]
107
-         then
108
-             log_error "The bootstrap is in an inconsistent state. It would be good
120
+   if [ $? -eq 0 ]
121
+   then
122
+       log_error "The bootstrap is in an inconsistent state. It would be good
109 123
 to run
110
-           ${C_RESET}mulle-bootstrap clean dist${C_ERROR}
124
+     ${C_RESET}mulle-bootstrap clean dist${C_ERROR}
111 125
 now."
112
-             return 1
113
-         fi
114
-      fi
126
+       return 1
115 127
    fi
116 128
 }
117 129
 
... ...
@@ -124,11 +136,19 @@ warn_scripts_main()
124 136
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
125 137
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ] && . mulle-bootstrap-settings.sh
126 138
 
127
-   if [ "${MULLE_BOOTSTRAP_ANSWER}" != "YES"  ]
139
+   local  dont_warn_scripts
140
+
141
+   #
142
+   # if MULLE_BOOTSTRAP_ANSWER is YES
143
+   # then don't warn either
144
+   #
145
+   dont_warn_scripts="`read_config_setting "dont_warn_scripts" "${MULLE_BOOTSTRAP_ANSWER:-NO}"`"
146
+
147
+   if [ "${dont_warn_scripts}" = "YES"  ]
128 148
    then
129
-      warn_scripts "$@"
149
+      log_verbose "Script checking disabled"
130 150
    else
131
-      log_verbose "Script checking by autoanswer YES disabled"
151
+      warn_scripts "$@"
132 152
    fi
133 153
 
134 154
    log_fluff "::: warn_scripts end :::"