Skip to content
Browse files

Import branch:selfupdate_classes into HEAD

  • Loading branch information...
1 parent 584e802 commit bba416abeb0ae032a71574d3d0b7c337a38eacec @dmacks dmacks committed Apr 10, 2007
View
4 ChangeLog
@@ -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
7 MANIFEST
@@ -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
8 install.sh
@@ -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
4 perlmod/Fink/ChangeLog
@@ -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
6 perlmod/Fink/Config.pm
@@ -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
61 perlmod/Fink/Engine.pm
@@ -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();
}
View
68 perlmod/Fink/FinkVersion.pm.in
@@ -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
2 perlmod/Fink/Package.pm
@@ -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};
View
828 perlmod/Fink/SelfUpdate.pm
@@ -23,18 +23,14 @@
package Fink::SelfUpdate;
-use Fink::Services qw(&execute &version_cmp &aptget_lockwait);
+use Fink::Services qw(&find_subpackages);
use Fink::Bootstrap qw(&additional_packages);
-use Fink::CLI qw(&print_breaking &prompt &prompt_boolean &prompt_selection);
-use Fink::Config qw($config $basepath $dbpath $distribution);
-use Fink::NetAccess qw(&fetch_url);
+use Fink::CLI qw(&print_breaking &prompt_boolean &prompt_selection print_breaking_stderr);
+use Fink::Config qw($basepath $config $distribution);
use Fink::Engine; # &aptget_update &cmd_install, but they aren't EXPORT_OK
use Fink::Package;
-use Fink::FinkVersion qw(&pkginfo_version);
-use Fink::Mirror;
-use Fink::Command qw(cat chowname mkdir_p mv rm_f rm_rf touch);
-use File::Find;
+use POSIX qw(strftime);
use strict;
use warnings;
@@ -67,43 +63,27 @@ Fink::SelfUpdate - download package descriptions from server
Fink::SelfUpdate::check($method);
+This is the main entry point for the 'fink selfupdate*' commands to
+update the local collection of package descriptions.
-This is the main entry point for the 'fink selfupdate*' commands. The
-local collection of package descriptions is updated according to one
-of the following methods:
+The optional $method parameter specifies the selfupdate method to
+use. If no $method is specified (0 or undef), the default method is
+used. It can be a text string naming the method, or a legacy API of
+numerical values for some specific methods:
=over 4
-=item "point"
+=item 0
-A tarball of the latest Fink binary installer package collection is
-downloaded from the fink website.
-
-=item "cvs"
-
-=item "rsync"
-
-"cvs" or "rsync" protocols are used to syncronize with a remote
-server.
-
-=back
-
-The optional $method parameter specifies a number indicating the
-selfupdate method to use:
-
-=over 4
-
-=item 0 (or undefined or omitted)
-
-Use the current method
+Use the current default method
=item 1
-Use the cvs method
+Use the "cvs" method
=item 2
-Use the rsync method
+Use the "rsync" method
=back
@@ -116,490 +96,110 @@ current method preference, fink.conf is updated according to $method.
=cut
sub check {
- my $useopt = shift || 0;
- my ($srcdir, $finkdir, $latest_fink, $installed_version, $answer);
-
- $srcdir = "$basepath/src";
- $finkdir = "$basepath/fink";
- if ($useopt != 0) {
- &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) {
- $answer = "cvs";
- }
- elsif ($useopt == 2) {
- $answer = "rsync";
+ my $method = shift; # requested selfupdate method to use
+
+ $method = '' if ! defined $method;
+
+ {
+ # compatibility for old calling parameters
+ my %methods = (
+ 0 => '',
+ 1 => 'cvs',
+ 2 => 'rsync',
+ );
+ if (length $method and exists $methods{$method}) {
+ $method = $methods{$method};
}
- else {
- $answer = "point";
- }
- &need_devtools($answer);
- &print_breaking("fink is setting your default update method to $answer \n");
- $config->set_param("SelfUpdateMethod", $answer);
- $config->save();
}
- # 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){
- $answer = &prompt_selection("Choose an update method",
- intro => "fink needs you to choose a SelfUpdateMethod.",
- default => [ value => "rsync" ],
- choices => [
- "rsync" => "rsync",
- "cvs" => "cvs",
- "Stick to point releases" => "point"
- ] );
- &need_devtools($answer);
- $config->set_param("SelfUpdateMethod", $answer);
- $config->save();
- }
+ # canonical form is all-lower-case
+ $method = lc($method);
+ my $prev_method = lc($config->param_default("SelfUpdateMethod", ''));
- # We temporarily disable rsync updating for 10.5, until we've decided
- # how to handle it
+ my @avail_subclasses = &Fink::SelfUpdate::_plugins;
- if (($config->param("SelfUpdateMethod") eq "rsync") and ($distribution eq "10.5")) {
- die "Sorry, fink doesn't support rsync updating in the 10.5 distribution at present.\n\n";
- }
+ if ($method eq '') {
+ # no explicit method requested
- # By now the config param SelfUpdateMethod should be set.
- if (($config->param("SelfUpdateMethod") eq "cvs") and $useopt != 2){
- &need_devtools('cvs');
- if (-f "$finkdir/dists/stamp-rsync-live") {
- unlink "$finkdir/dists/stamp-rsync-live";
- }
- if (-f "$finkdir/stamp-rsync-live") {
- unlink "$finkdir/stamp-rsync-live";
- }
- if (-d "$finkdir/dists/CVS") {
- &do_direct_cvs();
- &do_finish();
- return;
+ if ($prev_method ne '') {
+ # use existing default
+ $method = $prev_method;
} else {
- &setup_direct_cvs();
- &do_finish();
- return;
- }
- }
- elsif (($config->param("SelfUpdateMethod") eq "rsync") and $useopt != 1){
- &need_devtools('rsync');
- &do_direct_rsync();
- &do_finish();
- return;
- }
- # 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) {
-
- # We temporarily disable rsync updating for 10.5, until we've decided
- # how to handle it
-
- if ($distribution eq "10.5") {
- die "Sorry, fink doesn't support rsync updating in the 10.5 distribution at present.\n\n";
- }
+ # no existing default so ask user
- $answer =
- &prompt_boolean("The current selfupdate method is $selfupdatemethod. "
- . "Do you wish to change the default selfupdate method ".
- "to rsync?", default => 1);
- if (! $answer) {
- return;
- }
- &need_devtools('rsync');
- $config->set_param("SelfUpdateMethod", "rsync");
- $config->save();
- &do_direct_rsync();
- &do_finish();
- return;
- }
- if (($selfupdatemethod ne "cvs") and $useopt == 1) {
- $answer =
- &prompt_boolean("The current selfupdate method is $selfupdatemethod. "
- . "Do you wish to change the default selfupdate method ".
- "to cvs?", default => 1);
- if (! $answer) {
- return;
- }
- &need_devtools('cvs');
- $config->set_param("SelfUpdateMethod", "cvs");
- $config->save();
- &setup_direct_cvs();
- &do_finish();
- return;
- }
- if (($config->param("SelfUpdateMethod") eq "point")) {
- # get the file with the current release number
- my $currentfink;
- $currentfink = "CURRENT-FINK-$distribution";
- ### if we are in 10.1, need to use "LATEST-FINK" not "CURRENT-FINK"
- if ($distribution eq "10.1") {
- $currentfink = "LATEST-FINK";
- }
- my $website = "http://www.finkproject.org";
- if (-f "$basepath/lib/fink/URL/website") {
- $website = cat "$basepath/lib/fink/URL/website";
- chomp($website);
- }
- if (&fetch_url("$website/$currentfink", $srcdir)) {
- die "Can't get latest version info\n";
- }
- $latest_fink = cat "$srcdir/$currentfink";
- chomp($latest_fink);
- if ( ! -f "$finkdir/stamp-cvs-live" and ! -f "$finkdir/stamp-rsync-live" and ! -f "$finkdir/dists/stamp-cvs-live" and ! -f "$finkdir/dists/stamp-rsync-live")
- {
- # check if we need to upgrade
- if (&version_cmp($latest_fink . '-1', '<=', $distribution . '-' . $installed_version . '-1')) {
- print "\n";
- &print_breaking("You already have the package descriptions from ".
- "the latest Fink point release. ".
- "(installed:$installed_version available:$latest_fink)");
+ if (!@avail_subclasses) {
+ print_breaking_stderr("ERROR: No selfupdate methods implemented. Giving up.\n");
return;
}
- } else {
- rm_f "$finkdir/stamp-rsync-live", "$finkdir/stamp-cvs-live", "$finkdir/dists/stamp-rsync-live", "$finkdir/dists/stamp-cvs-live";
- &execute("/usr/bin/find $finkdir -name CVS -type d -print0 | xargs -0 /bin/rm -rf");
- }
- &do_tarball($latest_fink);
- &do_finish();
- }
-}
-
-=item need_devtools
-
- Fink::SelfUpdate::need_devtools($method);
-
-If selfupdating using the given $method (passed by name) requires
-components of Apple dev-tools (xcode) instead of just standard
-components of OS X, check that the "dev-tools" virtual package is
-installed. If it is required for the $method but is not present, die.
-
-=cut
-
-sub need_devtools {
- my $method = shift;
- if ($method eq 'cvs' || $method eq 'rsync') {
- Fink::VirtPackage->query_package("dev-tools")
- or die "selfupdate method '$method' requires the package 'dev-tools'\n";
- }
-}
-
-### set up direct cvs
-
-sub setup_direct_cvs {
- my ($finkdir, $tempdir, $tempfinkdir);
- my ($username, $cvsuser, @testlist);
- my ($use_hardlinks, $cutoff, $cmd);
- my ($cmdd);
-
-
- $username = "root";
- if (exists $ENV{SUDO_USER}) {
- $username = $ENV{SUDO_USER};
- }
-
- print "\n";
- $username =
- &prompt("Fink has the capability to run the CVS commands as a ".
- "normal user. That has some advantages - it uses that ".
- "user's CVS settings files and allows the package ".
- "descriptions to be edited and updated without becoming ".
- "root. Please specify the user login name that should be ".
- "used:",
- default => $username);
-
- # sanity check
- @testlist = getpwnam($username);
- if (scalar(@testlist) <= 0) {
- die "The user \"$username\" does not exist on the system.\n";
- }
-
- print "\n";
- $cvsuser =
- &prompt("For Fink developers only: ".
- "Enter your SourceForge login name to set up full CVS access. ".
- "Other users, just press return to set up anonymous ".
- "read-only access.",
- default => "anonymous");
- print "\n";
-
- # start by creating a temporary directory with the right permissions
- $finkdir = "$basepath/fink";
- $tempdir = "$finkdir.tmp";
- $tempfinkdir = "$tempdir/fink";
-
- if (-d $tempdir) {
- rm_rf $tempdir or
- die "Can't remove left-over temporary directory '$tempdir'\n";
- }
- mkdir_p $tempdir or
- die "Can't create temporary directory '$tempdir'\n";
- if ($username ne "root") {
- chowname $username, $tempdir or
- die "Can't set ownership of temporary directory '$tempdir'\n";
- }
-
- # check if hardlinks from the old directory work
- &print_breaking("Checking to see if we can use hard links to merge ".
- "the existing tree. Please ignore errors on the next ".
- "few lines.");
- unless (touch "$finkdir/README" and link "$finkdir/README", "$tempdir/README") {
- $use_hardlinks = 0;
- } else {
- $use_hardlinks = 1;
- }
- unlink "$tempdir/README";
-
- # start the CVS fun
- chdir $tempdir or die "Can't cd to $tempdir: $!\n";
+ my @choices = (); # menu entries as ordered label=>class pairs
+ my @default = (); # default menu choice (rsync if it's avail)
+ foreach my $subclass (@avail_subclasses) {
+ push @choices, ( $subclass->description() => $subclass );
+ @default = ( 'value' => $subclass ) if &class2methodname($subclass) eq 'rsync';
+ }
- # add cvs quiet flag if verbosity level permits
- my $verbosity = "-q";
- if ($config->verbosity_level() > 1) {
- $verbosity = "";
- }
- my $cvsrepository = "fink.cvs.sourceforge.net:/cvsroot/fink";
- if (-f "$basepath/lib/fink/URL/cvs-repository") {
- $cvsrepository = cat "$basepath/lib/fink/URL/cvs-repository";
- chomp($cvsrepository);
- $cvsrepository .= ':/cvsroot/fink';
- }
- if ($cvsuser eq "anonymous") {
- if (-f "$basepath/lib/fink/URL/anonymous-cvs") {
- $cvsrepository = cat "$basepath/lib/fink/URL/anonymous-cvs";
- chomp($cvsrepository);
+ my $subclass_choice = &prompt_selection(
+ 'Choose an update method',
+ intro => 'fink needs you to choose a SelfUpdateMethod.',
+ choices => \@choices,
+ default => \@default,
+ );
+ $method = &class2methodname($subclass_choice);
}
- &print_breaking("Now logging into the CVS server. When CVS asks you ".
- "for a password, just press return (i.e. the password ".
- "is empty).");
- $cmd = "cvs -d:pserver:anonymous\@$cvsrepository login";
- if ($username ne "root") {
- $cmd = "/usr/bin/su $username -c '$cmd'";
- }
- if (&execute($cmd)) {
- die "Logging into the CVS server for anonymous read-only access failed.\n";
- }
-
- $cmd = "cvs ${verbosity} -z3 -d:pserver:anonymous\@$cvsrepository";
} else {
- if (-f "$basepath/lib/fink/URL/developer-cvs") {
- $cvsrepository = cat "$basepath/lib/fink/URL/developer-cvs";
- chomp($cvsrepository);
- }
- $cmd = "cvs ${verbosity} -z3 -d:ext:$cvsuser\@$cvsrepository";
- $ENV{CVS_RSH} = "ssh";
- }
- $cmdd = "$cmd checkout -l -d fink dists";
- if ($username ne "root") {
- $cmdd = "/usr/bin/su $username -c '$cmdd'";
- }
- &print_breaking("Setting up base Fink directory...");
- if (&execute($cmdd)) {
- die "Downloading package descriptions from CVS failed.\n";
- }
-
- my @trees = split(/\s+/, $config->param_default("SelfUpdateCVSTrees", $distribution));
- chdir "fink" or die "Can't cd to fink\n";
-
- for my $tree (@trees) {
- &print_breaking("Checking out $tree tree...");
-
- my $cvsdir = "dists/$tree";
- $cvsdir = "packages/dists" if ($tree eq "10.1");
- $cmdd = "$cmd checkout -d $tree $cvsdir";
-
- if ($username ne "root") {
- $cmdd = "/usr/bin/su $username -c '$cmdd'";
- }
- if (&execute($cmdd)) {
- die "Downloading package descriptions from CVS failed.\n";
- }
- }
- chdir $tempdir or die "Can't cd to $tempdir: $!\n";
-
- if (not -d $tempfinkdir) {
- die "The CVS didn't report an error, but the directory '$tempfinkdir' ".
- "doesn't exist as expected. Strange.\n";
- }
-
- # merge the old tree
- $cutoff = length($finkdir)+1;
- find(sub {
- if ($_ eq "CVS") {
- $File::Find::prune = 1;
- return;
- }
- return if (length($File::Find::name) <= $cutoff);
- my $rel = substr($File::Find::name, $cutoff);
- if (-l and not -e "$tempfinkdir/$rel") {
- my $linkto;
- $linkto = readlink($_)
- or die "Can't read target of symlink $File::Find::name: $!\n";
- symlink $linkto, "$tempfinkdir/$rel" or
- die "Can't create symlink \"$tempfinkdir/$rel\"\n";
- } elsif (-d and not -d "$tempfinkdir/$rel") {
- mkdir_p "$tempfinkdir/$rel" or
- die "Can't create directory \"$tempfinkdir/$rel\"\n";
- } elsif (-f and not -f "$tempfinkdir/$rel") {
- my $cmd;
- if ($use_hardlinks) {
- $cmd = "ln";
- } else {
- $cmd = "cp -p"
- }
- $cmd .= " '$_' '$tempfinkdir/$rel'";
- if (&execute($cmd)) {
- die "Can't copy file \"$tempfinkdir/$rel\"\n";
- }
- }
- }, $finkdir);
-
- # switch $tempfinkdir to $finkdir
- chdir $basepath or die "Can't cd to $basepath: $!\n";
- mv $finkdir, "$finkdir.old" or
- die "Can't move \"$finkdir\" out of the way\n";
- mv $tempfinkdir, $finkdir or
- die "Can't move new tree \"$tempfinkdir\" into place at \"$finkdir\". ".
- "Warning: Your Fink installation is in an inconsistent state now.\n";
- rm_rf $tempdir;
-
- print "\n";
- &print_breaking("Your Fink installation was successfully set up for ".
- "direct CVS updating. The directory \"$finkdir.old\" ".
- "contains your old package description tree. Its ".
- "contents were merged into the new one, but the old ".
- "tree was left intact for safety reasons. If you no ".
- "longer need it, remove it manually.");
- print "\n";
-}
-
-### call cvs update
-
-sub do_direct_cvs {
- my ($descdir, @sb, $cmd, $cmd_recursive, $username, $msg);
-
- # add cvs quiet flag if verbosity level permits
- my $verbosity = "-q";
- if ($config->verbosity_level() > 1) {
- $verbosity = "";
- }
-
- $descdir = "$basepath/fink";
- chdir $descdir or die "Can't cd to $descdir: $!\n";
-
- @sb = stat("$descdir/CVS");
-
- $cmd = "cvs ${verbosity} -z3 update -d -P -l";
-
- $msg = "I will now run the cvs command to retrieve the latest package descriptions. ";
-
- if ($sb[4] != 0 and $> != $sb[4]) {
- ($username) = getpwuid($sb[4]);
- $msg .= "The 'su' command will be used to run the cvs command as the ".
- "user '$username'. ";
- }
-
- $msg .= "After that, the core packages will be updated right away; ".
- "you should then update the other packages using commands like ".
- "'fink update-all'.";
-
- print "\n";
- &print_breaking($msg);
- print "\n";
-
- $ENV{CVS_RSH} = "ssh";
-
- # first, update the top-level stuff
-
- my $errors = 0;
-
- $cmd = "/usr/bin/su $username -c '$cmd'" if ($username);
- if (&execute($cmd)) {
- $errors++;
- }
-
- # then, update the trees
-
- my @trees = split(/\s+/, $config->param_default("SelfUpdateCVSTrees", $distribution));
- for my $tree (@trees) {
- $cmd = "cvs ${verbosity} -z3 update -d -P ${tree}";
- $cmd = "/usr/bin/su $username -c '$cmd'" if ($username);
- if (&execute($cmd)) {
- $errors++;
+ # explicit method requested
+ &print_breaking("\n Please note: the command 'fink selfupdate' "
+ . "should be used for routine updating; you only "
+ . "need to use a command like 'fink selfupdate-cvs' "
+ . "or 'fink selfupdate-rsync' if you are changing "
+ . "your update method. \n\n");
+
+ if (length $prev_method and $method ne $prev_method) {
+ # requested a method different from previously-saved default
+ # better double-check that user really wants to do this
+
+ if ($prev_method eq 'point') {
+ # "point" updater (inject.pl) doesn't appear to remove
+ # .info that are not in the tarball, so files added by
+ # other selfupdate methods that supply different
+ # packages or newer versions would remain and
+ # contaminate the point dist.
+ &print_breaking("\nWARNING: Fink does not presently support changing to SelfUpdateMethod \"point\" from any other method\n;");
+ return;
+ }
+ my $answer =
+ &prompt_boolean("The current selfupdate method is $prev_method. "
+ . "Do you wish to change this default method "
+ . "to $method?",
+ default => 1
+ );
+ return if !$answer;
}
}
- touch "$basepath/fink/dists/stamp-cvs-live";
- rm_f "$basepath/fink/dists/stamp-rsync-live";
- die "Updating using CVS failed. Check the error messages above.\n" if ($errors);
+ # find the class that implements the method
+ my ($subclass_use) = grep { &class2methodname($_) eq $method } @avail_subclasses;
-}
-
-### update from packages tarball
-# parameter: version number
-
-sub do_tarball {
- my $newversion = shift;
- my ($downloaddir, $dir);
- my ($pkgtarball, $url, $verbosity, $unpack_cmd);
-
- print "\n";
- &print_breaking("I will now download the package descriptions for ".
- "Fink $newversion and update the core packages. ".
- "After that, you should update the other packages ".
- "using commands like 'fink update-all'.");
- print "\n";
-
- $downloaddir = "$basepath/src";
- chdir $downloaddir or die "Can't cd to $downloaddir: $!\n";
-
- # go ahead and upgrade
- # first, download the packages tarball
- $dir = "dists-$newversion";
-
- ### if we are in 10.1, need to use "packages" not "dists"
- if ($distribution eq "10.1") {
- $dir = "packages-$newversion";
- }
-
- $pkgtarball = "$dir.tar.gz";
- $url = "mirror:sourceforge:fink/$pkgtarball";
-
- if (not -f $pkgtarball) {
- if (&fetch_url($url, $downloaddir)) {
- die "Downloading the update tarball '$pkgtarball' from the URL '$url' failed.\n";
- }
- }
+ # sanity checks
+ die "Selfupdate method '$method' is not implemented\n" unless( defined $subclass_use && length $subclass_use );
+ $subclass_use->system_check() or die "Selfupdate mthod '$method' cannot be used\n";
- # unpack it
- if (-e $dir) {
- rm_rf $dir or
- die "can't remove existing directory $dir\n";
+ if ($method ne $prev_method) {
+ # save new selection (explicit change or being set for first time)
+ &print_breaking("fink is setting your default update method to $method\n");
+ $config->set_param("SelfUpdateMethod", $method);
+ $config->save();
}
- $verbosity = "";
- if ($config->verbosity_level() > 1) {
- $verbosity = "v";
- }
- $unpack_cmd = "tar -xz${verbosity}f $pkgtarball";
- if (&execute($unpack_cmd)) {
- die "unpacking $pkgtarball failed\n";
+ # clear remnants of any methods other than one to be used
+ foreach my $subclass (@avail_subclasses) {
+ next if $subclass eq $subclass_use;
+ $subclass->clear_metadata();
}
- # inject it
- chdir $dir or die "Can't cd into $dir: $!\n";
- if (&execute("./inject.pl $basepath -quiet")) {
- die "injecting the new package definitions from $pkgtarball failed\n";
- }
- chdir $downloaddir or die "Can't cd to $downloaddir: $!\n";
- if (-e $dir) {
- rm_rf $dir;
- }
+ # Let's do this thang!
+ $subclass_use->do_direct() && &do_finish;
}
=item do_finish
@@ -702,159 +302,127 @@ sub finish {
print "\n";
}
-# apparently-unused function
+=item last_done
-sub rsync_check {
- &do_direct_rsync();
- &do_finish();
-}
+ my ($last_method,$last_time, $last_data) = Fink::SelfUpdate::last_done();
+ print "Last selfupdate was by $last_method";
-sub do_direct_rsync {
- my ($descdir, @sb, $cmd, $rmcmd, $vercmd, $username, $msg);
- my ($timecmd, $oldts, $newts);
- my $origmirror;
- my $dist = $distribution;
- my $rsynchost = $config->param_default("Mirror-rsync", "rsync://master.us.finkmirrors.net/finkinfo/");
- # add rsync quiet flag if verbosity level permits
- my $verbosity = "-q";
- my $nohfs ="";
- if ($config->verbosity_level() > 1) {
- $verbosity = "-v";
- }
- if (system("rsync -help 2>&1 | grep 'nohfs' >/dev/null") == 0) {
- $nohfs = "--nohfs";
+ print ", , $age seconds ago\n";
+ if ($last_time) {
+ print " ", time() - $last_time, " seconds ago";
}
- $descdir = "$basepath/fink";
- chdir $descdir or die "Can't cd to $descdir: $!\n";
+Returns the method, time, and any method-specific data for the last
+selfupdate that was performed for the active distribution.
- $origmirror = Fink::Mirror->get_by_name("rsync");
+=cut
-RSYNCAGAIN:
- $rsynchost = $origmirror->get_site_retry("", 0);
- if( !grep(/^rsync:/,$rsynchost) ) {
- print "No mirror worked. This seems unusual, please submit a short summary of this event to mirrors\@finkmirrors.net\n Thank you\n";
- exit 1;
+sub last_done {
+ my $file_old = "$basepath/fink/$distribution/VERSION";
+ my $filename = "$file_old.selfupdate";
+
+ if (open my $FH, '<', $filename) {
+ my @lines = <$FH>;
+ close $FH;
+
+ # new-style tokenized file
+ 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.";
+ }
+ }
+ }
+ print_breaking_stderr "WARNING: No valid data found in $filename, falling back to old-style $file_old file.";
}
- # Fetch the timestamp for comparison
- $timecmd = "rsync -az $verbosity $nohfs $rsynchost/TIMESTAMP $descdir/TIMESTAMP.tmp";
- if (&execute($timecmd)) {
- print "Failed to fetch the timestamp file from the rsync server: $rsynchost. Check the error messages above.\n";
- goto RSYNCAGAIN;
- }
- # If there's no TIMESTAMP file, then we haven't synced from rsync
- # before, so there's no checking we can do. Blaze on past.
- if ( -f "$descdir/TIMESTAMP" ) {
- open TS, "$descdir/TIMESTAMP";
- $oldts = <TS>;
- close TS;
- chomp $oldts;
- # Make sure the timestamp only contains digits
- if ($oldts =~ /\D/) {
- unlink("$descdir/TIMESTAMP.tmp");
- die "The timestamp file $descdir/TIMESTAMP contains non-numeric characters. This is illegal. Refusing to continue.\n";
- }
+ if (open my $FH, '<', $file_old) {
+ my @lines = <$FH>;
+ close $FH;
- open TS, "$descdir/TIMESTAMP.tmp";
- $newts = <TS>;
- close TS;
- chomp $newts;
- # Make sure the timestamp only contains digits
- if ($oldts =~ /\D/) {
- unlink("$descdir/TIMESTAMP.tmp");
- die "The timestamp file fetched from $rsynchost contains non-numeric characters. This is illegal. Refusing to continue.\n";
- }
-
- if ( $oldts > $newts ) {
- # error out complaining that we're trying to update
- # from something older than what we already have.
- unlink("$descdir/TIMESTAMP.tmp");
- print "The timestamp of the server is older than what you already have.\n";
- exit 1;
+ # 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);
+ }
- }
+ # give up
+ print_breaking_stderr "WARNING: could not read $file_old: $!\n";
+ return (undef, undef, undef);
+}
- # If the Distributions line has been updated...
- if (! -d "$descdir/$dist") {
- mkdir_p "$descdir/$dist";
- }
- @sb = stat("$descdir/$dist");
-
- # We need to remove the CVS directories, since what we're
- # going to put there isn't from cvs. Leaving those directories
- # there will thoroughly confuse things if someone later does
- # selfupdate-cvs. However, don't actually do the removal until
- # we've tried to put something there.
- $msg = "I will now run the rsync command to retrieve the latest package descriptions. \n";
-
- $rsynchost =~ s/\/*$//;
- $dist =~ s/\/*$//;
-
- my $rinclist = "";
-
- my @trees = grep { m,^(un)?stable/, } $config->get_treelist();
- die "Can't find any trees to update\n" unless @trees;
- map { s/\/*$// } @trees;
-
- foreach my $tree (@trees) {
- my $oldpart = $dist;
- my @line = split /\//,$tree;
-
- $rinclist .= " --include='$dist/'";
- for(my $i = 0; defined $line[$i]; $i++) {
- $oldpart = "$oldpart/$line[$i]";
- $rinclist .= " --include='$oldpart/'";
- }
- $rinclist .= " --include='$oldpart/finkinfo/' --include='$oldpart/finkinfo/*/' --include='$oldpart/finkinfo/*' --include='$oldpart/finkinfo/**/*'";
+=item class2methodname
- if (! -d "$basepath/fink/$dist/$tree" ) {
- mkdir_p "$basepath/fink/$dist/$tree";
- }
- }
- $cmd = "rsync -rtz --delete-after --delete $verbosity $nohfs $rinclist --include='VERSION' --include='DISTRIBUTION' --include='README' --exclude='**' '$rsynchost' '$basepath/fink/'";
- if ($sb[4] != 0 and $> != $sb[4]) {
- ($username) = getpwuid($sb[4]);
- if ($username) {
- $cmd = "/usr/bin/su $username -c \"$cmd\"";
- chowname $username, "$basepath/fink/$dist";
- }
- }
- &print_breaking($msg);
+ my $name = Fink::SelfUpdate::class2methodname('Fink::SelfUpdate::CVS');
+ # gives 'cvs'
- if (&execute($cmd)) {
- print "Updating using rsync failed. Check the error messages above.\n";
- goto RSYNCAGAIN;
- } else {
- foreach my $tree (@trees) {
- &execute("/usr/bin/find '$basepath/fink/$dist/$tree' -name CVS -type d -print0 | xargs -0 /bin/rm -rf");
- }
- }
+Given a class, strips all leading namespaces and converts to
+lower-case. This is considered as the SelfUpdateMethod implemented by
+the class.
- rm_rf "$basepath/fink/$dist/CVS";
- rm_rf "$basepath/fink/CVS";
- touch "$dist/stamp-rsync-live";
- rm_f "stamp-cvs-live", "$dist/stamp-cvs-live";
-# change the VERSION to reflect rsync
-if (-f "$basepath/fink/$dist/VERSION") {
- open(IN,"$basepath/fink/$dist/VERSION") or die "can't open VERSION: $!";
- open(OUT,">$basepath/fink/$dist/VERSION.tmp") or die "can't write VERSION.tmp: $!";
- while (<IN>) {
- chomp;
- $_ =~ s/cvs/rsync/;
- print OUT "$_\n";
- }
- close(IN);
- unlink "$basepath/fink/$dist/VERSION";
- rename "$basepath/fink/$dist/VERSION.tmp", "$basepath/fink/$dist/VERSION";
-}
+=cut
+
+sub class2methodname {
+ my $class = shift;
- # cleanup after ourselves and continue with the update.
- unlink("$descdir/TIMESTAMP");
- rename("$descdir/TIMESTAMP.tmp", "$descdir/TIMESTAMP");
+ $class = ref($class) if ref($class); # find class if called as object
+ $class =~ s/.*:://; # just the subclass
+
+ return lc($class);
}
+=item _plugins
+
+ my $plugin_classes = Fink::SelfUpdate::_plugins;
+
+Returns a ref to a list of subclasses (by namespace) of the present
+class that are subclasses (by inheritance) of the Base subclass.
+Guaranteed that there is only one class with a given lowest-level name
+(case-insentively). The returned list is sorted by that lowest-level
+name.
+
+=cut
+
+{
+ my $plugins; # cache the results
+
+ sub _plugins {
+ if (!defined $plugins) {
+ my $base_class = __PACKAGE__ . '::Base';
+ my %plugins = ();
+ foreach my $class (sort(find_subpackages(__PACKAGE__))) {
+ next if $class eq $base_class; # skip base class (dummy method)
+
+ # lazy solution: require ISA relationship on base, so can
+ # know that all standard API are available
+ eval "require $class";
+ next unless $class->isa($base_class);
+
+ # name is the unique token, so eliminate dups
+ my $name = &class2methodname($class);
+ if (exists $plugins{$name}) {
+ # skip dups
+ print_breaking_stderr("WARNING: $name already supplied by $plugins{$name}; skipping $class\n");
+ next;
+ }
+ $plugins{$name} = $class;
+ }
+ $plugins = [ map $plugins{$_}, sort keys %plugins ];
+ }
+ return @$plugins;
+ }
+}
=back
=cut
View
4 t/ChangeLog
@@ -1,3 +1,7 @@
+2007-04-10 Daniel Macks <dmacks@netspace.org>
+
+ * t/FinkVersion/*: merge from selfupdate_classes branch
+
2006-02-08 Daniel Macks <dmacks@netspace.org>
* users_groups.t: moved into 10features/
View
3 t/FinkVersion/exports.t
@@ -14,7 +14,6 @@ require_ok('Fink::FinkVersion');
{
package Bar;
Fink::FinkVersion->import(':ALL');
- ::can_ok( __PACKAGE__, qw(fink_version distribution_version
- pkginfo_version) );
+ ::can_ok( __PACKAGE__, qw(fink_version) );
}
View
41 t/FinkVersion/version.t
@@ -5,51 +5,10 @@ use Test::More 'no_plan';
use Fink::Command qw(cat touch mkdir_p);
use File::Basename;
-use Fink::Config;
-Fink::Config->new_with_path('basepath/etc/fink.conf');
-
BEGIN { use_ok 'Fink::FinkVersion', ':ALL'; }
{
my $fink_version = cat '../VERSION';
chomp $fink_version;
is( fink_version, , $fink_version, 'fink_version matches VERSION' );
}
-
-
-{
- is( distribution_version, 'unknown',
- 'distribution_version with no files' );
-
- for my $distfile (qw(fink/VERSION etc/fink-release)) {
- _write("basepath/$distfile");
- is( distribution_version, '1.2.3', " from $distfile" );
- unlink("basepath/$distfile");
- }
-}
-
-
-{
- is( pkginfo_version, distribution_version,
- 'pkginfo_version == distribution_version with no clues' );
-
- for my $stamp (qw(stamp-rsync stamp-cvs)) {
- my($version) = $stamp =~ /stamp-(.*)/;
- touch("basepath/fink/$stamp");
- is( pkginfo_version, $version, " from $stamp" );
- unlink("basepath/fink/$stamp");
- }
-
- my @Stamp_Versions = qw(1.2 3.4 3.49);
- touch("basepath/fink/stamp-rel-$_") foreach @Stamp_Versions;
- is( pkginfo_version, 3.49, ' highest from multiple stamp-rels' );
- unlink("basepath/fink/stamp-rel-$_") foreach @Stamp_Versions;
-}
-
-sub _write {
- my($file) = @_;
- mkdir_p(dirname($file));
- open(FILE, ">$file") or die "Can't open $file: $!";
- print FILE "1.2.3\n";
- close FILE;
-}

0 comments on commit bba416a

Please sign in to comment.
Something went wrong with that request. Please try again.