Index: palm/trunk/SCRIPTS/mbuild
===================================================================
--- palm/trunk/SCRIPTS/mbuild	(revision 211)
+++ palm/trunk/SCRIPTS/mbuild	(revision 215)
@@ -95,4 +95,10 @@
      #                    ({mainprog}_current_version)
      # 02/10/08 - Siggi - adapted for lcxt4
+     # 14/11/08 - Siggi - update mechanism completely revised: source tarfile
+     #                    remains in source directory, one depository per block
+     #                    (given in the config-file) is created, always all files
+     #                    from the source directory are copied to the respective
+     #                    depository, no additional file checks are done any more
+     #                    (version 2.1)
 
 
@@ -121,5 +127,5 @@
  typeset  -L50 column2
  typeset  -L70 column3
- typeset  -L40 version="MBUILD  2.0  Rev$Rev$"
+ typeset  -L40 version="MBUILD  2.1  Rev$Rev$"
 
     # FEHLERBEHANDLUNG
@@ -141,4 +147,5 @@
 
 
+ tmp_mbuild=${working_directory}/tmp_mbuild
 
     # SHELLSCRIPT-OPTIONEN EINLESEN
@@ -187,5 +194,5 @@
     # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN
  line=""
- grep  "%host_identifier"  $config_file  >  tmp_mbuild
+ grep  "%host_identifier"  $config_file  >  $tmp_mbuild
  while read line
  do
@@ -200,5 +207,5 @@
        fi
     fi
- done < tmp_mbuild
+ done < $tmp_mbuild
 
  if [[ "$local_host" = "" ]]
@@ -230,5 +237,5 @@
     # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN
  line=""
- grep  " $local_host" $config_file | grep "%remote_username"  >  tmp_mbuild
+ grep  " $local_host" $config_file | grep "%remote_username"  >  $tmp_mbuild
  while read line
  do
@@ -237,5 +244,5 @@
        local_username=`echo $line | cut -d" " -s -f2`
     fi
- done < tmp_mbuild
+ done < $tmp_mbuild
 
 
@@ -254,5 +261,5 @@
     # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN
  line=""
- grep "%" $config_file  >  tmp_mbuild
+ grep "%" $config_file  >  $tmp_mbuild
  while read line
  do
@@ -264,9 +271,9 @@
 #       eval echo \"   $var=\$$var \"   # AUSGABE ZU TESTZWECKEN
     fi
- done < tmp_mbuild
+ done < $tmp_mbuild
 
     # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE
  line=""
- grep "%source_path" $config_file  >  tmp_mbuild
+ grep "%source_path" $config_file  >  $tmp_mbuild
  while read line
  do
@@ -278,8 +285,8 @@
        fi
     fi
- done < tmp_mbuild
+ done < $tmp_mbuild
 
  line=""
- grep  " $local_host" $config_file | grep "%source_path"  >  tmp_mbuild
+ grep  " $local_host" $config_file | grep "%source_path"  >  $tmp_mbuild
  while read line
  do
@@ -288,5 +295,5 @@
        local_source_path=`echo $line | cut -d" " -s -f2`
     fi
- done < tmp_mbuild
+ done < $tmp_mbuild
 
  if [[ "$local_source_path" = "" ]]
@@ -306,7 +313,8 @@
 
 
-     # EBENSO PFAD FUER DAS MAKE-DEPOSITORY ERMITTELN
+
+    # GLOBALEN DEPOSITORY-PFAD ERMITTELN
  line=""
- grep "%depository_path" $config_file  >  tmp_mbuild
+ grep "%depository_path" $config_file  >  $tmp_mbuild
  while read line
  do
@@ -318,30 +326,5 @@
        fi
     fi
- done < tmp_mbuild
-
- line=""
- grep  " $local_host" $config_file | grep "%depository_path"  >  tmp_mbuild
- while read line
- do
-    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
-    then
-       local_depository_path=`echo $line | cut -d" " -s -f2`
-    fi
- done < tmp_mbuild
-
- if [[ "$local_depository_path" = "" ]]
- then
-    if [[ "$global_depository_path" != "" ]]
-    then
-       local_depository_path=$global_depository_path
-    else
-       printf "\n  +++ no depository path found in configuration file"
-       printf "\n      for local host \"$local_host\" "
-       printf "\n      please set \"\%depository_path\" in configuration file"
-       locat=config_file; exit
-    fi
- fi
- eval local_depository_path=$local_depository_path
- eval local_depository_path=$local_depository_path
+ done < $tmp_mbuild
 
 
@@ -395,6 +378,4 @@
  column1="local source path:"; column2=$local_source_path
  printf "| $column1$column2 | \n"
