Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv2695/perlmod/Fink
Modified Files:
Tag: selfupdate_classes
ChangeLog Config.pm FinkVersion.pm.in SelfUpdate.pm
Log Message:
Abolish all use of stamp-* files, since they duplicate data already in
the VERSION file. Scrap all package-info version handlers from
FinkVersion.pm.in, put useful functionality from them solely in
SelfUpdate.pm.
Index: FinkVersion.pm.in
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/FinkVersion.pm.in,v
retrieving revision 1.36.2.2
retrieving revision 1.36.2.3
diff -u -d -r1.36.2.2 -r1.36.2.3
--- FinkVersion.pm.in 20 Mar 2007 01:37:55 -0000 1.36.2.2
+++ FinkVersion.pm.in 20 Mar 2007 07:13:41 -0000 1.36.2.3
@@ -28,7 +28,7 @@
require Exporter;
our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(&fink_version &distribution_version
&default_binary_version &pkginfo_version &max_info_level);
+our @EXPORT_OK = qw(&fink_version &default_binary_version &max_info_level);
our %EXPORT_TAGS = ('ALL' => [EMAIL PROTECTED]);
use Fink::Config qw($basepath);
@@ -44,9 +44,7 @@
use Fink::FinkVersion qw(:ALL);
my $fink_version = fink_version;
- my $dist_version = distribution_version;
my $default_version = default_binary_version($distribution);
- my $pkginfo_version = pkginfo_version;
my $max_info_level = max_info_level;
=head1 DESCRIPTION
@@ -75,30 +73,6 @@
}
-=item distribution_version
-
- my $dist_version = distribution_version
-
-Returns the fink distribution version you're currently using.
-Deprecated...only use this if Fink::SelfUpdate::last_done fails.
-
-=cut
-
-sub distribution_version {
- my $dv;
- if (-f "$basepath/fink/dists/VERSION") {
- chomp($dv = cat "$basepath/fink/dists/VERSION");
- } elsif (-f "$basepath/fink/VERSION") {
- chomp($dv = cat "$basepath/fink/VERSION");
- } elsif (-f "$basepath/etc/fink-release") {
- chomp($dv = cat "$basepath/etc/fink-release");
- } else {
- $dv = "unknown";
- }
- return $dv;
-}
-
-
=item default_binary_version
my $b_dist_version = default_binary_version($distribution);
@@ -116,44 +90,6 @@
return $bindists{$distribution};
}
-
-=item pkginfo_version
-
- my $pkginfo_version = pkginfo_version;
-
-Returns from whence you updated your packages. If you're using a point
-release it will return that. Otherwise if you're using one of the dynamic
-methods...
-
- rsync packages updated via rsync
- cvs packages updated via cvs
-
-=cut
-
-sub pkginfo_version {
- my $pv = "0";
-
- # 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;
-}
-
-
=item max_info_level
my $max_info_level = max_info_level;
Index: Config.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Config.pm,v
retrieving revision 1.87.4.3
retrieving revision 1.87.4.4
diff -u -d -r1.87.4.3 -r1.87.4.4
--- Config.pm 20 Mar 2007 04:08:40 -0000 1.87.4.3
+++ Config.pm 20 Mar 2007 07:13:41 -0000 1.87.4.4
@@ -320,13 +320,9 @@
require Fink::FinkVersion;
require Fink::SelfUpdate;
- my ($method, $timestamp) = &Fink::SelfUpdate::last_done;
- my $dv;
- if (defined $method) {
- $dv = "selfupdate-$method at " . localtime($timestamp);
- } else {
- $dv = Fink::FinkVersion::distribution_version();
- }
+ my ($method, $timestamp, $misc) = &Fink::SelfUpdate::last_done;
+ my $dv = "selfupdate-$method ($misc)";
+ $dv .= ' '.localtime($timestamp) if $timestamp;
print "Package manager version: "
. Fink::FinkVersion::fink_version() . "\n";
Index: SelfUpdate.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/SelfUpdate.pm,v
retrieving revision 1.117.2.11
retrieving revision 1.117.2.12
diff -u -d -r1.117.2.11 -r1.117.2.12
--- SelfUpdate.pm 20 Mar 2007 04:08:40 -0000 1.117.2.11
+++ SelfUpdate.pm 20 Mar 2007 07:13:41 -0000 1.117.2.12
@@ -197,15 +197,15 @@
# clear remnants of any methods other than one to be used
foreach my $subclass (@avail_subclasses) {
next if $subclass eq $subclass_use;
- $subclass->stamp_clear();
$subclass->clear_metadata();
}
# Let's do this thang!
- $subclass_use->do_direct();
- $subclass_use->stamp_set();
- &update_version_file($method);
- &do_finish();
+ my $update_data = $subclass_use->do_direct();
+ if (defined $update_data) {
+ &update_version_file($method, $update_data);
+ &do_finish();
+ }
}
=item do_finish
@@ -310,15 +310,17 @@
=item update_version_file
- &update_version_file($method);
+ &update_version_file($method, $data);
Marks the %p/fink/$distribution/VERSION file with information about
-the just-done selfupdate using method $method. Returns nothing useful.
+the just-done selfupdate using method $method. The $data is also
+stored in the VERSION file. Returns nothing useful.
=cut
sub update_version_file {
my $method = shift;
+ my $data = shift;
my $filename = "$basepath/fink/$distribution/VERSION";
my @lines = ();
@@ -336,7 +338,9 @@
@lines = grep { $_ !~ /^\s*SelfUpdate\s*:/i } @lines;
# add new selfupdate info
- push @lines, "SelfUpdate: $method\@".time()."\n";
+ my $line = "SelfUpdate: $method\@" . time();
+ $line .= " $data" if defined $data && length $data;
+ push @lines, $line;
# save new file contents atomically
if (open my $FH, '>', "$filename.tmp") {
@@ -349,16 +353,16 @@
=item last_done
- my ($last_method,$last_time) = Fink::SelfUpdate::last_done();
- if (defined $last_method) {
- $last_time = time() - $last_time;
- print "Last selfupdate was by $last_method, $age seconds ago\n";
- } else {
- print "Could not determine last selfupdate information\n";
+ my ($last_method,$last_time, $last_data) =
Fink::SelfUpdate::last_done();
+ print "Last selfupdate was by $last_method";
+
+ print ", , $age seconds ago\n";
+ if ($last_time) {
+ print " ", time() - $last_time, " seconds ago";
}
-Returns the method and time of the last selfupdate, or undefs if the
-info could not be determined.
+Returns the method, time, and any method-specific data for the last
+selfupdate that was performed.
=cut
@@ -366,15 +370,38 @@
my $filename = "$basepath/fink/$distribution/VERSION";
if (open my $FH, '<', $filename) {
- while (<$FH>) {
- if (/^\s*SelfUpdate\s*:\s*(.+?)\@(\d+)/i) {
- return ($1, $2);
+ my @lines = <$FH>;
+ close $FH;
+
+ # first look for the new-style token
+ foreach my $line (@lines) {
+ if ($line =~ /^\s*SelfUpdate\s*:\s*(.*)\s*$/i) {
+ my $value = $1;
+ if ($value =~ /^(.+?)\@(\d+)\s*(.*)/) {
+ return ($1, $2, $3);
+ } elsif ($line =~ /^(\S+)\s*(.*)/) {
+ return ($1, 0, $2);
+ } else {
+ print_breaking_stderr "WARNING:
Skipping malformed line \"$line\" in $filename.";
+ }
}
}
- close $FH;
+
+ # next see if it's new multiline format, picking matching
Dist/Arch
+ # er, what *is* this format? Good thing we aren't using it yet:)
+
+ # maybe original one-line format?
+ my $line = $lines[0];
+ chomp $line;
+ if ($line =~ /^(.*)\.(cvs|rsync)$/) {
+ return ($2, 0, $1);
+ }
+ return ('point', 0, $line);
}
- return (undef, undef);
+ # give up
+ print_breaking_stderr "WARNING: could not read $filename: $!\n";
+ return (undef, undef, undef);
}
=back
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1439.2.17
retrieving revision 1.1439.2.18
diff -u -d -r1.1439.2.17 -r1.1439.2.18
--- ChangeLog 20 Mar 2007 04:44:31 -0000 1.1439.2.17
+++ ChangeLog 20 Mar 2007 07:13:40 -0000 1.1439.2.18
@@ -1,3 +1,11 @@
+2007-03-20 Daniel Macks <[EMAIL PROTECTED]>
+
+ * Config.pm, FinkVersion.pm.in, SelfUpdate.pm, SelfUpdate/*:
+ Abolish FV's pkginfo_version and distribution_version and stop
+ using the stamp-* files altogether (only ever had dup data from
+ VERSION and won't work in multidist world), merge functionality
+ into functions in the main SU VERSION file handlers.
+
2007-03-19 Daniel Macks <[EMAIL PROTECTED]>
* Bootstrap.pm: recognize 10.4.9
-------------------------------------------------------------------------
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