Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26657

Modified Files:
        ChangeLog FinkVersion.pm.in 
Log Message:
collapse code

Index: FinkVersion.pm.in
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/FinkVersion.pm.in,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- FinkVersion.pm.in   3 Jan 2006 20:14:46 -0000       1.30
+++ FinkVersion.pm.in   21 Mar 2006 06:30:14 -0000      1.31
@@ -112,31 +112,23 @@
 
 sub pkginfo_version {
        my $pv = "0";
-       my ($fn, $v);
-# first, look in the new location for stamp files
-       foreach $fn (glob("$basepath/fink/dists/stamp-*")) {
-               if ($fn =~ m{/stamp-rsync}) {
-                       return "rsync";
-               } elsif ($fn =~ m{/stamp-cvs}) {
-                       return "cvs";
-               } elsif ($fn =~ m{/stamp-rel-(.+)$}) {
-                       $v = $1;
-                       $pv = $v if ($v gt $pv);
-               }
-       }
-# if we haven't returned yet, and we didn't set the value of $v, look in the 
old location
-       if (not defined $v) {
-       foreach $fn (glob("$basepath/fink/stamp-*")) {
-               if ($fn =~ m{/stamp-rsync}) {
-                       return "rsync";
-               } elsif ($fn =~ m{/stamp-cvs}) {
-                       return "cvs";
-               } elsif ($fn =~ m{/stamp-rel-(.+)$}) {
-                       $v = $1;
-                       $pv = $v if ($v gt $pv);
+       
+       # first check the new place, then the old place
+       my @places = ("$basepath/fink/dists", "$basepath/fink");
+       for my $place (@places) {
+               for my $fn (glob("$place/stamp-*")) {
+                       if ($fn =~ m{/stamp-rsync}) {
+                               return "rsync";
+                       } elsif ($fn =~ m{/stamp-cvs}) {
+                               return "cvs";
+                       } elsif ($fn =~ m{/stamp-rel-(.+)$}) {
+                               my $v = $1;
+                               $pv = $v if ($v gt $pv);
+                       }
                }
-                               }
+               last if $pv ne '0'; # stop after the first useful place
        }
+       
        $pv = &distribution_version() if $pv eq "0";
        return $pv;
 }

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1278
retrieving revision 1.1279
diff -u -d -r1.1278 -r1.1279
--- ChangeLog   21 Mar 2006 05:02:14 -0000      1.1278
+++ ChangeLog   21 Mar 2006 06:30:14 -0000      1.1279
@@ -1,5 +1,9 @@
 2006-03-21  Daniel Macks  <[EMAIL PROTECTED]>
 
+       * FinkVersion.pm.in: Collapse copy/pasted code into a loop.
+
+2006-03-21  Daniel Macks  <[EMAIL PROTECTED]>
+
        * Validation.pm: Catch another .pc syntax that triggers a bug.
 
 2006-03-20  Dave Vasilevsky  <[EMAIL PROTECTED]>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to