- column1="make depository:"; column2=$local_depository_path
- printf "| $column1$column2 | \n"
  printf "#------------------------------------------------------------------------# \n"
 
@@ -405,226 +386,8 @@
  then
 
-    cd  $local_source_path
-
-
-       # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN
-    source_code_files=`ls -1  *.$suf`
-
-
-
-       # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN,
-       # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN
-       # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN
-    if [[ ! -d $local_depository_path ]]
-    then
-       if  mkdir $local_depository_path
-       then
-          printf "\n\n  *** directory for make depository:"
-          printf "\n           $local_depository_path"
-          printf "\n      was created\n"
-
-             # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG
-             # IHRES DATUMS INS VERZEICHNIS KOPIEREN
-          printf "\n  *** makefile and source code files are copied to"
-          printf "\n      $local_depository_path\n"
-          printf "\n      copying makefile \"$makefile\" ..."
-          cp -p  $makefile  $local_depository_path/Makefile
-
-             # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT
-             # SEIN
-          for  filename  in  $source_code_files
-          do
-             if [[ $(grep -c $filename  $makefile) = 0 ]]
-             then
-                printf "\n  +++ source code file:"
-                printf "\n         $filename"
-                printf "\n      is not listed in makefile"
-                locat=makefile; exit
-             else
-                printf "\n      copying source code file \"$filename\" ..."
-                cp -p  $filename  $local_depository_path
-             fi
-          done
-          printf "\n"
-       else
-          printf "\n  +++ directory for make depository:"
-          printf "\n           $local_depository_path"
-          printf "\n      cannot be created"
-          locat=local_depository_path; exit
-       fi
-    else
- 
-       printf "\n  *** checking file status ..."
-
-          # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS
-       if [[ $makefile -nt $local_depository_path/Makefile ]]
-       then
-          printf "\n  *** update of \"$makefile\" "
-          cp -f -p  $makefile  $local_depository_path/Makefile
-          update=true
-
-             # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE
-             # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN
-          cd  $local_depository_path
-          source_code_files_in_depository=`ls -1  *.$suf`
-          for  filename  in  $source_code_files_in_depository
-          do
-             if [[ $(grep -c $filename  Makefile) = 0 ]]
-             then
-                printf "\n  *** source code file in \"$local_depository_path\":"
-                printf "\n         $filename"
-                printf "\n      is not listed in makefile"
-                if [[ $silent = false ]]
-                then
-                   answer=dummy
-                   printf "\n\n"
-                   while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
-                   do
-                      printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ?  "
-                      read  answer
-                   done
-                   if [[ $answer = y  ||  $answer = Y ]]
-                   then
-                      base=`echo $filename | cut -d. -f2`
-                      rm -f  $filename
-                      rm -f  ${base}.o  ${base}.mod
-                      printf "\n  *** \"$filename\" deleted in \"$local_depository_path\" "
-                   else 
-                      printf "\n  *** \"$filename\" not deleted in \"$local_depository_path\" "
-                   fi
-                fi
-             fi
-          done
-          cd  -  > /dev/null  2>&1
-
-       elif [[ $local_depository_path/Makefile -nt $makefile ]]
-       then
-          printf "\n  *** makefile in depository is newer than"
-          printf "\n      \"$makefile\" "
-          if [[ $silent = false ]]
-          then
-             answer=dummy
-             printf "\n\n"
-             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
-             do
-                printf " >>> update \"$makefile\" (y/n) ?  "
-                read  answer
-             done
-             if [[ $answer = y  ||  $answer = Y ]]
-             then
-                cp -f -p  $local_depository_path/Makefile  $makefile
-                printf "\n  *** \"$makefile\" updated"
-             else 
-                printf "\n  *** \"$makefile\" not updated"
-             fi
-          fi
-       fi
-
-          # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS
-          # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN
-       for  filename  in  $source_code_files
-       do
-          if [[ $(grep -c $filename  $makefile) = 0 ]]
-          then
-             printf "\n  +++ source code file:"
-             printf "\n         $filename"
-             printf "\n      is not listed in makefile"
-             locat=makefile; exit
-          else
-             if [[ ! -f $local_depository_path/$filename ]]
-             then
-                cp -p  $filename  $local_depository_path
-                printf "\n  *** source code file \"$filename\" created in \"$local_depository_path\" "
-             fi
-             if [[ $filename -nt $local_depository_path/$filename ]]
-             then
-                printf "\n  *** update of source code file \"$filename\" "
-                cp -f -p  $filename  $local_depository_path
-                update=true
-             fi
-          fi
-       done
-
-
-          # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN
-          # ODER EVTL. NEUEREN DATUMS SIND
-       cd  $local_depository_path
-       source_code_files_in_depository=`ls -1  *.$suf`
-       cd  -  > /dev/null  2>&1
-       for  filename  in  $source_code_files_in_depository
-       do
-          if [[ ! -f $filename ]]
-          then
-             printf "\n  *** source code file \"$filename\" does not exist in current directory"
-             if [[ $silent = false ]]
-             then
-                answer=dummy
-                printf "\n\n"
-                while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
-                do
-                   printf " >>> create \"$filename\" in current directory (y/n) ?  "
-                   read  answer
-                done
-                if [[ $answer = y  ||  $answer = Y ]]
-                then
-                   cp -p  $local_depository_path/$filename  $filename
-                   printf "\n  *** source code file \"$filename\" created in current directory"
-                else 
-                   printf "\n  *** source code file \"$filename\" not created in current directory"
-                fi
-             fi
-          elif [[ $local_depository_path/$filename -nt $filename ]]
-          then
-             ls -al $local_depository_path/$filename
-             ls -al $filename
-             printf "\n  *** source code file \"$filename\" in depository is newer than in current directory"
-             if [[ $silent = false ]]
-             then
-                answer=dummy
-                printf "\n\n"
-                while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
-                do
-                   printf " >>> update \"$filename\" in current directory (y/n) ?  "
-                   read  answer
-                done
-                if [[ $answer = y  ||  $answer = Y ]]
-                then
-                   cp -f -p  $local_depository_path/$filename  $filename
-                   printf "\n  *** source code file \"$filename\" updated in current directory"
-                else 
-                   printf "\n  *** source code file \"$filename\" not updated in current directory"
-                fi
-             fi
-          fi
-       done
-
-       if [[ $update = false ]]
-       then
-          printf "\n  *** no updates necessary in \"$local_depository_path\" "
-          if [[ $silent = false ]]
-          then
-             answer=dummy
-             printf "\n\n"
-             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
-             do
-                printf " >>> continue with updates on remote hosts (y/n) ?  "
-                read  answer
-             done
-             if [[ $answer = n  ||  $answer = N ]]
-             then
-                locat=user_abort; exit
-             fi
-          fi
-       fi
-    fi
- 
-
- 
-       # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN
        # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF
        # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT
