Update of /cvsroot/fink/fink/perlmod/Fink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2956
Modified Files: Engine.pm ChangeLog Log Message: In Engine.pm, extract core of cmd_fetch_all() and cmd_fetch_all_missing() into a new do_fetch_all(), which uses call_queue_*(). Fix spacing on parse_fetch_options() help. Reorder some subs. Move BuildConflicts removal to after src/deb download. Index: Engine.pm =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/Engine.pm,v retrieving revision 1.223 retrieving revision 1.224 diff -u -d -r1.223 -r1.224 --- Engine.pm 23 Jan 2005 08:48:31 -0000 1.223 +++ Engine.pm 24 Jan 2005 05:23:28 -0000 1.224 @@ -300,6 +300,10 @@ do_real_list("list",@_); } +sub cmd_apropos { + do_real_list("apropos", @_); +} + sub do_real_list { my ($pattern, @allnames, @selected); my ($pname, $package, $lversion, $vo, $iflag, $description); @@ -632,26 +636,6 @@ &call_queue_clear; } -sub cmd_description { - my ($package, @plist); - - @plist = &expand_packages(@_); - if ($#plist < 0) { - die "no package specified for command 'description'!\n"; - } - - print "\n"; - foreach $package (@plist) { - print $package->get_fullname().": "; - print $package->get_description(); - print "\n"; - } -} - -sub cmd_apropos { - do_real_list("apropos", @_); -} - sub parse_fetch_options { my $cmd = shift; my %options = @@ -678,8 +662,9 @@ Options: -i, --ignore-restrictive - Do not fetch sources for packages with - a "Restrictive" license. Useful for mirroring. - -d, --dry-run - Prints filename, MD5, list of source URLs, Maintainer for each package + a "Restrictive" license. Useful for mirroring. + -d, --dry-run - Prints filename, MD5, list of source URLs, + Maintainer for each package -h, --help - This help text. EOF @@ -697,7 +682,7 @@ @plist = &expand_packages(@_); if ($#plist < 0) { - die "no package specified for command 'fetch'!\n"; + die "no package specified for command 'cmd_fetch_missing'!\n"; } &call_queue_clear; map { &call_queue_add([ $_, 'phase_fetch', 1, 0 ]) } @plist; @@ -705,59 +690,61 @@ } sub cmd_fetch_all { + &do_fetch_all("fetch-all", @_); +} + +sub cmd_fetch_all_missing { + &do_fetch_all("fetch-missing", @_); +} + +sub do_fetch_all { + my $cmd = shift; my ($pname, $package, $version, $vo); - my (%options, $norestrictive, $dryrun); - %options = &parse_fetch_options("fetch-all", @_); + my (%options, $norestrictive, $missing_only, $dryrun); + %options = &parse_fetch_options($cmd, @_); $norestrictive = $options{"norestrictive"} || 0; + $missing_only = $cmd eq "fetch-missing"; $dryrun = $options{"dryrun"} || 0; - + + &call_queue_clear; foreach $pname (Fink::Package->list_packages()) { $package = Fink::Package->package_by_name($pname); $version = &latest_version($package->list_versions()); $vo = $package->get_version($version); if (defined $vo) { - if ($norestrictive && $vo->has_param("license")) { - if($vo->param("license") =~ m/Restrictive\s*$/i) { - print "Ignoring $pname due to License: Restrictive\n"; - next; - } + if ($norestrictive && $vo->has_param("license") && $vo->param("license") =~ m/Restrictive\s*$/i) { + print "Ignoring $pname due to License: Restrictive\n"; + next; } - eval { - $vo->phase_fetch(0, $dryrun); - }; - warn "$@" if $@; # turn fatal exceptions into warnings + &call_queue_add([ + sub { + eval { +# $vo->phase_fetch(($missing_only, $dryrun); + $_[0]->phase_fetch($_[1], $_[2]); + }; + warn "$@" if $@; # turn fatal exceptions into warnings + }, + $vo, $missing_only, $dryrun ]); } } + &call_queue_clear; } -sub cmd_fetch_all_missing { - my ($pname, $package, $version, $vo); - my (%options, $norestrictive, $dryrun); +sub cmd_description { + my ($package, @plist); - %options = &parse_fetch_options("fetch-missing", @_); - $norestrictive = $options{"norestrictive"} || 0; - $dryrun = $options{"dryrun"} || 0; + @plist = &expand_packages(@_); + if ($#plist < 0) { + die "no package specified for command 'description'!\n"; + } - foreach $pname (Fink::Package->list_packages()) { - $package = Fink::Package->package_by_name($pname); - $version = &latest_version($package->list_versions()); - $vo = $package->get_version($version); - if (defined $vo) { - if ($norestrictive) { - if ($vo->has_param("license")) { - if($vo->param("license") =~ m/Restrictive\s*$/i) { - print "Ignoring $pname due to License: Restrictive\n"; - next; - } - } - } - eval { - $vo->phase_fetch(1, $dryrun); - }; - warn "$@" if $@; # turn fatal exceptions into warnings - } - } + print "\n"; + foreach $package (@plist) { + print $package->get_fullname().": "; + print $package->get_description(); + print "\n"; + } } sub cmd_remove { @@ -1652,6 +1639,8 @@ } unless ($forceoff) { # ask user when additional packages are to be installed + # TODO: implement --dry-run flag, which *always* does the + # following output block then exits (not dies). if ($#additionals >= 0 || $#removals >= 0) { if ($#additionals >= 0) { if ($#additionals > 0) { @@ -1680,9 +1669,7 @@ } } - # remove buildconfilcts before new builds reinstall after build - Fink::Engine::cmd_remove("remove", @removals) if (scalar(@removals) > 0); - + # TODO: pass --dry-run of fetch through to phase_fetch*() &call_queue_clear; # fetch all packages that need fetching foreach $pkgname (sort keys %deps) { @@ -1698,6 +1685,10 @@ } } &call_queue_clear; + # TODO: implement fetch --recursive, which exits here. + + # remove buildconfilcts before new builds reinstall after build + Fink::Engine::cmd_remove("remove", @removals) if (scalar(@removals) > 0); # install in correct order... while (1) { Index: ChangeLog =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v retrieving revision 1.818 retrieving revision 1.819 diff -u -d -r1.818 -r1.819 --- ChangeLog 23 Jan 2005 15:10:29 -0000 1.818 +++ ChangeLog 24 Jan 2005 05:23:29 -0000 1.819 @@ -1,3 +1,10 @@ +2005-01-24 Daniel Macks <[EMAIL PROTECTED]> + + * Engine.pm: Extract core of cmd_fetch_all() and + cmd_fetch_all_missing() into a new do_fetch_all(), which uses + call_queue_*(). Fix spacing on parse_fetch_options() help. Reorder + some subs. Move BuildConflicts removal to after src/deb download. + 2005-01-23 Dave Vasilevsky <[EMAIL PROTECTED]> * VirtPackage.pm: Don't print messages when not in debug mode (they ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fink-commits