Update of /cvsroot/fink/fink/perlmod/Fink
In directory usw-pr-cvs1:/tmp/cvs-serv2859

Modified Files:
        ChangeLog PkgVersion.pm Services.pm 
Log Message:
Patch #579210: RuntimeVars field added (thanks to Sylvain Cuaz for this); Justin, are 
you sure 2002-31-28 is a valid date? :-)

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -r1.178 -r1.179
--- ChangeLog   31 Jul 2002 15:11:45 -0000      1.178
+++ ChangeLog   3 Aug 2002 13:14:08 -0000       1.179
@@ -1,7 +1,12 @@
-2002-31-28  Justin F. Hallett  <[EMAIL PROTECTED]>
+2002-08-03  Max Horn  <[EMAIL PROTECTED]>
+
+       * PkgVersion.pm, Services.pm: Patch #579210: RuntimeVars field added
+         (thanks to Sylvain Cuaz for this)
+
+2002-07-31  Justin F. Hallett  <[EMAIL PROTECTED]>
 
        * Small fix to Configure.pm for the verbosity level selection,
-          which was reported not working.  Should be fine now.
+         which was reported not working. Should be fine now.
 
 2002-07-28  Justin F. Hallett  <[EMAIL PROTECTED]>
 
@@ -15,15 +20,15 @@
 
 2002-07-26  Justin F. Hallett  <[EMAIL PROTECTED]>
 
-        * Services.pm: Fix for the Jag Argument "M-?M-^?M-X" isn't numeric
-          in numeric eq (==) at /sw/lib/perl5/Fink/Engine.pm line 330, <SW_VERS>
-          line 2. Bug.  But COLUMNS needs to bet exported in init.{csh, sh}
+       * Services.pm: Fix for the Jag Argument "M-?M-^?M-X" isn't numeric
+         in numeric eq (==) at /sw/lib/perl5/Fink/Engine.pm line 330, <SW_VERS>
+         line 2. Bug.  But COLUMNS needs to bet exported in init.{csh, sh}
 
 2002-07-25  Justin F. Hallett  <[EMAIL PROTECTED]>
 
        * Services.pm: Temp Fix for the Jag Argument "M-?M-^?M-X" isn't numeric
-          in numeric eq (==) at /sw/lib/perl5/Fink/Engine.pm line 330, <SW_VERS>
-          line 2. Bug.  Need better fix in future, maybe read $ENV{COLUMNS}
+         in numeric eq (==) at /sw/lib/perl5/Fink/Engine.pm line 330, <SW_VERS>
+         line 2. Bug.  Need better fix in future, maybe read $ENV{COLUMNS}
 
 2002-07-25  Max Horn  <[EMAIL PROTECTED]>
        

Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- PkgVersion.pm       28 Jul 2002 17:15:30 -0000      1.73
+++ PkgVersion.pm       3 Aug 2002 13:14:08 -0000       1.74
@@ -1299,6 +1299,36 @@
     }
   }
 
+  # generate commands to install profile.d scripts
+  if ($self->has_param("RuntimeVars")) {
+  
+    my ($var, $value, $vars, $properties);
+
+    $vars = $self->param("RuntimeVars");
+    # get rid of any indention first
+    $vars =~ s/^\s+//gm;
+    # Read the set if variavkes (but don't change the keys to lowercase)
+    $properties = &read_properties_var($vars, 1);
+
+    if(scalar keys %$properties > 0){
+      $install_script .= "\ninstall -d -m 755 %i/etc/profile.d";
+      while (($var, $value) = each %$properties) {
+        $install_script .= "\necho \"setenv $var '$value'\" >> 
+%i/etc/profile.d/%n.csh.env";
+        $install_script .= "\necho \"export $var='$value'\" >> 
+%i/etc/profile.d/%n.sh.env";
+      }
+      # make sure the scripts exist
+      $install_script .= "\ntouch %i/etc/profile.d/%n.csh";
+      $install_script .= "\ntouch %i/etc/profile.d/%n.sh";
+      # prepend *.env to *.[c]sh
+      $install_script .= "\ncat %i/etc/profile.d/%n.csh >> 
+%i/etc/profile.d/%n.csh.env";
+      $install_script .= "\ncat %i/etc/profile.d/%n.sh >> %i/etc/profile.d/%n.sh.env";
+      $install_script .= "\nmv -f %i/etc/profile.d/%n.csh.env 
+%i/etc/profile.d/%n.csh";
+      $install_script .= "\nmv -f %i/etc/profile.d/%n.sh.env %i/etc/profile.d/%n.sh";
+      # make them executable (to allow them to be sourced by /sw/bin.init.[c]sh)
+      $install_script .= "\nchmod 755 %i/etc/profile.d/%n.*";
+    }
+  }
+
   $install_script .= "\nrm -f %i/info/dir %i/info/dir.old %i/share/info/dir 
%i/share/info/dir.old";
 
   ### install

Index: Services.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Services.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Services.pm 26 Jul 2002 22:18:19 -0000      1.24
+++ Services.pm 3 Aug 2002 13:14:08 -0000       1.25
@@ -98,30 +98,36 @@
 ### read properties file
 
 sub read_properties {
-   my ($file) = @_;
+   my ($file) = shift;
+   # do we make the keys all lowercase
+   my ($notLC) = shift || 0;
    my (@lines);
    
    open(IN,$file) or die "can't open $file: $!";
    @lines = <IN>;
    close(IN);
-   return read_properties_lines($file, @lines);
+   return read_properties_lines($file, $notLC, @lines);
 }
 
 ### read properties from a variable with text
 
 sub read_properties_var {
-   my ($var) = @_;
+   my ($var) = shift;
+   # do we make the keys all lowercase
+   my ($notLC) = shift || 0;
    my (@lines);
    my ($line);
 
    @lines = split /^/m,$var;
-   return read_properties_lines("", @lines);
+   return read_properties_lines("", $notLC, @lines);
 }
 
 ### read properties from a list of lines.
 
 sub read_properties_lines {
   my ($file) = shift;
+  # do we make the keys all lowercase
+  my ($notLC) = shift || 0;
   my (@lines) = @_;
   my ($hash, $lastkey, $heredoc);
 
@@ -142,7 +148,7 @@
     } else {
       next if /^\s*\#/;   # skip comments
       if (/^([0-9A-Za-z_.\-]+)\:\s*(\S.*?)\s*$/) {
-       $lastkey = lc $1;
+        $lastkey = $notLC ? $1 : lc $1;
        if ($2 eq "<<") {
          $hash->{$lastkey} = "";
          $heredoc = 1;
@@ -170,6 +176,7 @@
 
 sub read_properties_multival {
   my ($file) = @_;
+  my ($notLC) = shift || 0;
   my ($hash, $lastkey, $lastindex);
 
   $hash = {};
@@ -180,7 +187,7 @@
   while (<IN>) {
     next if /^\s*\#/;   # skip comments
     if (/^([0-9A-Za-z_.\-]+)\:\s*(\S.*?)\s*$/) {
-      $lastkey = lc $1;
+      $lastkey = $notLC ? $1 : lc $1;
       if (exists $hash->{$lastkey}) {
        $lastindex = @{$hash->{$lastkey}};
        $hash->{$lastkey}->[$lastindex] = $2;



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Fink-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to