-    printf "\n\n  *** tar of makefile and source files in depository ..."  
-    cd  $local_depository_path
-    chmod u+w  Makefile  *.$suf
+    cd  $local_source_path
+    printf "\n\n  *** tar of makefile and source files in $local_source_path"  
     tar -cf  ${mainprog}_sources.tar  Makefile  *.$suf
     printf "\n"
@@ -665,5 +428,5 @@
  printf "\n  *** scanning configuration file for host(s) ..."
 
- grep  %fopts  $config_file  >  tmp_mbuild
+ grep  %fopts  $config_file  >  $tmp_mbuild
  while read line
  do
@@ -672,5 +435,5 @@
     (( ihost = ihost + 1 ))
     hostline[$ihost]="$line"
- done < tmp_mbuild
+ done < $tmp_mbuild
 
  
@@ -750,5 +513,5 @@
     line=""
     found=false
-    grep  "$remote_host_string" $config_file | grep "%remote_username"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%remote_username"  >  $tmp_mbuild
     while read line1
     do
@@ -765,5 +528,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ $found = false ]]
@@ -778,5 +541,5 @@
     line=""
     remote_source_path=""
-    grep  "$remote_host_string" $config_file | grep "%source_path"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%source_path"  >  $tmp_mbuild
     while read line1
     do
@@ -792,5 +555,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ "$remote_source_path" = "" ]]
@@ -813,5 +576,5 @@
     remote_md=""
     line=""
-    grep  "$remote_host_string" $config_file | grep "%depository_path"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%depository_path"  >  $tmp_mbuild
     while read line1
     do
@@ -827,5 +590,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ "$remote_md" = "" ]]
@@ -843,4 +606,6 @@
 
     remote_md=$(eval echo $remote_md)
+    [[ "$condition1" != "" ]]  &&  remote_md=${remote_md}_$condition1
+    [[ "$condition2" != "" ]]  &&  remote_md=${remote_md}_$condition2
 
 
@@ -848,5 +613,5 @@
     line=""
     found=false
-    grep  "$remote_host_string" $config_file | grep "%compiler_name "  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%compiler_name "  >  $tmp_mbuild
     while read line1
     do
