Changeset 2506 for palm/trunk/SCRIPTS/palmbuild
- Timestamp:
- Sep 29, 2017 8:30:37 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmbuild
r2500 r2506 27 27 # ----------------- 28 28 # $Id$ 29 # option -V added to check for an existing SOURCES_FOR_RUN_... folder 30 # host configuration added to SOURCES_FOR_RUN_... folder name 31 # SOURCES_FOR_RUN_... folder is deleted in case of compilation errors 32 # host_identifier renamed host_configuration 33 # 34 # 2500 2017-09-25 11:10:03Z raasch 29 35 # bugfix for r2492 30 36 # … … 52 58 column1="" 53 59 column2="" 54 host_ identifier=default60 host_configuration=default 55 61 locat=normal 56 62 makefile="" … … 62 68 ssh_key="" 63 69 suf=f90 70 use_existing_sources_folder=false 64 71 version="palmbuild 1.0 Rev$Rev: 2316 $" 65 72 working_directory=`pwd` … … 69 76 # ERROR HANDLING 70 77 # IN CASE OF EXIT: 71 trap 'if [[ $locat != normal ]] 78 trap 'rm -rf ${source_path}/${host_configuration}_last_make_protocol 79 if [[ $locat != normal ]] 72 80 then 73 81 printf "\n\n +++ palmbuild killed \n\n" … … 77 85 exit 0 78 86 fi 79 rm ${source_path}/${host_identifier}_last_make_protocol80 87 ' exit 81 88 … … 83 90 # IN CASE OF TERMINAL-BREAK: 84 91 trap 'printf "\n\n +++ palmbuild killed by \"^C\" \n\n" 85 rm ${source_path}/${host_ identifier}_last_make_protocol92 rm ${source_path}/${host_configuration}_last_make_protocol 86 93 exit 87 94 ' 2 … … 90 97 91 98 # READ SHELLSCRIPT-OPTIONS 92 while getopts :d:h:m:s:S:uv option99 while getopts :d:h:m:s:S:uvV option 93 100 do 94 101 case $option in 95 102 (d) fname=$OPTARG;; 96 (h) host_ identifier=$OPTARG;;103 (h) host_configuration=$OPTARG;; 97 104 (m) makefile=$OPTARG;; 98 105 (s) suf=$OPTARG;; 99 106 (S) source_list="$OPTARG";; 100 107 (v) silent=true;; 108 (V) use_existing_sources_folder=true;; 101 109 (\?) printf "\n +++ unknown option $OPTARG \n"; 102 110 locat=parameter; exit;; … … 105 113 106 114 107 # BUILD THE CONFIGURATION-FILE NAME 108 config_file=.palm.config.$host_identifier 115 # BUILD THE CONFIGURATION-FILE NAME AND THE SOURCES_FOR_RUN-FOLDER NAME 116 config_file=.palm.config.$host_configuration 117 sources_for_run_catalog=SOURCES_FOR_RUN_${host_configuration}_$fname 109 118 110 119 … … 277 286 278 287 line=`grep %base_directory $config_file` 279 make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${host_ identifier}288 make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${host_configuration} 280 289 281 290 else 282 291 283 make_depository=${base_directory}/MAKE_DEPOSITORY_${host_ identifier}292 make_depository=${base_directory}/MAKE_DEPOSITORY_${host_configuration} 284 293 285 294 fi … … 342 351 343 352 # GET CONFIRMATION TO CONTINUE 344 printf "\n *** update will be made for host \"$host_identifier\" "353 printf "\n *** update will be made for host configuration \"$host_configuration\" " 345 354 346 355 … … 367 376 if [[ "$remote_ip" != "" ]] 368 377 then 369 column2="$host_ identifier"378 column2="$host_configuration" 370 379 printf "| %-20s%-50s | \n" "host identifier:" "$column2" 371 380 printf "| | \n" … … 373 382 printf "| %-20s%-50s | \n" "remote depository:" "$column2" 374 383 else 375 column2="$host_ identifier"384 column2="$host_configuration" 376 385 printf "| %-20s%-50s | \n" "host identifier:" "$column2" 377 386 printf "| | \n" … … 518 527 echo " *** creating utilities on remote host" 519 528 make_call_string="make -f Makefile_utilities $make_options F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$linker_options\" " 520 echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_ identifier}_last_make_protocol521 522 if [[ $(grep -c MAKE_ERROR ${host_ identifier}_last_make_protocol) != 0 ]]529 echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol 530 531 if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]] 523 532 then 524 533 printf "\a\n +++ error(s) occurred during compiling or linking of utilities" 525 printf "\n for host \"$host_identifier\" "534 printf "\n for host configuration \"$host_configuration\" " 526 535 if [[ $silent = false ]] 527 536 then … … 534 543 if [[ "$answer" = l ]] 535 544 then 536 more ${host_ identifier}_last_make_protocol545 more ${host_configuration}_last_make_protocol 537 546 fi 538 547 done … … 555 564 echo " *** compile PALM sources on remote host" 556 565 make_call_string="make $make_options PROG=$program_name F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$linker_options\" " 557 echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_ identifier}_last_make_protocol558 559 if [[ $(grep -c MAKE_ERROR ${host_ identifier}_last_make_protocol) != 0 ]]560 then 561 printf "\a\n +++ error(s) occurred during compiling or linking for host \"$host_identifier\" "566 echo "$login_init_cmd $module_commands cd ${make_depository}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol 567 568 if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]] 569 then 570 printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " 562 571 if [[ $silent = false ]] 563 572 then … … 570 579 if [[ "$answer" = l ]] 571 580 then 572 more ${host_ identifier}_last_make_protocol581 more ${host_configuration}_last_make_protocol 573 582 fi 574 583 done … … 596 605 # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS 597 606 # AND ASK, IF THEY SHALL BE USED 598 echo "[[ -d $ fast_io_catalog/SOURCES_FOR_RUN_$fname ]] && echo sources for run found" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 > ${host_identifier}_last_make_protocol599 if [[ $(grep -c "sources for run found" ${host_ identifier}_last_make_protocol) != 0]]607 echo "[[ -d ${fast_io_catalog}/${sources_for_run_catalog} ]] && echo sources for run found" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 > ${host_configuration}_last_make_protocol 608 if [[ $(grep -c "sources for run found" ${host_configuration}_last_make_protocol) != 0 && $use_existing_sources_folder = true ]] 600 609 then 601 610 printf "\a\n *** compiled sources for run \"$fname\" found on remote host in folder" 602 printf "\n $fast_io_catalog/SOURCES_FOR_RUN_$fname" 603 answer=dummy 604 printf "\n\n" 605 while [[ "$answer" != y && "$answer" != n ]] 606 do 607 printf " >>> shall they be used (y/n) ? " 608 read answer 609 done 610 if [[ $answer = y ]] 611 then 612 exit 613 fi 611 printf "\n ${fast_io_catalog}/${sources_for_run_catalog}" 612 printf "\n will be used!" 613 exit 614 614 fi 615 615 616 616 # COPY MAKE DEPOSITORY ON REMOTE MACHINE TO SOURCES_FOR_RUN_... 617 printf "\n *** copy MAKE_DEPOSITORY_${host_ identifier} on remote host to SOURCES_FOR_RUN_$fname\n"618 echo "rm -rf $ fast_io_catalog/SOURCES_FOR_RUN_$fname; mkdir -p $fast_io_catalog/SOURCES_FOR_RUN_$fname; cp ${make_depository}/${program_name}_current_version.tar $fast_io_catalog/SOURCES_FOR_RUN_$fname; cd $fast_io_catalog/SOURCES_FOR_RUN_$fname; tar xf ${program_name}_current_version.tar" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1617 printf "\n *** copy MAKE_DEPOSITORY_${host_configuration} on remote host to $sources_for_run_catalog \n" 618 echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}; mkdir -p ${fast_io_catalog}/${sources_for_run_catalog}; cp ${make_depository}/${program_name}_current_version.tar ${fast_io_catalog}/${sources_for_run_catalog}; cd ${fast_io_catalog}/${sources_for_run_catalog}; tar xf ${program_name}_current_version.tar" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 619 619 620 620 621 621 # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... ON THE REMOTE MACHINE 622 printf "\n *** copy $ base_directory/SOURCES_FOR_RUN_$fname"623 printf "\n to SOURCES_FOR_RUN_$fnameon remote host \n"624 scp -q $ssh_key $ base_directory/SOURCES_FOR_RUN_$fname/{*,.[!.]*} ${remote_username}@${remote_ip}:${fast_io_catalog}/SOURCES_FOR_RUN_$fname622 printf "\n *** copy ${base_directory}/${sources_for_run_catalog}" 623 printf "\n to $sources_for_run_catalog on remote host \n" 624 scp -q $ssh_key ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*} ${remote_username}@${remote_ip}:${fast_io_catalog}/${sources_for_run_catalog} 625 625 626 626 627 627 # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY 628 if [[ $(ls -1 $ base_directory/SOURCES_FOR_RUN_$fname/ | grep -c .$suf) != 0 ]]628 if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]] 629 629 then 630 630 … … 633 633 [[ "$module_commands" != "" ]] && module_commands=${module_commands}";" 634 634 echo " *** execute \"make\" on remote host" 635 echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/ SOURCES_FOR_RUN_$fname; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_identifier}_last_make_protocol636 637 if [[ $(grep -c MAKE_ERROR ${host_ identifier}_last_make_protocol) != 0 ]]635 echo "$login_init_cmd $module_commands cd ${fast_io_catalog}/${sources_for_run_catalog}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 | tee ${host_configuration}_last_make_protocol 636 637 if [[ $(grep -c MAKE_ERROR ${host_configuration}_last_make_protocol) != 0 ]] 638 638 then 639 printf "\a\n +++ error(s) occurred during compiling or linking for host \"$host_identifier\" "639 printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " 640 640 if [[ $silent = false ]] 641 641 then … … 648 648 if [[ "$answer" = l ]] 649 649 then 650 more ${host_ identifier}_last_make_protocol650 more ${host_configuration}_last_make_protocol 651 651 fi 652 652 done 653 653 if [[ $answer = k ]] 654 654 then 655 echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 655 656 locat=user_abort; exit 656 657 fi 657 658 else 658 659 # ABORT ANYWAY 660 echo "rm -rf ${fast_io_catalog}/${sources_for_run_catalog}" | ssh -q $ssh_key ${remote_username}@${remote_ip} 2>&1 659 661 locat=user_abort; exit 660 662 fi … … 669 671 fi 670 672 671 rm -rf ${ host_identifier}_last_make_protocol673 rm -rf ${source_path}/${host_configuration}_last_make_protocol 672 674 673 675 … … 729 731 echo " *** compile PALM sources on local host" 730 732 731 make $make_options PROG=$program_name F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$linker_options" 2>&1 | tee ${host_ identifier}_last_make_protocol733 make $make_options PROG=$program_name F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$linker_options" 2>&1 | tee ${host_configuration}_last_make_protocol 732 734 733 735 if [[ $? != 0 ]] 734 736 then 735 printf "\a\n +++ error(s) occurred during compiling or linking for host \"$host_identifier\" "737 printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " 736 738 if [[ $silent = false ]] 737 739 then … … 744 746 if [[ "$answer" = l ]] 745 747 then 746 more ${host_ identifier}_last_make_protocol748 more ${host_configuration}_last_make_protocol 747 749 fi 748 750 done … … 770 772 # FIRST CHECK, IF COMPILED SOURCES FOR THIS RUN IDENTIFIER EXISTS 771 773 # AND ASK, IF THEY SHALL BE USED 772 if [[ -d $ fast_io_catalog/SOURCES_FOR_RUN_$fname ]]774 if [[ -d ${fast_io_catalog}/${sources_for_run_catalog} && $use_existing_sources_folder = true ]] 773 775 then 774 776 printf "\a\n *** compiled sources for run \"$fname\" found on local host in folder" 775 printf "\n $fast_io_catalog/SOURCES_FOR_RUN_$fname" 776 answer=dummy 777 printf "\n\n" 778 while [[ "$answer" != y && "$answer" != n ]] 779 do 780 printf " >>> shall they be used (y/n) ? " 781 read answer 782 done 783 if [[ $answer = y ]] 784 then 785 exit 786 fi 777 printf "\n ${fast_io_catalog}/${sources_for_run_catalog}" 778 printf "\n will be used!" 779 exit 787 780 fi 788 781 … … 792 785 printf "\n +++ directory for local make depository:" 793 786 printf "\n $make_depository" 794 printf "\n not found. Please run \"palmbuild -h $host_ identifier\" "787 printf "\n not found. Please run \"palmbuild -h $host_configuration\" " 795 788 locat=make_depository; exit 796 789 fi … … 798 791 799 792 # COPY MAKE DEPOSITORY ON LOCAL MACHINE TO SOURCES_FOR_RUN_... 800 printf "\n *** copy MAKE_DEPOSITORY_${host_ identifier} on local host to "801 printf "\n $ fast_io_catalog/SOURCES_FOR_RUN_$fname\n"802 rm -rf $ fast_io_catalog/SOURCES_FOR_RUN_$fname803 mkdir -p $ fast_io_catalog/SOURCES_FOR_RUN_$fname804 cp ${make_depository}/${program_name}_current_version.tar $ fast_io_catalog/SOURCES_FOR_RUN_$fname805 cd $fast_io_catalog/ SOURCES_FOR_RUN_$fname793 printf "\n *** copy MAKE_DEPOSITORY_${host_configuration} on local host to " 794 printf "\n ${fast_io_catalog}/${sources_for_run_catalog} \n" 795 rm -rf ${fast_io_catalog}/${sources_for_run_catalog} 796 mkdir -p ${fast_io_catalog}/${sources_for_run_catalog} 797 cp ${make_depository}/${program_name}_current_version.tar ${fast_io_catalog}/${sources_for_run_catalog} 798 cd $fast_io_catalog/${sources_for_run_catalog} 806 799 tar xf ${program_name}_current_version.tar 807 800 … … 809 802 # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... 810 803 # IN THE FAST_IO_CATALOG ON THE LOCAL MACHINE 811 printf "\n *** copy $ base_directory/SOURCES_FOR_RUN_$fnameto"812 printf "\n $ fast_io_catalog/SOURCES_FOR_RUN_$fnameon local host \n"813 cp $ base_directory/SOURCES_FOR_RUN_$fname/{*,.[!.]*} ${fast_io_catalog}/SOURCES_FOR_RUN_$fname804 printf "\n *** copy ${base_directory}/${sources_for_run_catalog} to" 805 printf "\n ${fast_io_catalog}/${sources_for_run_catalog} on local host \n" 806 cp ${base_directory}/${sources_for_run_catalog}/{*,.[!.]*} ${fast_io_catalog}/${sources_for_run_catalog} 814 807 815 808 816 809 # CREATE EXECUTABLE FROM THE NEW/MODIFIED SOURCE FILES, IF THERE ARE ANY 817 if [[ $(ls -1 $ base_directory/SOURCES_FOR_RUN_$fname/ | grep -c .$suf) != 0 ]]810 if [[ $(ls -1 ${base_directory}/${sources_for_run_catalog}/ | grep -c .$suf) != 0 ]] 818 811 then 819 812 … … 827 820 then 828 821 829 printf "\a\n +++ error(s) occurred during compiling or linking for host \"$host_identifier\" "822 printf "\a\n +++ error(s) occurred during compiling or linking for host configuration \"$host_configuration\" " 830 823 if [[ $silent = false ]] 831 824 then … … 834 827 while [[ "$answer" != c && "$answer" != k ]] 835 828 do 836 printf " >>> continue / list errors /kill palmbuild (c/k) ? "829 printf " >>> continue / kill palmbuild (c/k) ? " 837 830 read answer 838 831 done 839 832 if [[ $answer = k ]] 840 833 then 834 rm -rf ${fast_io_catalog}/${sources_for_run_catalog} 841 835 locat=user_abort; exit 842 836 fi 843 837 else 844 838 # ABORT ANYWAY 839 rm -rf ${fast_io_catalog}/${sources_for_run_catalog} 845 840 locat=user_abort; exit 846 841 fi
Note: See TracChangeset
for help on using the changeset viewer.