Ignore:
Timestamp:
Sep 5, 2017 9:33:14 AM (7 years ago)
Author:
raasch
Message:

further simplifications in palmrun and palmbuild

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmbuild

    r2396 r2404  
    172172
    173173 
     174    # CHECK, IF THE BASE DIRECTORY PATH HAS BEEN GIVEN
     175 if [[ "$base_directory" = "" ]]
     176 then
     177    printf "\n  +++ no base directory found in configuration file"
     178    locat=config_file; exit
     179 else
     180    if [[ ! -d $base_directory ]]
     181    then
     182       printf "\n\n  +++ base directory \"$base_directory\" "
     183       printf "\n      does not exist"
     184       locat=source_path; exit
     185    fi
     186 fi
     187
     188
    174189    # CHECK SOURCE-CODE PATH
    175190 if [[ "$source_path" = "" ]]
     
    187202
    188203
    189     # CHECK DEPOSITORY-PATH
    190  if [[ "$depository_path" = "" ]]
    191  then
    192     printf "\n  +++ no depository path found in configuration file"
    193     locat=config_file; exit
    194  fi
    195 
    196 
    197204    # CHECK MAKEFILE
    198205 [[ "$makefile" = "" ]]  &&  makefile=$source_path/Makefile
     
    247254
    248255    [[ "$remote_hostname" = "" ]]  &&  remote_hostname=$remote_ip
     256
    249257
    250258       # GET SOURCE AND DEPOSITORY PATH ON THE REMOTE MACHINE WITHOUT EVALUATING
     
    260268    fi
    261269
    262     line=`grep %remote_depository_path $config_file`
    263     if [[ "$line" != "" ]]
    264     then
    265        remote_depository_path=`echo $line | cut -d" " -s -f2`
    266     else
    267        line=`grep %depository_path $config_file`
    268        remote_depository_path=`echo $line | cut -d" " -s -f2`
    269     fi
    270 
    271     remote_make_depository=${remote_depository_path}/MAKE_DEPOSITORY_${host}
     270    line=`grep %base_directory $config_file`
     271    make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${host}
    272272
    273273 else
    274274
    275     local_make_depository=${depository_path}/MAKE_DEPOSITORY_${host}
     275    make_depository=${base_directory}/MAKE_DEPOSITORY_${host}
    276276
    277277 fi
     
    362362       printf "| %-20s%-50s | \n" "remote host:" "$column2"
    363363       printf "|                                                                        | \n"
    364        column2=$(echo "$remote_make_depository" | cut -c1-50 )
     364       column2=$(echo "$make_depository" | cut -c1-50 )
    365365       printf "| %-20s%-50s | \n" "remote depository:" "$column2"
    366        line=$(echo "$remote_make_depository" | cut -c51-)
    367        while [[ "$line" != "" ]]
    368        do
    369           column1=""
    370           column2=$(echo "$line" | cut -c1-50 )
    371           printf "| %-20s%-50s | \n" "$column1" "$column2"
    372           line=$(echo "$line" | cut -c51-)
    373        done
    374366    else
    375367       column2=$local_hostname
    376368       printf "| %-20s%-50s | \n" "local host:" "$column2"
    377369       printf "|                                                                        | \n"
    378        column2=$(echo "$local_make_depository" | cut -c1-50 )
     370       column2=$(echo "$make_depository" | cut -c1-50 )
    379371       printf "| %-20s%-50s | \n" "local depository:" "$column2"
    380        line=$(echo "$local_make_depository" | cut -c51-)
    381        while [[ "$line" != "" ]]
    382        do
    383           column1=""
    384           column2=$(echo "$line" | cut -c1-50 )
    385           printf "| %-20s%-50s | \n" "$column1" "$column2"
    386           line=$(echo "$line" | cut -c51-)
    387        done
    388     fi
     372    fi
     373    line=$(echo "$make_depository" | cut -c51-)
     374    while [[ "$line" != "" ]]
     375    do
     376       column1=""
     377       column2=$(echo "$line" | cut -c1-50 )
     378       printf "| %-20s%-50s | \n" "$column1" "$column2"
     379       line=$(echo "$line" | cut -c51-)
     380    done
    389381
    390382    if [[ "$remote_ip" != "" ]]
     
    496488             # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST
    497489             # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST
    498           echo "  *** copying \"${program_name}_sources.tar\" to \"${remote_ip}:${remote_make_depository}/\" "
    499           echo "[[ ! -d ${remote_make_depository} ]]  &&  (echo \"  *** ${remote_make_depository} will be created\"; mkdir -p  ${remote_make_depository})"  |  ssh  -q  $ssh_key ${remote_username}@${remote_ip}  2>&1
    500 
    501           scp  $ssh_key ${source_path}/${program_name}_sources.tar  ${remote_username}@${remote_ip}:${remote_make_depository}/${program_name}_sources.tar
     490          echo "  *** copying \"${program_name}_sources.tar\" to \"${remote_ip}:${make_depository}/\" "
     491          echo "[[ ! -d ${make_depository} ]]  &&  (echo \"  *** ${make_depository} will be created\"; mkdir -p  ${make_depository})"  |  ssh  -q  $ssh_key ${remote_username}@${remote_ip}  2>&1
     492
     493          scp  $ssh_key ${source_path}/${program_name}_sources.tar  ${remote_username}@${remote_ip}:${make_depository}/${program_name}_sources.tar
    502494
    503495
     
    505497             # UNTAR PREVIOUS UPDATE ON REMOTE HOST, IF EXISTING
    506498          echo "  *** untar previous update on remote host, if existing"
    507           echo "cd ${remote_make_depository}; [[ -f ${program_name}_current_version.tar ]]  &&  tar -xf  ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     499          echo "cd ${make_depository}; [[ -f ${program_name}_current_version.tar ]]  &&  tar -xf  ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    508500
    509501
    510502             # UNTAR CURRENT SOURCES ON REMOTE HOST
    511503          echo "  *** untar current sources on remote host"
    512           echo  "cd ${remote_make_depository}; tar -xf  ${program_name}_sources.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     504          echo  "cd ${make_depository}; tar -xf  ${program_name}_sources.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    513505
    514506
     
    522514          echo "  *** creating utilities on remote host"
    523515          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\" "
    524           echo "$login_init_cmd $module_commands cd ${remote_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 ${remote_hostname}_last_make_protokoll
     516          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 ${remote_hostname}_last_make_protokoll
    525517
    526518          if [[ $(grep -c MAKE_ERROR ${remote_hostname}_last_make_protokoll) != 0 ]]
     
    556548          echo "  *** compile PALM sources on remote host"
    557549          make_call_string="make  $make_options  PROG=$program_name  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$linker_options\" "
    558           echo "$login_init_cmd $module_commands cd ${remote_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 ${remote_hostname}_last_make_protokoll
     550          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 ${remote_hostname}_last_make_protokoll
    559551
    560552          if [[ $(grep -c MAKE_ERROR ${remote_hostname}_last_make_protokoll) != 0 ]]
     
    583575             # TAR UPDATED VERSION ON THE REMOTE HOST
    584576          printf "\n  *** tar update on remote host ..."
    585           echo  "cd ${remote_make_depository}; chmod u+w *; tar -cf  ${program_name}_current_version.tar  ${program_name}  *.f90 *.o *.mod *.x"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     577          echo  "cd ${make_depository}; chmod u+w *; tar -cf  ${program_name}_current_version.tar  ${program_name}  *.f90 *.o *.mod *.x"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
    586578
    587579
     
    593585
    594586             # FIRST CHECK, IF A DEPOSITORY EXISTS ON THE REMOTE MACHINE
    595           echo  "[[ ! -d ${remote_make_depository} ]]  &&  echo depository not found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${remote_hostname}_last_make_protokoll
     587          echo  "[[ ! -d ${make_depository} ]]  &&  echo depository not found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1 | tee ${remote_hostname}_last_make_protokoll
    596588
    597589
    598590             # COPY MAKE DEPOSITORY ON REMOTE MACHINE TO SOURCES_FOR_RUN_...
    599591          printf "\n  *** copy MAKE_DEPOSITORY_${host} on remote host to SOURCES_FOR_RUN_$fname \n"
    600           echo  "rm -rf $tmp_user_catalog/SOURCES_FOR_RUN_$fname; mkdir -p $tmp_user_catalog/SOURCES_FOR_RUN_$fname; cp ${remote_make_depository}/${program_name}_current_version.tar  $tmp_user_catalog/SOURCES_FOR_RUN_$fname; cd $tmp_user_catalog/SOURCES_FOR_RUN_$fname; tar xf ${program_name}_current_version.tar"  |  ssh  -q  $ssh_key  ${remote_username}@${remote_ip}  2>&1
     592          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>&1
    601593
    602594
    603595             # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_... ON THE REMOTE MACHINE
    604596          printf "\n  *** copy $base_directory/SOURCES_FOR_RUN_$fname to SOURCES_FOR_RUN_$fname on remote host \n"
    605           scp  -q  $ssh_key  $base_directory/SOURCES_FOR_RUN_$fname/{*,.[!.]*}  ${remote_username}@${remote_ip}:${tmp_user_catalog}/SOURCES_FOR_RUN_$fname
     597          scp  -q  $ssh_key  $base_directory/SOURCES_FOR_RUN_$fname/{*,.[!.]*}  ${remote_username}@${remote_ip}:${fast_io_catalog}/SOURCES_FOR_RUN_$fname
    606598
    607599
     
    614606             [[ "$module_commands" != "" ]]  &&  module_commands=${module_commands}";"
    615607             echo "  *** execute \"make\" on remote host"
    616              echo "$login_init_cmd $module_commands cd ${tmp_user_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 ${remote_hostname}_last_make_protokoll
     608             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 ${remote_hostname}_last_make_protokoll
    617609
    618610             if [[ $(grep -c MAKE_ERROR ${remote_hostname}_last_make_protokoll) != 0 ]]
     
    672664
    673665             # CREATE MAKE-DEPOSITORY, IF IT DOES NOT EXIST
    674           eval local_make_depository=$local_make_depository
    675           if [[ ! -d $local_make_depository ]]
    676           then
    677              if  mkdir -p $local_make_depository
     666          eval make_depository=$make_depository
     667          if [[ ! -d $make_depository ]]
     668          then
     669             if  mkdir -p $make_depository
    678670             then
    679671                printf "\n\n  *** directory for local make depository:"
    680                 printf "\n           $local_make_depository"
     672                printf "\n           $make_depository"
    681673                printf "\n      was created\n"
    682674             else
    683675                printf "\n  +++ directory for local make depository:"
    684                 printf "\n           $local_make_depository"
     676                printf "\n           $make_depository"
    685677                printf "\n      cannot be created"
    686                 locat=local_depository_path; exit
     678                locat=local_depository; exit
    687679             fi
    688680          fi
     
    691683          echo " "
    692684          echo "  *** untar current source sources on local host in"
    693           echo "      $local_make_depository"
    694           cd  $local_make_depository
     685          echo "      $make_depository"
     686          cd  $make_depository
    695687          cp  $source_path/${program_name}_sources.tar  .
    696688          tar xf  ${program_name}_sources.tar
     
    744736
    745737             # FIRST CHECK, IF A DEPOSITORY EXISTS ON THE LOCAL MACHINE
    746           if [[ ! -d ${local_make_depository} ]]
     738          if [[ ! -d ${make_depository} ]]
    747739          then
    748740             printf "\n  +++ directory for local make depository:"
    749              printf "\n           $local_make_depository"
     741             printf "\n           $make_depository"
    750742             printf "\n      not found. Please run \"palmbuild -h $host\" "
    751              locat=local_make_depository; exit
     743             locat=make_depository; exit
    752744          fi
    753745
     
    755747             # COPY MAKE DEPOSITORY ON LOCAL MACHINE TO SOURCES_FOR_RUN_...
    756748          printf "\n  *** copy MAKE_DEPOSITORY_${host} on local host to "
    757           printf "\n      $tmp_user_catalog/SOURCES_FOR_RUN_$fname \n"
    758           rm -rf $tmp_user_catalog/SOURCES_FOR_RUN_$fname
    759           mkdir -p $tmp_user_catalog/SOURCES_FOR_RUN_$fname
    760           cp ${local_make_depository}/${program_name}_current_version.tar  $tmp_user_catalog/SOURCES_FOR_RUN_$fname
    761           cd $tmp_user_catalog/SOURCES_FOR_RUN_$fname
     749          printf "\n      $fast_io_catalog/SOURCES_FOR_RUN_$fname \n"
     750          rm -rf $fast_io_catalog/SOURCES_FOR_RUN_$fname
     751          mkdir -p $fast_io_catalog/SOURCES_FOR_RUN_$fname
     752          cp ${make_depository}/${program_name}_current_version.tar  $fast_io_catalog/SOURCES_FOR_RUN_$fname
     753          cd $fast_io_catalog/SOURCES_FOR_RUN_$fname
    762754          tar xf ${program_name}_current_version.tar
    763755
    764756
    765757             # COPY CONTENTS OF SOURCES_FOR_RUN_... TO SOURCES_FOR_RUN_...
    766              # IN THE TMP_USER_CATALOG ON THE LOCAL MACHINE
     758             # IN THE FAST_IO_CATALOG ON THE LOCAL MACHINE
    767759          printf "\n  *** copy $base_directory/SOURCES_FOR_RUN_$fname to"
    768           printf "\n      $tmp_user_catalog/SOURCES_FOR_RUN_$fname on local host \n"
    769           cp  $base_directory/SOURCES_FOR_RUN_$fname/{*,.[!.]*}  ${tmp_user_catalog}/SOURCES_FOR_RUN_$fname
     760          printf "\n      $fast_io_catalog/SOURCES_FOR_RUN_$fname on local host \n"
     761          cp  $base_directory/SOURCES_FOR_RUN_$fname/{*,.[!.]*}  ${}/SOURCES_FOR_RUN_$fname
    770762
    771763
Note: See TracChangeset for help on using the changeset viewer.