Permalink
Browse files

Import branch:selfupdate_classes into HEAD

  • Loading branch information...
dmacks committed Apr 10, 2007
1 parent 584e802 commit bba416abeb0ae032a71574d3d0b7c337a38eacec
View
@@ -1,3 +1,7 @@
+2007-04-10 Daniel Macks <dmacks@netspace.org>
+
+ * MANIFEST, install.sh: merge from selfupdate_classes branch
+
2007-03-17 Dave Morrison <drm@finkproject.org>
* VERSION: Make fink HEAD always >> 0.27.x, since that has now
View
@@ -64,6 +64,10 @@ perlmod/Fink/Package.pm
perlmod/Fink/PkgVersion.pm
perlmod/Fink/Scanpackages.pm
perlmod/Fink/SelfUpdate.pm
+perlmod/Fink/SelfUpdate/Base.pm
+perlmod/Fink/SelfUpdate/CVS.pm
+perlmod/Fink/SelfUpdate/point.pm
+perlmod/Fink/SelfUpdate/rsync.pm
perlmod/Fink/Services.pm
perlmod/Fink/Shlibs.pm
perlmod/Fink/Status.pm
@@ -145,6 +149,9 @@ t/PkgVersion/non_consecutive_source.t
t/PkgVersion/opengl-rb18.info
t/PkgVersion/sed-4.0.5-1.info
t/PkgVersion/xml-parser-pm560-2.31-5.info
+t/SelfUpdate/ChangeLog
+t/SelfUpdate/subclasses.t
+t/SelfUpdate/last_done.t
t/Services/ChangeLog
t/Services/eval_conditional.t
t/Services/execute_nonroot_okay.t
View
56 STYLE
@@ -21,12 +21,66 @@ cause extremely unnatural code formatting
...
}
* use a whitespace after keywords: "if (foo)" and not "if(foo)"
+
==========
Also, all perl code should be clean under "-w" and "strict"
standards. A typical perl script would thus begin:
- #!/usr/bin/perl -w
+ #!/usr/bin/perl
# -*- mode: Perl; tab-width: 4; -*-
# vim: ts=4 sw=4 noet
use strict;
+ use warnings;
+
+==========
+
+Please try to avoid circular use/require among the perl modules,
+especially during their startup (BEGIN blocks, etc).
+
+ Fink uses nothing
+ Fink::Base uses nothing
+ Fink::CLI uses nothing
+ Fink::Checksum uses Fink::Config Fink::Services
+ Fink::Checksum::MD5 uses Fink::Checksum Fink::Config
+ Fink::Checksum::SHA1 uses Fink::Checksum Fink::Config
+ Fink::Checksum::SHA256 uses Fink::Checksum Fink::Config
+ Fink::Command uses nothing
+ Fink::Config uses Fink::Base Fink::Command Fink::Services
+ Fink::Configure uses Fink::Config Fink::Services Fink::CLI
+ Fink::Finally uses Fink::Base
+ Fink::FinkVersion uses nothing
+ Fink::Mirror Fink::Services Fink::CLI Fink::Config
+ Fink::NetAccess uses Fink::Services Fink::CLI Fink::Config Fink::Mirror Fink::Command Fink::FinkVersion
+ Fink::Notify uses Fink::Config Fink::Services
+ Fink::Notify::Growl uses Fink::Notify Fink::Config
+ Fink::Notify::QuickSilver uses Fink::Notify Fink::Config
+ Fink::Notify::Say uses Fink::Notify Fink::Config
+ Fink::Notify::Syslog uses Fink::Notify Fink::Config
+ Fink::ScanPackages uses Fink::Base Fink::CLI Fink::Command Fink::Services
+ Fink::SelfUpdate::Base uses Fink::CLI Fink::Config
+ Fink::Services uses Fink::Command Fink::CLI
+ Fink::Status uses Fink::Config
+ Fink::SysState uses Fink::CLI Fink::Config Fink::Services Fink::Status Fink::VirtPackage
+ Fink::Validation uses Fink::Services Fink::Config
+ Fink::VirtPackage uses Fink::Config Fink::Status
+ Text::DelimMatch uses nothing (imported from CPAN)
+ Text::ParseWords uses nothing (imported from CPAN)
+
+There's a cycle here:
+
+ Fink::Package uses Fink::Base Fink::Services Fink::CLI Fink::Config Fink::Command Fink::PkgVersion Fink::FinkVersion Fink::VirtPackage
+ Fink::PkgVersion uses Fink::Base Fink::Services Fink:CLI Fink::Config Fink::NetAccess Fink::Mirror Fink::Package Fink::Status Fink::VirtPackage Fink::Bootstrap Fink::Command Fink::Notify Fink::Shlibs Fink::Validation Fink::Text::DelimMatch Fink::Text::ParseWords Fink::Checksum
+
+These have not yet been checked for cycles:
+
+ Fink::Finally::BuildConflicts uses Fink::CLI Fink::Config Fink::PkgVersion
+ Fink::Finally::Buildlock uses Fink::Base Fink::Command Fink::Config Fink::CLI Fink::PkgVersion Fink::Services
+ Fink::Bootstrap uses Fink::Config Fink::Services Fink::CLI Fink::Package Fink::PkgVersion Fink::Engine Fink::Command Fink::Checksum
+ Fink::Engine Fink::Services Fink::CLI Fink::Configure Fink::Finally Fink::Finally::Buildlock Fink::Finally::BuildConflicts Fink::Package Fink::PkgVersion Fink::Config Fink::Status Fink::Command Fink::Notify Fink::Validation Fink::Checksum Fink::Scanpackages
+ Fink::SelfUpdate uses Fink::Services Fink::Bootstrap Fink::CLI Fink::Config Fink::Engine Fink::Package
+ Fink::SelfUpdate::CVS uses Fink::SelfUpdate::Base Fink::CLI Fink::Config Fink::Package Fink::Command Fink::Services
+ Fink::SelfUpdate::point uses Fink::SelfUpdate::Base Fink::CLI Fink::Config Fink::NetAccess Fink::Command Fink::Services
+ Fink::SelfUpdate::rsync uses Fink::SelfUpdate::Base Fink::CLI Fink::Config Fink::Mirror Fink::Package Fink::Command Fink::Services
+ Fink::Shlibs uses Fink::Base Fink::Services Fink::CLI Fink::Config Fink::PkgVersion
+
View
@@ -40,7 +40,7 @@ chmod 755 "$basepath"
for dir in bin sbin \
lib lib/perl5 lib/perl5/Fink \
- lib/perl5/Fink/{Text,Notify,Checksum,Finally} \
+ lib/perl5/Fink/{Text,Notify,Checksum,Finally,SelfUpdate} \
lib/fink lib/fink/update \
etc etc/dpkg \
share share/doc share/doc/fink \
@@ -69,7 +69,7 @@ done
install -c -m 755 fink-dpkg-status-cleanup "$basepath/sbin/"
# copy all perl modules
-for subdir in . Fink Fink/{Text,Notify,Checksum,Finally} ; do
+for subdir in . Fink Fink/{Text,Notify,Checksum,Finally,SelfUpdate} ; do
for file in perlmod/${subdir}/*.pm ; do
if [ -f $file ]; then
install -c -p -m 644 $file "$basepath/lib/perl5/$subdir"
@@ -136,6 +136,10 @@ for p in \
Fink::PkgVersion \
Fink::Scanpackages \
Fink::SelfUpdate \
+ Fink::SelfUpdate::Base \
+ Fink::SelfUpdate::CVS \
+ Fink::SelfUpdate::rsync \
+ Fink::SelfUpdate::point \
Fink::Services \
Fink::Shlibs \
Fink::SysState \
View
@@ -1,3 +1,7 @@
+2007-04-10 Daniel Macks <dmacks@netspace.org>
+
+ * Config.pm, Engine.pm, FinkVersion.pm.in, SelfUpdate.pm, SelfUpdate/*: merge from selfupdate_classes branch
+
2007-04-04 Benjamin Reed <rangerrick@users.sourceforge.net.
* NetAccess.pm: Use lftpget if available and appropriate
View
@@ -318,8 +318,12 @@ HELPFORMAT
if ($opts{showversion}) {
require Fink::FinkVersion;
+ require Fink::SelfUpdate;
- my $dv = Fink::FinkVersion::distribution_version();
+ my ($method, $timestamp, $misc) = &Fink::SelfUpdate::last_done;
+ my $dv = "selfupdate-$method";
+ $dv .= " ($misc)" if length $misc;
+ $dv .= ' '.localtime($timestamp) if $timestamp;
print "Package manager version: "
. Fink::FinkVersion::fink_version() . "\n";
View
@@ -368,21 +368,28 @@ sub cmd_bootstrap {
}
sub cmd_selfupdate {
+ # TODO: Getoptify:
+ # Add --mode=$method that passes $method to check()
+ # Add --finish that does after-stuff
+ # Add --list-modes that lists all SU:: methods?
require Fink::SelfUpdate;
Fink::SelfUpdate::check();
}
sub cmd_selfupdate_cvs {
+ # TODO: rewrite as wrapper around cmd_selfupdate (forge cmdline)
require Fink::SelfUpdate;
- Fink::SelfUpdate::check(1);
+ Fink::SelfUpdate::check('cvs');
}
sub cmd_selfupdate_rsync {
+ # TODO: rewrite as wrapper around cmd_selfupdate (forge cmdline)
require Fink::SelfUpdate;
- Fink::SelfUpdate::check(2);
+ Fink::SelfUpdate::check('rsync');
}
sub cmd_selfupdate_finish {
+ # TODO: rewrite as wrapper around cmd_selfupdate (forge cmdline)
require Fink::SelfUpdate;
Fink::SelfUpdate::finish();
}
@@ -398,6 +405,7 @@ sub cmd_listplugins {
print "Checksum Plugins:\n\n";
Fink::Checksum->list_plugins();
print "\n";
+ # TODO: add SU plugins? (need to implement back-end too)
}
sub cmd_apropos {
@@ -1586,50 +1594,31 @@ sub real_install {
}
# don't bother doing this on point release, of course it's out-of-date ;)
- if ($config->param("SelfUpdateMethod") ne "point")
- {
- my $cache_file = Fink::Package->db_index;
-
- my $dir = IO::Handle->new();
- if (opendir($dir, "$basepath/fink/dists"))
- {
- for my $entry (readdir($dir))
- {
- if ($entry =~ /^stamp-/)
- {
- $cache_file = $basepath . '/fink/dists/' . $entry;
- last;
- }
+ if ($config->param("SelfUpdateMethod") ne "point") {
+ my $up_to_date_text;
+
+ require Fink::SelfUpdate;
+ my ($method, $timestamp, $data) = &Fink::SelfUpdate::last_done;
+ if ($timestamp) {
+ my $age = (time-$timestamp) / (60*60*24); # days since last selfupdate
+ if ($age > 14) {
+ $up_to_date_text = "your info file index has not been updated for " . int($age) . " days.";
}
- closedir($dir);
- }
- else
- {
- warn "unable to open $basepath/fink/dists: $!";
+ } else {
+ $up_to_date_text = "unable to determine last selfupdate time.";
}
-
- # FIXME: this needs to be reworked with the new Selfupdate code
- # when it hits head
- if (not -f $cache_file or (-M $cache_file > 14)) {
+ if (defined $up_to_date_text) {
my $oldindexes = lc(Fink::Config::get_option("OldIndexes", "warn"));
if ($oldindexes !~ /^(ignore|update|warn)$/) {
$oldindexes = 'warn';
print_breaking_stderr "WARNING: unknown value for 'OldIndexes' in fink.conf: $oldindexes";
}
-
- my $up_to_date_text;
- if (-f $cache_file)
- {
- $up_to_date_text = "WARNING: your info file index has not been updated for " . int(-M $cache_file) . " days.";
- } else {
- $up_to_date_text = "WARNING: your info file index does not exist.";
- }
-
+
if ($oldindexes eq "warn") {
- print_breaking_stderr $up_to_date_text . " You should run 'fink selfupdate' to get the latest package descriptions.\n";
+ print_breaking_stderr "WARNING: $up_to_date_text You should run 'fink selfupdate' to get the latest package descriptions.\n";
} elsif ($oldindexes eq "update") {
- print_breaking_stderr $up_to_date_text . " Fink will now update it automatically.";
+ print_breaking_stderr "WARNING: $up_to_date_text Fink will now update it automatically.";
require Fink::SelfUpdate;
Fink::SelfUpdate::check();
}
@@ -28,12 +28,9 @@ use warnings;
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' => \@EXPORT_OK);
-use Fink::Config qw($basepath);
-use Fink::Command qw(cat);
-
=head1 NAME
@@ -44,9 +41,7 @@ Fink::FinkVersion - Fink version numbers
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,29 +70,6 @@ sub fink_version {
}
-=item distribution_version
-
- my $dist_version = distribution_version
-
-Returns the fink distribution version you're currently using.
-
-=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);
@@ -115,44 +87,6 @@ sub default_binary_version {
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;
View
@@ -127,7 +127,7 @@ themselves virtual (from Status or VirtPackage).
### Do not change API! This is used by FinkCommander (fpkg_list.pl)
sub is_virtual {
- use Fink::VirtPackage;
+ use Fink::VirtPackage; # why is this here?
my $self = shift;
return $self->{_virtual};
Oops, something went wrong.

0 comments on commit bba416a

Please sign in to comment.