Browse code

Add code so that you can remove repos from gits and they won't be compiled anymore.

Nat! authored on 29-09-2015 15:11:47
Showing 5 changed files
... ...
@@ -60,14 +60,10 @@ bootstrap()
60 60
    then
61 61
       . install.sh "$@"
62 62
       export MULLE_BOOTSTRAP=mulle-bootstrap
63
+   else
64
+      warn_scripts "${BOOTSTRAP_SUBDIR}"  || exit 1
63 65
    fi
64 66
 
65
-   #
66
-   # should run a script, where we test the project.pbxproj for
67
-   # script phases too
68
-   #
69
-   warn_scripts "${BOOTSTRAP_SUBDIR}" "." || exit 1
70
-
71 67
    if [ "${DONT_RECURSE}" = "" ]
72 68
    then
73 69
       mulle-bootstrap-fetch.sh "$@" || exit 1
... ...
@@ -124,6 +124,9 @@ determine_suffix()
124 124
    configuration="$1"
125 125
    sdk="$2"
126 126
 
127
+   [ ! -z $configuration ] || fail "configuration must not be empty"
128
+   [ ! -z $sdk ] || fail "sdk must not be empty"
129
+
127 130
    suffix="/${configuration}"
128 131
    if [ "${sdk}" != "Default" ]
129 132
    then
... ...
@@ -380,6 +383,8 @@ build_xcodebuild()
380 383
    [ -z "${sdk}" ]         && internal_fail "sdk is empty"
381 384
    [ -z "${project}" ]     && internal_fail "project is empty"
382 385
 
386
+   log_info "Do a xcodebuild for SDK ${sdk}, ${targetname}${schemename}..."
387
+
383 388
    local projectname
384 389
 
385 390
     # always pass project directly
... ...
@@ -546,26 +551,43 @@ build_xcodebuild()
546 551
       # TODO: need to figure out the correct mapping here
547 552
       #
548 553
       inherited=`xcode_get_setting HEADER_SEARCH_PATHS "${mapped}" $project $scheme $target`
549
-      dependencies_header_search_path="HEADER_SEARCH_PATHS=\
550
-${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH} \
551
-/usr/local/include \
552
-${inherited}"
554
+      dependencies_header_search_path="HEADER_SEARCH_PATHS="
555
+      dependencies_header_search_path="${dependencies_header_search_path} \
556
+         ${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH}"
557
+      dependencies_header_search_path="${dependencies_header_search_path} \
558
+         /usr/local/include"
559
+      dependencies_header_search_path="${dependencies_header_search_path} \
560
+         ${inherited}"
553 561
 
554 562
       inherited=`xcode_get_setting LIBRARY_SEARCH_PATHS "${mapped}" $project $scheme $target`
555
-      dependencies_lib_search_path="LIBRARY_SEARCH_PATHS=\
556
-${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mapped}-\$(EFFECTIVE_PLATFORM_NAME) \
557
-${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mapped} \
558
-${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH} \
559
-/usr/local/lib \
560
-${inherited}"
563
+      dependencies_lib_search_path="LIBRARY_SEARCH_PATHS="
564
+      if [ ! -z $sdk ]
565
+      then
566
+         dependencies_lib_search_path="${dependencies_lib_search_path} \
567
+            ${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mapped}-\$(EFFECTIVE_PLATFORM_NAME)"
568
+      fi
569
+      dependencies_lib_search_path="${dependencies_lib_search_path} \
570
+         ${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mapped}"
571
+      dependencies_lib_search_path="${dependencies_lib_search_path} \
572
+         ${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}"
573
+      dependencies_lib_search_path="${dependencies_lib_search_path} \
574
+         /usr/local/lib"
575
+      dependencies_lib_search_path="${dependencies_lib_search_path} \
576
+         ${inherited}"
561 577
 
562 578
       inherited=`xcode_get_setting FRAMEWORK_SEARCH_PATHS "${mapped}" $project $scheme $target`
