Changeset 215 for palm/trunk/SCRIPTS/mbuild
- Timestamp:
- Nov 18, 2008 9:54:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/mbuild
r210 r215 95 95 # ({mainprog}_current_version) 96 96 # 02/10/08 - Siggi - adapted for lcxt4 97 # 14/11/08 - Siggi - update mechanism completely revised: source tarfile 98 # remains in source directory, one depository per block 99 # (given in the config-file) is created, always all files 100 # from the source directory are copied to the respective 101 # depository, no additional file checks are done any more 102 # (version 2.1) 97 103 98 104 … … 121 127 typeset -L50 column2 122 128 typeset -L70 column3 123 typeset -L40 version="MBUILD 2. 0Rev$Rev$"129 typeset -L40 version="MBUILD 2.1 Rev$Rev$" 124 130 125 131 # FEHLERBEHANDLUNG … … 141 147 142 148 149 tmp_mbuild=${working_directory}/tmp_mbuild 143 150 144 151 # SHELLSCRIPT-OPTIONEN EINLESEN … … 187 194 # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN 188 195 line="" 189 grep "%host_identifier" $config_file > tmp_mbuild196 grep "%host_identifier" $config_file > $tmp_mbuild 190 197 while read line 191 198 do … … 200 207 fi 201 208 fi 202 done < tmp_mbuild209 done < $tmp_mbuild 203 210 204 211 if [[ "$local_host" = "" ]] … … 230 237 # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN 231 238 line="" 232 grep " $local_host" $config_file | grep "%remote_username" > tmp_mbuild239 grep " $local_host" $config_file | grep "%remote_username" > $tmp_mbuild 233 240 while read line 234 241 do … … 237 244 local_username=`echo $line | cut -d" " -s -f2` 238 245 fi 239 done < tmp_mbuild246 done < $tmp_mbuild 240 247 241 248 … … 254 261 # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN 255 262 line="" 256 grep "%" $config_file > tmp_mbuild263 grep "%" $config_file > $tmp_mbuild 257 264 while read line 258 265 do … … 264 271 # eval echo \" $var=\$$var \" # AUSGABE ZU TESTZWECKEN 265 272 fi 266 done < tmp_mbuild273 done < $tmp_mbuild 267 274 268 275 # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE 269 276 line="" 270 grep "%source_path" $config_file > tmp_mbuild277 grep "%source_path" $config_file > $tmp_mbuild 271 278 while read line 272 279 do … … 278 285 fi 279 286 fi 280 done < tmp_mbuild287 done < $tmp_mbuild 281 288 282 289 line="" 283 grep " $local_host" $config_file | grep "%source_path" > tmp_mbuild290 grep " $local_host" $config_file | grep "%source_path" > $tmp_mbuild 284 291 while read line 285 292 do … … 288 295 local_source_path=`echo $line | cut -d" " -s -f2` 289 296 fi 290 done < tmp_mbuild297 done < $tmp_mbuild 291 298 292 299 if [[ "$local_source_path" = "" ]] … … 306 313 307 314 308 # EBENSO PFAD FUER DAS MAKE-DEPOSITORY ERMITTELN 315 316 # GLOBALEN DEPOSITORY-PFAD ERMITTELN 309 317 line="" 310 grep "%depository_path" $config_file > tmp_mbuild318 grep "%depository_path" $config_file > $tmp_mbuild 311 319 while read line 312 320 do … … 318 326 fi 319 327 fi 320 done < tmp_mbuild 321 322 line="" 323 grep " $local_host" $config_file | grep "%depository_path" > tmp_mbuild 324 while read line 325 do 326 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 327 then 328 local_depository_path=`echo $line | cut -d" " -s -f2` 329 fi 330 done < tmp_mbuild 331 332 if [[ "$local_depository_path" = "" ]] 333 then 334 if [[ "$global_depository_path" != "" ]] 335 then 336 local_depository_path=$global_depository_path 337 else 338 printf "\n +++ no depository path found in configuration file" 339 printf "\n for local host \"$local_host\" " 340 printf "\n please set \"\%depository_path\" in configuration file" 341 locat=config_file; exit 342 fi 343 fi 344 eval local_depository_path=$local_depository_path 345 eval local_depository_path=$local_depository_path 328 done < $tmp_mbuild 346 329 347 330 … … 395 378 column1="local source path:"; column2=$local_source_path 396 379 printf "| $column1$column2 | \n" 397 column1="make depository:"; column2=$local_depository_path398 printf "| $column1$column2 | \n"399 380 printf "#------------------------------------------------------------------------# \n" 400 381 … … 405 386 then 406 387 407 cd $local_source_path408 409 410 # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN411 source_code_files=`ls -1 *.$suf`412 413 414 415 # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN,416 # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN417 # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN418 if [[ ! -d $local_depository_path ]]419 then420 if mkdir $local_depository_path421 then422 printf "\n\n *** directory for make depository:"423 printf "\n $local_depository_path"424 printf "\n was created\n"425 426 # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG427 # IHRES DATUMS INS VERZEICHNIS KOPIEREN428 printf "\n *** makefile and source code files are copied to"429 printf "\n $local_depository_path\n"430 printf "\n copying makefile \"$makefile\" ..."431 cp -p $makefile $local_depository_path/Makefile432 433 # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT434 # SEIN435 for filename in $source_code_files436 do437 if [[ $(grep -c $filename $makefile) = 0 ]]438 then439 printf "\n +++ source code file:"440 printf "\n $filename"441 printf "\n is not listed in makefile"442 locat=makefile; exit443 else444 printf "\n copying source code file \"$filename\" ..."445 cp -p $filename $local_depository_path446 fi447 done448 printf "\n"449 else450 printf "\n +++ directory for make depository:"451 printf "\n $local_depository_path"452 printf "\n cannot be created"453 locat=local_depository_path; exit454 fi455 else456 457 printf "\n *** checking file status ..."458 459 # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS460 if [[ $makefile -nt $local_depository_path/Makefile ]]461 then462 printf "\n *** update of \"$makefile\" "463 cp -f -p $makefile $local_depository_path/Makefile464 update=true465 466 # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE467 # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN468 cd $local_depository_path469 source_code_files_in_depository=`ls -1 *.$suf`470 for filename in $source_code_files_in_depository471 do472 if [[ $(grep -c $filename Makefile) = 0 ]]473 then474 printf "\n *** source code file in \"$local_depository_path\":"475 printf "\n $filename"476 printf "\n is not listed in makefile"477 if [[ $silent = false ]]478 then479 answer=dummy480 printf "\n\n"481 while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]]482 do483 printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ? "484 read answer485 done486 if [[ $answer = y || $answer = Y ]]487 then488 base=`echo $filename | cut -d. -f2`489 rm -f $filename490 rm -f ${base}.o ${base}.mod491 printf "\n *** \"$filename\" deleted in \"$local_depository_path\" "492 else493 printf "\n *** \"$filename\" not deleted in \"$local_depository_path\" "494 fi495 fi496 fi497 done498 cd - > /dev/null 2>&1499 500 elif [[ $local_depository_path/Makefile -nt $makefile ]]501 then502 printf "\n *** makefile in depository is newer than"503 printf "\n \"$makefile\" "504 if [[ $silent = false ]]505 then506 answer=dummy507 printf "\n\n"508 while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]]509 do510 printf " >>> update \"$makefile\" (y/n) ? "511 read answer512 done513 if [[ $answer = y || $answer = Y ]]514 then515 cp -f -p $local_depository_path/Makefile $makefile516 printf "\n *** \"$makefile\" updated"517 else518 printf "\n *** \"$makefile\" not updated"519 fi520 fi521 fi522 523 # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS524 # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN525 for filename in $source_code_files526 do527 if [[ $(grep -c $filename $makefile) = 0 ]]528 then529 printf "\n +++ source code file:"530 printf "\n $filename"531 printf "\n is not listed in makefile"532 locat=makefile; exit533 else534 if [[ ! -f $local_depository_path/$filename ]]535 then536 cp -p $filename $local_depository_path537 printf "\n *** source code file \"$filename\" created in \"$local_depository_path\" "538 fi539 if [[ $filename -nt $local_depository_path/$filename ]]540 then541 printf "\n *** update of source code file \"$filename\" "542 cp -f -p $filename $local_depository_path543 update=true544 fi545 fi546 done547 548 549 # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN550 # ODER EVTL. NEUEREN DATUMS SIND551 cd $local_depository_path552 source_code_files_in_depository=`ls -1 *.$suf`553 cd - > /dev/null 2>&1554 for filename in $source_code_files_in_depository555 do556 if [[ ! -f $filename ]]557 then558 printf "\n *** source code file \"$filename\" does not exist in current directory"559 if [[ $silent = false ]]560 then561 answer=dummy562 printf "\n\n"563 while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]]564 do565 printf " >>> create \"$filename\" in current directory (y/n) ? "566 read answer567 done568 if [[ $answer = y || $answer = Y ]]569 then570 cp -p $local_depository_path/$filename $filename571 printf "\n *** source code file \"$filename\" created in current directory"572 else573 printf "\n *** source code file \"$filename\" not created in current directory"574 fi575 fi576 elif [[ $local_depository_path/$filename -nt $filename ]]577 then578 ls -al $local_depository_path/$filename579 ls -al $filename580 printf "\n *** source code file \"$filename\" in depository is newer than in current directory"581 if [[ $silent = false ]]582 then583 answer=dummy584 printf "\n\n"585 while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]]586 do587 printf " >>> update \"$filename\" in current directory (y/n) ? "588 read answer589 done590 if [[ $answer = y || $answer = Y ]]591 then592 cp -f -p $local_depository_path/$filename $filename593 printf "\n *** source code file \"$filename\" updated in current directory"594 else595 printf "\n *** source code file \"$filename\" not updated in current directory"596 fi597 fi598 fi599 done600 601 if [[ $update = false ]]602 then603 printf "\n *** no updates necessary in \"$local_depository_path\" "604 if [[ $silent = false ]]605 then606 answer=dummy607 printf "\n\n"608 while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]]609 do610 printf " >>> continue with updates on remote hosts (y/n) ? "611 read answer612 done613 if [[ $answer = n || $answer = N ]]614 then615 locat=user_abort; exit616 fi617 fi618 fi619 fi620 621 622 623 # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN624 388 # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF 625 389 # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT 626 printf "\n\n *** tar of makefile and source files in depository ..." 627 cd $local_depository_path 628 chmod u+w Makefile *.$suf 390 cd $local_source_path 391 printf "\n\n *** tar of makefile and source files in $local_source_path" 629 392 tar -cf ${mainprog}_sources.tar Makefile *.$suf 630 393 printf "\n" … … 665 428 printf "\n *** scanning configuration file for host(s) ..." 666 429 667 grep %fopts $config_file > tmp_mbuild430 grep %fopts $config_file > $tmp_mbuild 668 431 while read line 669 432 do … … 672 435 (( ihost = ihost + 1 )) 673 436 hostline[$ihost]="$line" 674 done < tmp_mbuild437 done < $tmp_mbuild 675 438 676 439 … … 750 513 line="" 751 514 found=false 752 grep "$remote_host_string" $config_file | grep "%remote_username" > tmp_mbuild515 grep "$remote_host_string" $config_file | grep "%remote_username" > $tmp_mbuild 753 516 while read line1 754 517 do … … 765 528 fi 766 529 767 done < tmp_mbuild530 done < $tmp_mbuild 768 531 769 532 if [[ $found = false ]] … … 778 541 line="" 779 542 remote_source_path="" 780 grep "$remote_host_string" $config_file | grep "%source_path" > tmp_mbuild543 grep "$remote_host_string" $config_file | grep "%source_path" > $tmp_mbuild 781 544 while read line1 782 545 do … … 792 555 fi 793 556 794 done < tmp_mbuild557 done < $tmp_mbuild 795 558 796 559 if [[ "$remote_source_path" = "" ]] … … 813 576 remote_md="" 814 577 line="" 815 grep "$remote_host_string" $config_file | grep "%depository_path" > tmp_mbuild578 grep "$remote_host_string" $config_file | grep "%depository_path" > $tmp_mbuild 816 579 while read line1 817 580 do … … 827 590 fi 828 591 829 done < tmp_mbuild592 done < $tmp_mbuild 830 593 831 594 if [[ "$remote_md" = "" ]] … … 843 606 844 607 remote_md=$(eval echo $remote_md) 608 [[ "$condition1" != "" ]] && remote_md=${remote_md}_$condition1 609 [[ "$condition2" != "" ]] && remote_md=${remote_md}_$condition2 845 610 846 611 … … 848 613 line="" 849 614 found=false 850 grep "$remote_host_string" $config_file | grep "%compiler_name " > tmp_mbuild615 grep "$remote_host_string" $config_file | grep "%compiler_name " > $tmp_mbuild 851 616 while read line1 852 617 do … … 863 628 fi 864 629 865 done < tmp_mbuild630 done < $tmp_mbuild 866 631 867 632 if [[ $found = false ]] … … 879 644 line="" 880 645 found=false 881 grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > tmp_mbuild646 grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > $tmp_mbuild 882 647 while read line1 883 648 do … … 894 659 fi 895 660 896 done < tmp_mbuild661 done < $tmp_mbuild 897 662 898 663 if [[ $found = false ]] … … 911 676 line="" 912 677 found=false 913 grep "$remote_host_string" $config_file | grep "%cpp_options" > tmp_mbuild678 grep "$remote_host_string" $config_file | grep "%cpp_options" > $tmp_mbuild 914 679 while read line1 915 680 do … … 927 692 fi 928 693 929 done < tmp_mbuild694 done < $tmp_mbuild 930 695 931 696 if [[ $found = false ]] … … 963 728 # NETCDF-OPTIONEN ERMITTELN 964 729 line="" 965 grep "$remote_host_string" $config_file | grep "%netcdf_inc" > tmp_mbuild730 grep "$remote_host_string" $config_file | grep "%netcdf_inc" > $tmp_mbuild 966 731 while read line1 967 732 do … … 978 743 fi 979 744 980 done < tmp_mbuild745 done < $tmp_mbuild 981 746 982 747 line="" 983 grep "$remote_host_string" $config_file | grep "%netcdf_lib" > tmp_mbuild748 grep "$remote_host_string" $config_file | grep "%netcdf_lib" > $tmp_mbuild 984 749 while read line1 985 750 do … … 996 761 fi 997 762 998 done < tmp_mbuild763 done < $tmp_mbuild 999 764 1000 765 … … 1003 768 line="" 1004 769 found=false 1005 grep "$remote_host_string" $config_file | grep "%fopts" > tmp_mbuild770 grep "$remote_host_string" $config_file | grep "%fopts" > $tmp_mbuild 1006 771 while read line1 1007 772 do … … 1022 787 fi 1023 788 1024 done < tmp_mbuild789 done < $tmp_mbuild 1025 790 1026 791 if [[ $found = false ]] … … 1036 801 line="" 1037 802 found=false 1038 grep "$remote_host_string" $config_file | grep "%lopts" > tmp_mbuild803 grep "$remote_host_string" $config_file | grep "%lopts" > $tmp_mbuild 1039 804 while read line1 1040 805 do … … 1055 820 fi 1056 821 1057 done < tmp_mbuild822 done < $tmp_mbuild 1058 823 1059 824 if [[ $found = false ]] … … 1078 843 column1="make depository:"; column2=$remote_md 1079 844 printf "| $column1$column2 | \n" 845 line=$(echo "$remote_md" | cut -c51-) 846 while [[ "$line" != "" ]] 847 do 848 column1="" 849 column2=$line 850 printf "| $column1$column2 | \n" 851 line=$(echo "$line" | cut -c51-) 852 done 1080 853 if [[ $compile_utility_programs = true ]] 1081 854 then … … 1247 1020 # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN 1248 1021 remote_md=`echo $remote_md | sed 's/\$HOME\///'` 1249 /bin/scp ${ mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar1022 /bin/scp ${local_source_path}/${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar 1250 1023 else 1251 scp ${ mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar1024 scp ${local_source_path}/${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar 1252 1025 fi 1253 1026 … … 1477 1250 then 1478 1251 1252 # DEPOSITORY VERZEICHNIS ERZEUGEN, FALLS NOCH NICHT VORHANDEN 1253 eval remote_md=$remote_md 1254 if [[ ! -d $remote_md ]] 1255 then 1256 if mkdir $remote_md 1257 then 1258 printf "\n\n *** directory for make depository:" 1259 printf "\n $remote_md" 1260 printf "\n was created\n" 1261 else 1262 printf "\n +++ directory for make depository:" 1263 printf "\n $remote_md" 1264 printf "\n cannot be created" 1265 locat=local_depository_path; exit 1266 fi 1267 fi 1268 1269 # QUELLTEXT-DATEIEN AUS REPOSITORY INS DEPOSITORY KOPIEREN 1270 echo " " 1271 echo " *** updating sources in $remote_md" 1272 cd $remote_md 1273 cp $local_source_path/${mainprog}_sources.tar . 1274 tar xf ${mainprog}_sources.tar 1275 1479 1276 # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN 1480 1277 echo " "
Note: See TracChangeset
for help on using the changeset viewer.