Update of /cvsroot/fink/fink/perlmod/Fink
In directory 
sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv11443/perlmod/Fink

Modified Files:
        Bootstrap.pm ChangeLog Config.pm 
Log Message:
only use main/crypto among default Trees when distribution is 10.5 or earlier


Index: Bootstrap.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Bootstrap.pm,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -d -r1.192 -r1.193
--- Bootstrap.pm        15 Jun 2010 20:38:39 -0000      1.192
+++ Bootstrap.pm        4 Jul 2010 17:10:11 -0000       1.193
@@ -25,7 +25,7 @@
 
 use ExtUtils::Manifest qw(&maniread);
 
-use Fink::Config qw($config $basepath);
+use Fink::Config qw($config $basepath &fink_tree_default);
 use Fink::Services qw(&execute &enforce_gcc &eval_conditional);
 use Fink::CLI qw(&print_breaking &prompt_boolean);
 use Fink::Package;
@@ -352,7 +352,7 @@
        
        ### check that local/injected is in the Trees list
        
-       &add_injected_to_trees();
+       &add_injected_to_trees($distribution);
 
        ### create tarball for the package
        
@@ -391,9 +391,10 @@
 
 =item add_injected_to_trees
 
-       my ($exit_value) = add_injected_to_trees();
+       my ($exit_value) = add_injected_to_trees($distribution);
 
-Adds local/injected to the Trees list, if not already present.  Returns
+Adds local/injected to the Trees list, if not already present.  Now
+depends on $distribution because the default Trees list does.  Returns
 1 on failure, 0 on success.
 
 Called by inject_package() and fink's postinstall.pl.
@@ -402,10 +403,13 @@
 
 sub add_injected_to_trees {
 
+       my $distribution = shift;
+
        my $trees = $config->param("Trees");
        if ($trees =~ /^\s*$/) {
                print "Adding a Trees line to fink.conf...\n";
-               $config->set_param("Trees", "local/main stable/main 
stable/crypto local/injected");
+               my $fink_trees = Fink::Config::fink_tree_default($distribution);
+               $config->set_param("Trees", "$fink_trees local/injected");
                $config->save();
        } else {
                if (grep({$_ eq "local/injected"} split(/\s+/, $trees)) < 1) {

Index: Config.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Config.pm,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- Config.pm   6 Jan 2010 23:47:53 -0000       1.98
+++ Config.pm   4 Jul 2010 17:10:11 -0000       1.99
@@ -35,7 +35,7 @@
 our @ISA        = qw(Exporter Fink::Base);
 our @EXPORT_OK  = qw($config $basepath $libpath $buildpath $dbpath
                       $distribution $ignore_errors
-                      get_option set_options
+                      get_option set_options fink_tree_default
                      );
 our $VERSION    = 1.00;
 
@@ -69,6 +69,10 @@
   my $verbosity        = $config->verbosity_level;
   my $use_apt  = $config->binary_requested;
 
+  # Tree initialization
+  my $apt_trees = apt_tree_default($distribution);
+  my $fink_trees= fink_tree_default($distribution);
+
   # Tree management
   my @trees            = $config->get_treelist();
   my $bool      = $config->want_magic_tree($tree);
@@ -343,6 +347,57 @@
 
 =back
 
+=head2 Tree initialization
+
+=over 4
+
+=item apt_tree_default
+
+  my $apt_trees = apt_tree_default($distribution);
+
+Returns a space-delimited list of the trees used by apt when accessing a
+binary distribution supplied by fink.  Prior to 10.6, the list was
+"main crypto"; in 10.6 and later, it is "main".
+
+=cut
+
+
+sub apt_tree_default {
+       my $distribution = shift;
+
+       if ($distribution gt "10.5") {
+               return "main";
+       } else {
+               return "main crypto";
+       }
+}
+
+=item fink_tree_default
+
+  my $fink_trees = fink_tree_default($distribution);
+
+Returns a space-delimited list of the trees used by default when configuring
+fink.  This list is derived from apt_tree_default($distribution), so only
+the latter needs to be changed if things change in the future.  Prior to 10.6,
+the list was "local/main stable/main stable/crypto"; 
+in 10.6 and later, it is "local/main stable/main".
+
+=cut
+
+
+sub fink_tree_default {
+       my $distribution = shift;
+
+       my @list = split(/ /,&apt_tree_default($distribution));
+       my $output = "local/main";
+       foreach my $item (@list) {
+               $output = $output . " stable/" . $item;
+       }
+       return $output;
+}
+
+=back
+
 =head2 Configuration queries
 
 =over 4
@@ -698,19 +753,20 @@
                }
 
                my $distribution = $self->param("Distribution");
+               my $apt_trees = &apt_tree_default($distribution);
 
                $body .= <<EOF;
 # Official binary distribution: download location for packages
 # from the latest release
 EOF
 
-       $body .= "deb $apt_mirror $distribution/release main crypto\n\n";
+       $body .= "deb $apt_mirror $distribution/release $apt_trees\n\n";
                $body .= <<EOF;
 # Official binary distribution: download location for updated
 # packages built between releases
 EOF
 
-       $body .= "deb $apt_mirror $distribution/current main crypto\n\n";
+       $body .= "deb $apt_mirror $distribution/current $apt_trees\n\n";
 
        }
 

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1670
retrieving revision 1.1671
diff -u -d -r1.1670 -r1.1671
--- ChangeLog   30 Jun 2010 04:43:33 -0000      1.1670
+++ ChangeLog   4 Jul 2010 17:10:11 -0000       1.1671
@@ -1,3 +1,10 @@
+2010-07-04  Dave Morrison  <d...@finkproject.org>
+
+       * Config.pm: new functions &apt_tree_default and &fink_tree_default
+       * Config.pm: &write_sources_list now calls &apt_tree_default
+       * Bootstrap.pm: &add_injected_to_trees now takes $distribution
+       as an argument, and calls Fink::Config::fink_tree_default
+
 2010-06-30  Daniel Macks  <dma...@netspace.org>
 
        * PkgVersion.pm: note about an UpdatePOD problem


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to