Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30307
Modified Files:
Tag: selfupdate_classes
ChangeLog SelfUpdate.pm
Log Message:
Text param for check()
Index: SelfUpdate.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/SelfUpdate.pm,v
retrieving revision 1.117.2.1
retrieving revision 1.117.2.2
diff -u -d -r1.117.2.1 -r1.117.2.2
--- SelfUpdate.pm 6 Mar 2007 17:34:05 -0000 1.117.2.1
+++ SelfUpdate.pm 6 Mar 2007 17:54:09 -0000 1.117.2.2
@@ -88,7 +88,7 @@
=back
-The optional $method parameter specifies a number indicating the
+The optional $method parameter specifies the
selfupdate method to use:
=over 4
@@ -97,11 +97,11 @@
Use the current method
-=item 1
+=item 1 or "cvs"
Use the cvs method
-=item 2
+=item 2 or "rsync"
Use the rsync method
@@ -116,22 +116,38 @@
=cut
sub check {
- my $useopt = shift || 0;
+ my $method = shift;
+
+ {
+ my %methods = (
+ 0 => undef,
+ 1 => 'cvs',
+ 2 => 'rsync',
+ 'cvs' => 'cvs',
+ 'rsync' => 'rsync',
+ );
+ $method = 0 if ! defined $method;
+ if (! exists $methods{lc $method}) {
+ die "Invalid method '$method' passed to
Selfupdate::check\n";
+ }
+ $method = $methods{lc $method};
+ }
+
my ($srcdir, $finkdir, $latest_fink, $installed_version, $answer);
$srcdir = "$basepath/src";
$finkdir = "$basepath/fink";
- if ($useopt != 0) {
+ if (defined $method) {
&print_breaking("\n Please note: the command 'fink selfupdate' "
. "should be used for routine updating; you
only need to use "
. "'fink selfupdate-cvs' or 'fink
selfupdate-rsync' if you are "
. "changing your update method. \n\n");
}
- if ((! defined($config->param("SelfUpdateMethod") )) and ! $useopt ==
0){
- if ($useopt == 1) {
+ if (! defined $config->param("SelfUpdateMethod") and defined $method) {
+ if ($method eq 'cvs') {
$answer = "cvs";
}
- elsif ($useopt == 2) {
+ elsif ($method eq 'rsync') {
$answer = "rsync";
}
else {
@@ -145,7 +161,7 @@
# The user has not chosen a selfupdatemethod yet, always ask
# if the fink.conf setting is not there.
- if ((! defined($config->param("SelfUpdateMethod") )) and $useopt == 0){
+ if (! defined $config->param("SelfUpdateMethod") and ! defined $method)
{
$answer = &prompt_selection("Choose an update method",
intro => "fink needs you to
choose a SelfUpdateMethod.",
default => [ value => "rsync" ],
@@ -167,7 +183,7 @@
}
# By now the config param SelfUpdateMethod should be set.
- if (($config->param("SelfUpdateMethod") eq "cvs") and $useopt != 2){
+ if ($config->param("SelfUpdateMethod") eq 'cvs' and $method ne 'rsync')
{
&need_devtools('cvs');
Fink::SelfUpdate::rsync->stamp_clear();
if (-d "$finkdir/dists/CVS") {
@@ -180,7 +196,7 @@
return;
}
}
- elsif (($config->param("SelfUpdateMethod") eq "rsync") and $useopt !=
1){
+ elsif ($config->param("SelfUpdateMethod") eq 'rsync' and $method ne
'cvs'){
&need_devtools('rsync');
&do_direct_rsync();
&do_finish();
@@ -189,7 +205,7 @@
# Hm, we were called with a different option than the default :(
$installed_version = &pkginfo_version();
my $selfupdatemethod = $config->param("SelfUpdateMethod");
- if (($selfupdatemethod ne "rsync") and $useopt == 2) {
+ if ($selfupdatemethod ne 'rsync' and $method eq 'rsync') {
# We temporarily disable rsync updating for 10.5, until we've decided
# how to handle it
@@ -212,7 +228,7 @@
&do_finish();
return;
}
- if (($selfupdatemethod ne "cvs") and $useopt == 1) {
+ if ($selfupdatemethod ne 'cvs' and $method eq 'cvs') {
$answer =
&prompt_boolean("The current selfupdate method is
$selfupdatemethod. "
. "Do you wish to change the default
selfupdate method ".
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1439
retrieving revision 1.1439.2.1
diff -u -d -r1.1439 -r1.1439.2.1
--- ChangeLog 4 Mar 2007 22:03:13 -0000 1.1439
+++ ChangeLog 6 Mar 2007 17:54:09 -0000 1.1439.2.1
@@ -1,3 +1,9 @@
+2007-02-26 Daniel Macks <[EMAIL PROTECTED]>
+
+ * SelfUpdate.pm: Use text-string params for check().
+ * SelfUpdate.pm, SelfUpdate/*.pm: Offload handling of stamp files
+ and removal of orphaned metadata into the method-specific classes.
+
2007-03-04 Dave Morrison <[EMAIL PROTECTED]>
* FinkVersion.pm.in, PkgVersion.pm, Validation.pm: implement Info4
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits