Author: ranger Date: Tue Oct 31 18:04:28 2006 New Revision: 448 URL: <http://svn.finkproject.org/websvn/listing.php?sc=1&rev=448&repname=user%3a+ranger> Log: translate custommmirror stuff
Added: trunk/experimental/tounstable.pl (with props) Removed: trunk/experimental/tounstable.sh Added: trunk/experimental/tounstable.pl URL: <http://svn.finkproject.org/websvn/filedetails.php?path=/trunk/experimental/tounstable.pl&rev=448&repname=user%3a+ranger> ============================================================================== --- trunk/experimental/tounstable.pl (added) +++ trunk/experimental/tounstable.pl Tue Oct 31 18:04:28 2006 @@ -1,0 +1,90 @@ +#!/usr/bin/perl -w + +use strict; +use File::Temp; +use IO::Handle; +use vars qw( + $RANGERMIRROR +); + +{ + my $handle = IO::Handle->new(); + if (open($handle, 'rangermirror.txt')) + { + local $/ = undef; + $RANGERMIRROR = <$handle>; + close ($handle); + } + else + { + die "unable to read rangermirror.txt: $!\n"; + } +} + +for my $file (@ARGV) +{ + $file =~ s/^\.\///; + if ($file =~ /^\//) + { + warn "$file has an absolute path, skipping\n"; + next; + } + if ($file =~ /\.(info|patch)$/) + { + for my $release ('10.3', '10.4') + { + my $releasefile = $file; + $releasefile =~ s,^common/,${release}/,; + my ($fromfile, $tofile); + if (-f $releasefile) + { + $fromfile = $releasefile; + $tofile = $releasefile; + $tofile =~ s,^${release},/sw/fink/${release}/unstable,; + } + else + { + $fromfile = $file; + $tofile = $file; + $tofile =~ s,^common,/sw/fink/${release}/unstable,; + } + print "$fromfile => $tofile\n"; + copy_file($fromfile, $tofile); + } + } +} + +sub copy_file { + my $fromfile = shift; + my $tofile = shift; + + my $filein = IO::Handle->new(); + my $fileout = IO::Handle->new(); + if (open ($filein, $fromfile)) + { + if (open ($fileout, '>' . $tofile)) + { + while (my $line = <$filein>) + { + if ($line =~ /^\s*CustomMirror\s*:\s*RangerMirror/i) + { + print $fileout $RANGERMIRROR; + } + else + { + print $fileout $line; + } + } + close ($fileout); + } + else + { + warn "unable to write to $tofile: $!\n"; + } + close ($filein); + } + else + { + warn "unable to read from $fromfile: $!\n"; + } +} Propchange: trunk/experimental/tounstable.pl ------------------------------------------------------------------------------ svn:executable = * ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fink-commits