563
-      dependencies_framework_search_path="FRAMEWORK_SEARCH_PATHS=\
564
-${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mapped}-\$(EFFECTIVE_PLATFORM_NAME) \
565
-${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mapped} \
566
-${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
567
-/usr/local/lib \
568
-${inherited}"
579
+      dependencies_framework_search_path="FRAMEWORK_SEARCH_PATHS="
580
+      if [ ! -z $sdk ]
581
+      then
582
+         dependencies_framework_search_path="${dependencies_framework_search_path} \
583
+            ${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mapped}-\$(EFFECTIVE_PLATFORM_NAME)"
584
+      fi
585
+      dependencies_framework_search_path="${dependencies_framework_search_path} \
586
+         ${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mapped}"
587
+      dependencies_framework_search_path="${dependencies_framework_search_path} \
588
+         ${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}"
589
+      dependencies_framework_search_path="${dependencies_framework_search_path} \
590
+         ${inherited}"
569 591
 
570 592
       set -f
571 593
       set +x
... ...
@@ -671,6 +693,8 @@ Release"`
671 693
    sdks=`read_build_root_setting "sdks" "Default"`
672 694
    [ -z "${sdks}" ] && fail "setting \"sdks\" must at least contain \"Default\" to build anything"
673 695
 
696
+   log_info "building ${srcdir} ..." >&2
697
+
674 698
    for sdk in ${sdks}
675 699
    do
676 700
       for configuration in ${configurations}
... ...
@@ -745,6 +769,31 @@ Release"`
745 769
 }
746 770
 
747 771
 
772
+build_if_readable()
773
+{
774
+   local clone
775
+   local name
776
+   local xdone
777
+
778
+   clone="$1"
779
+   name="$2"
780
+   built="$3"
781
+
782
+   if [ ! -r "${clone}" ]
783
+   then
784
+      echo "ignoring orphaned repo ${name}" >&2
785
+   else
786
+      xdone=`/bin/echo "${built}" | grep "${name}"`
787
+      if [ "$xdone" = "" ]
788
+      then
789
+         build "${clone}"
790
+         echo "${name}
791
+${built}"
792
+      fi
793
+   fi
794
+}
795
+
796
+
748 797
 build_clones()
749 798
 {
750 799
    local clone
... ...
@@ -775,19 +824,14 @@ build_clones()
775 824
    if [ "$#" -eq 0 ]
776 825
    then
777 826
       built=`read_build_root_setting "buildignore"`
827
+
778 828
       for name in `read_build_root_setting "buildorder"`
779 829
       do
780 830
          clone="${CLONES_SUBDIR}/${name}"
781 831
 
782 832
          if [ -d "${clone}" ]
783 833
          then
784
-            xdone=`/bin/echo "${built}" | grep "${name}"`
785
-            if [ "$xdone" = "" ]
786
-            then
787
-               build "${clone}"
788
-               built="${name}
789
-${built}"
790
-            fi
834
+            built=`build_if_readable "${clone}" "${name}" "${built}"`
791 835
          else
792 836
             fail "buildorder contains unknown repo ${name}"
793 837
          fi
... ...
@@ -799,13 +843,7 @@ ${built}"
799 843
 
800 844
          if [ -d "${clone}" ]
801 845
          then
802
-            xdone=`/bin/echo "${built}" | grep "${name}"`
803
-            if [ "$xdone" = "" ]
804
-            then
805
-               build "${clone}"
806
-               built="${name}
807
-${built}"
808
-            fi
846
+            built=`build_if_readable "${clone}" "${name}" "${built}"`
809 847
          fi
810 848
       done
811 849
    else
... ...
@@ -813,13 +851,7 @@ ${built}"
813 851
       do
814 852
          clone="${CLONES_SUBDIR}/${name}"
815 853
 
816
-         xdone=`/bin/echo "${built}" | grep "${name}"`
817
-         if [ "$xdone" = "" ]
818
-         then
819
-            build "${clone}"
820
-            built="${name}
821
-${built}"
822
-         fi
854
+         built=`build_if_readable "${clone}" "${name}" "${built}"`
823 855
       done
824 856
    fi
825 857
 }
... ...
@@ -410,6 +410,18 @@ clone_repositories()
410 410
 
411 411
    cmd="$1"
412 412
 
