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

Modified Files:
        ChangeLog PkgVersion.pm 
Log Message:
Enhanced File field, now 'absolute' paths are supported

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -r1.188 -r1.189
--- ChangeLog   10 Aug 2002 23:40:59 -0000      1.188
+++ ChangeLog   11 Aug 2002 19:30:00 -0000      1.189
@@ -1,5 +1,9 @@
 2002-08-11  Max Horn  <[EMAIL PROTECTED]>
 
+       * PkgVersion.pm: Enhanced how the Files field (in splitoffs) is handled:
+         if the given path starts with a slash, we treat it as relative to %d/%D
+         otherwise as relative to %i/%I (as we do currently anyway).
+       
        * Services.pm: Fix for bug #545155 (it was possible to cause infinite
          recursion during percent expansion).
 

Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- PkgVersion.pm       4 Aug 2002 21:03:08 -0000       1.76
+++ PkgVersion.pm       11 Aug 2002 19:30:00 -0000      1.77
@@ -1261,22 +1261,34 @@
 
   # splitoff 'Files' field
   if ($do_splitoff and $self->has_param("Files")) {
-    my (@files, $file, $target);
+    my (@files, $file, $source, $target, $target_dir);
 
     @files = split(/\s+/, $self->param("Files"));
     foreach $file (@files) {
       if ($file =~ /^(.+)\:(.+)$/) {
-       $install_script .= "\nmv %I/$1 %i/$2";
+        $source = $1;
+        $target = $2;
       } else {
-       $target = dirname($file);
-       if ($target ne ".") {
-         $target = "%i/$target";
-         $install_script .= "\ninstall -d -m 755 $target";
-       } else {
-         $target = "%i";
-       }
-       $install_script .= "\nmv %I/$file $target";
+        $source = $file;
+        $target = $file;
       }
+      # If the path starts with a slash, assume it is meant to be global
+      # and base it upon %D, otherwise treat it as relative to %I
+      if ($source =~ /^\//) {
+       $source = "%D$source";
+      } else {
+       $source = "%I/$source";
+      }
+      # Now the same for the target (but use %d and %i).
+      if ($target =~ /^\//) {
+       $target = "%d$target";
+      } else {
+       $target = "%i/$target";
+      }
+
+      $target_dir = dirname($target);
+      $install_script .= "\ninstall -d -m 755 $target_dir";
+      $install_script .= "\nmv $source $target_dir/";
     }
   }
 



-------------------------------------------------------
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