... | ... |
@@ -10,12 +10,11 @@ function fgfs () { |
10 | 10 |
case $1 in |
11 | 11 |
fgaddon) |
12 | 12 |
DB=$FGADDON/fgaddon.db $HOME/.fgfs/fgaddon |
13 |
- ;; |
|
13 |
+ ;; |
|
14 |
+ check) |
|
15 |
+ test -r $HOME/.fgfs/jenkins-status && bash $HOME/.fgfs/jenkins-status |
|
16 |
+ ;; |
|
14 | 17 |
data) |
15 |
- typeset -A control_system_data=( |
|
16 |
- git pull |
|
17 |
- svn up |
|
18 |
- ) |
|
19 | 18 |
for control_system update_command in ${(kv)control_system_data}; do |
20 | 19 |
find $FGADDON \ |
21 | 20 |
-maxdepth 3 \ |
... | ... |
@@ -25,57 +24,56 @@ function fgfs () { |
25 | 24 |
-printf "\n[ %h ]\n" \ |
26 | 25 |
-execdir ${control_system} ${update_command} \; |
27 | 26 |
done |
28 |
- unset control_system_data control_system update_command |
|
29 | 27 |
;; |
30 | 28 |
source) |
31 |
- typeset -A control_system_data=( |
|
32 |
- git pull |
|
33 |
- svn up |
|
34 |
- ) |
|
35 |
- for control_system update_command in ${(kv)control_system_data}; do |
|
36 |
- find $fgfs_source \ |
|
37 |
- -maxdepth 2 \ |
|
38 |
- -mindepth 1 \ |
|
39 |
- -type d \ |
|
40 |
- -name .${control_system} \ |
|
41 |
- -printf "\n[ %h ]\n" \ |
|
42 |
- -execdir ${control_system} ${update_command} \; |
|
29 |
+ for component in $(<$fgfs_source/.$2); do |
|
30 |
+ for control_system update_command in ${(kv)control_system_data}; do |
|
31 |
+ find $fgfs_source/$component \ |
|
32 |
+ -maxdepth 1 \ |
|
33 |
+ -type d \ |
|
34 |
+ -name .${control_system} \ |
|
35 |
+ -printf "\n[ %h ]\n" \ |
|
36 |
+ -execdir ${control_system} ${update_command} \; |
|
37 |
+ done |
|
43 | 38 |
done |
44 |
- unset control_system_data control_system update_command |
|
45 | 39 |
;; |
46 |
- check) |
|
47 |
- test -r $HOME/.fgfs/jenkins-status && bash $HOME/.fgfs/jenkins-status;; |
|
48 | 40 |
build) |
49 |
- test -r $fgfs_source/.$2 || return 1 |
|
50 | 41 |
local simultaneous=$(nproc) |
51 | 42 |
local previously_installed=() |
52 | 43 |
mkdir -p $fgfs_install |
53 | 44 |
for component in $(<$fgfs_source/.$2); do |
54 |
-# TODO: prendre en compte les cas sans cmake |
|
55 |
- title="*** $component:u ***" |
|
45 |
+ if test -d $fgfs_source/$component/.git; then |
|
46 |
+ local branch=$(git -C $fgfs_source/$component name-rev --name-only --no-undefined --always HEAD) |
|
47 |
+ elif test -d $fgfs_source/${component}/.svn; then |
|
48 |
+ local branch=${${(s:/:)$(svn info --show-item relative-url $fgfs_source/$component)}[2]} |
|
49 |
+ fi |
|
50 |
+ title="*** ${component:u}${branch:+ [$branch]} ***" |
|
56 | 51 |
printf "\n%s\n%s\n%s\n" "${(l:${#title}::*:)}" "$title" "${(l:${#title}::*:)}" |
57 | 52 |
|
58 |
- local cmake_options=("-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=$fgfs_install/$component") |
|
59 |
- test -e $fgfs_source/${component}.specific && source $fgfs_source/${component}.specific |
|
60 |
- if test ${#previously_installed[@]} -gt 0; then |
|
61 |
- cmake_options+=(${(j. .)${:--DCMAKE_PREFIX_PATH=$fgfs_install/${^previously_installed}}}) |
|
62 |
- cmake_options+=(${(j. .)${:--DCMAKE_INCLUDE_PATH=$fgfs_install/${^previously_installed}/include}}) |
|
63 |
- fi |
|
64 |
- cmake_options+=("-j$simultaneous") |
|
53 |
+# TODO: prendre en compte les cas sans cmake |
|
54 |
+ if test -r $fgfs_source/$component/CMakeLists.txt; then |
|
55 |
+ local cmake_options=("-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=$fgfs_install/$component") |
|
56 |
+ test -e $fgfs_source/${component}.specific && source $fgfs_source/${component}.specific |
|
57 |
+ if test ${#previously_installed[@]} -gt 0; then |
|
58 |
+ cmake_options+=(${(j. .)${:--DCMAKE_PREFIX_PATH=$fgfs_install/${^previously_installed}}}) |
|
59 |
+ cmake_options+=(${(j. .)${:--DCMAKE_INCLUDE_PATH=$fgfs_install/${^previously_installed}/include}}) |
|
60 |
+ fi |
|
61 |
+ cmake_options+=("-j$simultaneous") |
|
65 | 62 |
|
66 |
- mkdir -p $fgfs_build/$component |
|
67 |
- cd $fgfs_build/$component |
|
63 |
+ mkdir -p $fgfs_build/$component |
|
64 |
+ cd $fgfs_build/$component |
|
68 | 65 |
|
69 |
- echo cmake ${cmake_options[@]} $fgfs_source/$component |
|
70 |
- |
|
71 |
- cmake ${cmake_options[@]} $fgfs_source/$component > /dev/null \ |
|
72 |
- && make -j$simultaneous > /dev/null \ |
|
73 |
- && make install \ |
|
74 |
- || { |
|
75 |
- echo "erreur construction $component" |
|
76 |
- cd $FGDIR |
|
77 |
- return |
|
78 |
- } |
|
66 |
+ echo cmake ${cmake_options[@]} $fgfs_source/$component |
|
67 |
+ |
|
68 |
+ cmake ${cmake_options[@]} $fgfs_source/$component > /dev/null \ |
|
69 |
+ && make -j$simultaneous > /dev/null \ |
|
70 |
+ && make install \ |
|
71 |
+ || { |
|
72 |
+ echo "erreur construction $component" |
|
73 |
+ cd $FGDIR |
|
74 |
+ return |
|
75 |
+ } |
|
76 |
+ fi |
|
79 | 77 |
|
80 | 78 |
previously_installed+=($component) |
81 | 79 |
cd - |
... | ... |
@@ -182,11 +180,30 @@ function fgfs () { |
182 | 180 |
######## AUTRE OPTION |
183 | 181 |
else |
184 | 182 |
case $fgfs_arg in |
185 |
- --update(-data|-source|-build|-fgaddon|-check|)) |
|
183 |
+ --update(-data|-source|-build|)) |
|
184 |
+ if test -z "$2" || test ! -r $fgfs_source/.$2; then |
|
185 |
+ echo "${2:+unknown set $2\n}usage: --update|--update-data|--update-source|--update-build <set>" |
|
186 |
+ echo "available sets :" ${$(find $fgfs_source -maxdepth 1 -type f -name ".*" -printf "%f ")//#.} |
|
187 |
+ return 1 |
|
188 |
+ fi |
|
189 |
+ for component in $(<$fgfs_source/.$2); do |
|
190 |
+ if ! test -d $fgfs_source/$component; then |
|
191 |
+ echo component $component not found |
|
192 |
+ return 1 |
|
193 |
+ fi |
|
194 |
+ done |
|
195 |
+ typeset -A control_system_data=( |
|
196 |
+ git pull |
|
197 |
+ svn up |
|
198 |
+ ) |
|
186 | 199 |
for up in ${${=${fgfs_arg#--update}:-data source build}#-}; do |
187 | 200 |
update_fg $up ${2:-flightgear} |
188 | 201 |
done |
189 |
- unset up |
|
202 |
+ unset control_system_data control_system update_command up |
|
203 |
+ return |
|
204 |
+ ;; |
|
205 |
+ --update-(fgaddon|check)) |
|
206 |
+ update_fg ${fgfs_arg#--update-} |
|
190 | 207 |
return |
191 | 208 |
;; |
192 | 209 |
--(show-aircraft|help)) |