@@ -863,5 +628,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ $found = false ]]
@@ -879,5 +644,5 @@
        line=""
        found=false
-       grep  "$remote_host_string" $config_file | grep "%compiler_name_ser"  >  tmp_mbuild
+       grep  "$remote_host_string" $config_file | grep "%compiler_name_ser"  >  $tmp_mbuild
        while read line1
        do
@@ -894,5 +659,5 @@
           fi
 
-       done < tmp_mbuild
+       done < $tmp_mbuild
 
        if [[ $found = false ]]
@@ -911,5 +676,5 @@
     line=""
     found=false
-    grep  "$remote_host_string" $config_file | grep "%cpp_options"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%cpp_options"  >  $tmp_mbuild
     while read line1
     do
@@ -927,5 +692,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ $found = false ]]
@@ -963,5 +728,5 @@
        # NETCDF-OPTIONEN ERMITTELN
     line=""
-    grep  "$remote_host_string" $config_file | grep "%netcdf_inc"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%netcdf_inc"  >  $tmp_mbuild
     while read line1
     do
@@ -978,8 +743,8 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     line=""
-    grep  "$remote_host_string" $config_file | grep "%netcdf_lib"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%netcdf_lib"  >  $tmp_mbuild
     while read line1
     do
@@ -996,5 +761,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
 
@@ -1003,5 +768,5 @@
     line=""
     found=false
-    grep  "$remote_host_string" $config_file | grep "%fopts"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%fopts"  >  $tmp_mbuild
     while read line1
     do
@@ -1022,5 +787,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ $found = false ]]
@@ -1036,5 +801,5 @@
     line=""
     found=false
-    grep  "$remote_host_string" $config_file | grep "%lopts"  >  tmp_mbuild
+    grep  "$remote_host_string" $config_file | grep "%lopts"  >  $tmp_mbuild
     while read line1
     do
@@ -1055,5 +820,5 @@
        fi
 
-    done < tmp_mbuild
+    done < $tmp_mbuild
 
     if [[ $found = false ]]
@@ -1078,4 +843,12 @@
     column1="make depository:"; column2=$remote_md
     printf "| $column1$column2 | \n"
+    line=$(echo "$remote_md" | cut -c51-)
+    while [[ "$line" != "" ]]
+    do
+       column1=""
+       column2=$line
+       printf "| $column1$column2 | \n"
+       line=$(echo "$line" | cut -c51-)
+    done
     if [[ $compile_utility_programs = true ]]
     then
@@ -1247,7 +1020,7 @@
                    # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
                 remote_md=`echo $remote_md | sed 's/\$HOME\///'`
-                /bin/scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
+                /bin/scp  ${local_source_path}/${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
              else
-                scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
+                scp  ${local_source_path}/${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
              fi
 
@@ -1477,4 +1250,28 @@
           then
 
+                # DEPOSITORY VERZEICHNIS ERZEUGEN, FALLS NOCH NICHT VORHANDEN
+             eval remote_md=$remote_md
+             if [[ ! -d $remote_md ]]
+             then
+                if  mkdir $remote_md
+                then
+                   printf "\n\n  *** directory for make depository:"
+                   printf "\n           $remote_md"
+                   printf "\n      was created\n"
+                else
+                   printf "\n  +++ directory for make depository:"
+                   printf "\n           $remote_md"
+                   printf "\n      cannot be created"
+                   locat=local_depository_path; exit
+                fi
+             fi
+
+                # QUELLTEXT-DATEIEN AUS REPOSITORY INS DEPOSITORY KOPIEREN
+             echo " "
+             echo "  *** updating sources in $remote_md"
+             cd  $remote_md
+             cp  $local_source_path/${mainprog}_sources.tar  .
+             tar xf  ${mainprog}_sources.tar
+
                 # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN
              echo " "
Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 211)
+++ palm/trunk/SCRIPTS/mrun	(revision 215)
@@ -163,4 +163,5 @@
      #                     user can provide his/her own makefile, only
      #                     default source-code filenames are allowed
+     # 14/11/08 - Siggi  - cond1 and cond2 are part of the depository name
 
 
@@ -2286,4 +2287,7 @@
        fi
        eval local_depository_path=$local_depository_path
+       [[ "$cond1" != "" ]]  &&  local_depository_path=${local_depository_path}_$cond1
+       [[ "$cond2" != "" ]]  &&  local_depository_path=${local_depository_path}_$cond2
+
 
        basename=`print $mainprog | cut -f1 -d"."`
