? 1-pogma-fink-rsync.diff Index: FinkVersion.pm.in =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/FinkVersion.pm.in,v retrieving revision 1.13 diff -u -r1.13 FinkVersion.pm.in --- FinkVersion.pm.in 27 Feb 2003 13:48:07 -0000 1.13 +++ FinkVersion.pm.in 3 Oct 2003 14:43:09 -0000 @@ -70,7 +70,9 @@ my $pv = "0"; my ($fn, $v); foreach $fn (glob("@BASEPATH@/fink/stamp-*")) { - if ($fn =~ /\/stamp-cvs/) { + if ($fn =~ /\/stamp-rsync/) { + return "rsync"; + } elsif ($fn =~ /\/stamp-cvs/) { return "cvs"; } elsif ($fn =~ /\/stamp-rel-(.+)$/) { $v = $1; Index: SelfUpdate.pm =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/SelfUpdate.pm,v retrieving revision 1.34 diff -u -r1.34 SelfUpdate.pm --- SelfUpdate.pm 3 Oct 2003 00:03:59 -0000 1.34 +++ SelfUpdate.pm 3 Oct 2003 14:43:09 -0000 @@ -52,82 +52,90 @@ ### check for new Fink release sub check { - my $usecvs = shift || 0; + my $usemethod = shift || 0; my ($srcdir, $finkdir, $latest_fink, $installed_version, $answer); $srcdir = "$basepath/src"; $finkdir = "$basepath/fink"; - - if (-d "$finkdir/CVS") { - if ($usecvs) { - $answer = 1; - } else { - print "\n"; - $answer = - &prompt_boolean("Your Fink installation is set up to update package ". - "descriptions directly from CVS. Do you want to ". - "use this setup and update now?", 1); - } - if (not $answer) { - return; - } - - &do_direct_cvs(); - &do_finish(); - return; - } - + $installed_version = &pkginfo_version(); + print "Installed version is $installed_version \n"; if ($installed_version eq "cvs" or -d "$finkdir/dists/CVS") { print "\n"; $answer = &prompt_boolean("You have previously used CVS to update package ". - "descriptions, but your Fink installation is not ". - "set up for direct CVS updating (without inject.pl). ". - "Do you want to set up direct CVS updating now?", 1); + "descriptions. It is recommended that users switch ". + "to using rsync to update package descriptions ". + "Do you want to set up direct rsync updating now?", 1); if (not $answer) { return; } - - &setup_direct_cvs(); - &do_finish(); + $config->set_param("SelfUpdateMethod", "rsync"); + $config->save(); + &rsync_check(); return; } - - - if ($usecvs or not $config->param_boolean("SelfUpdateNoCVS")) { + if ($usemethod == 1) { + $answer = &prompt_boolean("CVS updating is deprecated, are you sure ". + "you wist to continue using it?",1); + if (not $answer) { + return; + } + if (! -d "$finkdir/dists/CVS") { + &setup_direct_cvs(); + &do_finish(); + $config->set_param("SelfUpdateMethod", "cvs"); + $config->save(); + return; + } + else { + &do_direct_cvs(); + &do_finish(); + return; + } + } + if ($usemethod == 2 or not $config->param("SelfUpdateMethod")) { print "\n"; $answer = &prompt_boolean("The selfupdate function can track point releases ". - "or it can set up your Fink installation to update ". - "package descriptions from CVS. Updating from CVS ". - "has the advantage that it is more up to date than ". - "the last point release. On the other hand, ". - "the point release may be more mature or have ". - "less bugs. Nevertheless, CVS is recommended. ". - "Do you want to set up direct CVS updating?", - $usecvs); + "or it can set up your Fink installation to update ". + "package descriptions via rsync. Updating with rsync ". + "has the advantage that it is more up to date than ". + "the last point release. On the other hand, ". + "the point release may be more mature or have ". + "less bugs. Nevertheless, rsync is recommended. ". + "Do you want to set up direct rsync updating?", + $usemethod); if (not $answer) { print "\n"; &print_breaking("Okay, the selfupdate command will stick to point ". "releases from now on. If you ever rethink your ". - "decision, run 'fink selfupdate-cvs' to be asked ". + "decision, run 'fink selfupdate-rsync' to be asked ". "again."); print "\n"; } } else { $answer = 0; } + if ($config->param("SelfUpdateMethod") eq "rsync") { + &rsync_check(); + return; + } elsif ($config->param("SelfUpdateMethod") eq "cvs") { + &do_direct_cvs(); + &do_finish(); + return; + } elsif ($config->param("SelfUpdateMethod") eq "tarball") { + $answer = 0; + } if ($answer) { - &setup_direct_cvs(); - &do_finish(); + $config->param("SelfUpdateMethod", "rsync"); + $config->save(); + &rsync_check(); return; + } else { + $config->set_param("SelfUpdateMethod", "tarball"); + $config->save(); } - - # remember the choice - $config->set_param("SelfUpdateNoCVS", "true"); - $config->save(); - # get the file with the current release number my $currentfink; $currentfink = "CURRENT-FINK"; @@ -496,7 +504,7 @@ my ($descdir, @sb, $cmd, $tree, $rmcmd, $vercmd, $username, $msg); my $dist = $Fink::Config::distribution; my $rsynchost = $config->param_default("Mirror-rsync", "rsync://fink.opendarwin.org/finkinfo/"); - + my $touchcmd = "touch stamp-rsync-live && rm -f stamp-cvs-live"; # add rsync quiet flag if verbosity level permits my $verbosity = "-q"; if (Fink::Config::verbosity_level() > 1) { @@ -518,7 +526,7 @@ # selfupdate-cvs. However, don't actually do the removal until # we've tried to put something there. $rmcmd = "find . -name CVS | xargs rm -rf "; - $vercmd = "rsync -az $verbosity $rsynchost/VERSION $dist/VERSION"; + $vercmd = "rsync -az $verbosity $rsynchost/VERSION VERSION"; foreach $tree ($config->get_treelist()) { if( !grep(/stable/,$tree) ) { next; @@ -530,13 +538,9 @@ mkdir "$dist/$tree/"; } - $rmcmd = "find . -name CVS | xargs rm -rf "; - $vercmd = "rsync -az $verbosity $rsynchost/VERSION $dist/VERSION"; if ($sb[4] != 0 and $> != $sb[4]) { ($username) = getpwuid($sb[4]); $cmd = "su $username -c '$cmd'"; - $rmcmd = "su $username -c '$rmcmd'"; - $vercmd = "rsync -az $verbosity $rsynchost/VERSION $dist/VERSION"; $msg .= "The 'su' command will be used to run the rsync command as the user '$username'. "; } @@ -550,6 +554,7 @@ } &execute($rmcmd); &execute($vercmd); + &execute($touchcmd); } ### EOF