Force CPAN install checkbox
authorJamie Cameron <jcameron@webmin.com>
Sat, 2 Feb 2008 23:45:41 +0000 (23:45 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 2 Feb 2008 23:45:41 +0000 (23:45 +0000)
cpan/CHANGELOG
cpan/cpan-lib.pl
cpan/download.cgi
cpan/index.cgi
cpan/lang/en

index cd677f1..7097469 100644 (file)
@@ -20,3 +20,4 @@ Added Module Config option to not install modules from APT or YUM.
 The module is now available when running Webmin inside a Solaris zone, but only if Perl is not shared with the global zone.
 ---- Changes since 1.390 ----
 Converted all code to use the new Webmin UI library, for a more consistent look.
+Modules can be forcibly compiled and install from the latest source instead of APT or YUM, using a new option on the main page.
index 9bb4ee5..48bfc56 100644 (file)
@@ -309,6 +309,16 @@ foreach my $m (&get_all_module_infos()) {
 return sort { $a->[0] cmp $b->[0] } @rv;
 }
 
+# can_list_packaged_modules()
+# Returns 1 if we can install Perl modules from APT or YUM
+sub can_list_packaged_modules
+{
+return 0 if (!&foreign_check("software") || !$config{'incpackages'});
+&foreign_require("software", "software-lib.pl");
+return 0 if (!$software::update_system);
+return 1;
+}
+
 # list_packaged_modules([refresh])
 # Returns a list of Perl modules that can be installed from the system's
 # package update service (ie YUM or APT).
index 7a6d079..e62da10 100755 (executable)
@@ -68,7 +68,7 @@ elsif ($in{'source'} == 3) {
        @cpan = split(/\s+|\0/, $in{'cpan'});
 
        # First check if YUM or APT can install this module for us
-       if ($config{'incyum'}) {
+       if ($config{'incyum'} && !$in{'forcecpan'}) {
                @yum = &list_packaged_modules();
                foreach $c (@cpan) {
                        ($yum) = grep { lc($_->{'mod'}) eq lc($c) } @yum;
index 11e17f9..08cbb7c 100755 (executable)
@@ -82,11 +82,15 @@ if (@st) {
        $refreshopt = "<br>".&ui_checkbox("refresh", 1, $text{'index_refresh'},
                        $st[9]+$config{'refresh_days'}*24*60*60 < $now);
        }
+if ($config{'incyum'} && &can_list_packaged_modules()) {
+       $cpanopt = "<br>".&ui_checkbox("forcecpan", 1,
+                                      $text{'index_forcecpan'}, 0);
+       }
 
 @opts = ( [ 3, $text{'index_cpan'},
            &ui_textbox("cpan", undef, 50)." ".
            &ui_button("...", undef, 0, "onClick='window.ifield = document.forms[$formno].cpan; chooser = window.open(\"cpan.cgi\", \"chooser\", \"toolbar=no,menubar=no,scrollbars=yes,width=800,height=500\"); chooser.ifield = window.ifield;'").
-           $refreshopt ],
+           $refreshopt.$cpanopt ],
          [ 0, $text{'index_local'},
            &ui_textbox("local", undef, 50)." ".
            &file_chooser_button("local", 0) ],
index 8170d2f..4c69817 100644 (file)
@@ -8,6 +8,7 @@ index_date=Installed on
 index_installmsg=Select a new Perl module to compile and install on your system.
 index_cpan=From CPAN, named
 index_refresh=Refresh module list from CPAN
+index_forcecpan=Always install latest version from source
 index_local=From local file
 index_uploaded=From uploaded file
 index_ftp=From ftp or http URL