413
+   # first mark all repos as stale
414
+   if dir_has_files "${CLONES_FETCH_SUBDIR}"
415
+   then
416
+      for i in `ls -1d "${CLONES_FETCH_SUBDIR}/"*`
417
+      do
418
+         if [ -d "${i}" -o -L "${i}" ]
419
+         then
420
+            chmod -h 000 "${i}"
421
+         fi
422
+      done
423
+   fi
424
+
413 425
    stop=0
414 426
    while [ $stop -eq 0 ]
415 427
    do
... ...
@@ -435,6 +447,18 @@ clone_repositories()
435 447
 
436 448
             dstname="${CLONES_FETCH_SUBDIR}/${name1}"
437 449
 
450
+            local permission
451
+
452
+            # mark as alive
453
+            if [ -d "${dstname}" -o -L "${dstname}" ] && [ ! -r "${dstname}" ]
454
+            then
455
+               permission=`lso "${CLONES_FETCH_SUBDIR}"`
456
+               [ ! -z "$permission" ] || fail "failed to get permission of ${CLONES_FETCH_SUBDIR}"
457
+               chmod -h "${permission}" "${dstname}"
458
+            fi
459
+
460
+            log_info "Checking ${clone} in ${dstname} ..."
461
+
438 462
             case "${cmd}" in
439 463
                install)
440 464
                   if [ ! -e "${dstname}" ]
... ...
@@ -587,3 +587,19 @@ ${keys6}" | sort | sort -u | egrep -v '^[ ]*$'
587 587
 }
588 588
 
589 589
 
590
+# http://askubuntu.com/questions/152001/how-can-i-get-octal-file-permissions-from-command-line
591
+lso()
592
+{
593
+   ls -aldG "$@" | \
594
+   awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(" %0o ",k);print }' | \
595
+   awk '{print $1}'
596
+}
597
+
598
+
599
+log_info()
600
+{
601
+   if [ "$MULLE_BOOTSTRAP_TERSE" != "YES" ]
602
+   then
603
+      echo "$@" >&2
604
+   fi
605
+}
590 606
\ No newline at end of file
... ...
@@ -62,8 +62,6 @@ warn_scripts()
62 62
    local ack
63 63
    local i
64 64
 
65
-   [ $# = 2 ] || echo "internal error" || exit 1
66
-
67 65
    if [ -d "$1" ]
68 66
    then
69 67
       scripts=`find "$1" -name "*.sh" \( -perm +u+x -o -perm +g+x -o -perm +o+x \) -type f -print`
... ...
@@ -81,24 +79,26 @@ warn_scripts()
81 79
       fi
82 80
    fi
83 81
 
84
-   [ -e "$2" ] ||  fail "internal error, expected directory missing"
85
-
86
-
87
-   if private_dir_has_files "$2"
82
+   if [ ! -z $2 ]
88 83
    then
89
-      phases=`(find "$2"/* -name "project.pbxproj" -exec grep -q 'PBXShellScriptBuildPhase' '{}'  \; -print)`
90
-      if [ "$phases" != "" ]
84
+      [ -e "$2" ] ||  fail "internal error, expected directory missing"
85
+
86
+      if private_dir_has_files "$2"
91 87
       then
92
-         echo "this repository contains xcode projects with shellscript phases" >&2
93
-         ack=`which ack`
94
-         if [ "$ack" = "" ]
88
+         phases=`(find "$2"/* -name "project.pbxproj" -exec grep -q 'PBXShellScriptBuildPhase' '{}'  \; -print)`
89
+         if [ "$phases" != "" ]
95 90
          then
96
-            echo "brew install ack ; ack -A1 \"shellPath|shellScript\"" >&2
97
-            echo "$phases" >&2
98
-         else
99
-            ack -A1 "shellPath|shellScript" `echo $phases | tr '\n' ' '` >&2
91
+            echo "this repository contains xcode projects with shellscript phases" >&2
92
+            ack=`which ack`
93
+            if [ "$ack" = "" ]
94
+            then
95
+               echo "brew install ack ; ack -A1 \"shellPath|shellScript\"" >&2
96
+               echo "$phases" >&2
97
+            else
98
+               ack -A1 "shellPath|shellScript" `echo $phases | tr '\n' ' '` >&2
99
+            fi
100
+            echo "" >&2
100 101
          fi
101
-         echo "" >&2
102 102
       fi
103 103
    fi
104 104