summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-03-08 15:56:43 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-03-08 15:56:43 +0000
commit18bbdbf7e9ec5917915250619ec982848f88af25 (patch)
treeb23a9adb1b13b4f9db652303d08907937d275350
parent9c1aabb3b9e422a95cc500c7cf0357b21ef67daf (diff)
downloaddrakx-18bbdbf7e9ec5917915250619ec982848f88af25.tar
drakx-18bbdbf7e9ec5917915250619ec982848f88af25.tar.gz
drakx-18bbdbf7e9ec5917915250619ec982848f88af25.tar.bz2
drakx-18bbdbf7e9ec5917915250619ec982848f88af25.tar.xz
drakx-18bbdbf7e9ec5917915250619ec982848f88af25.zip
in generate_automatic_stage1_params():
- handle FTP via HTTP proxy (bugzilla #8699) - cleanup using a different data-structure
-rw-r--r--perl-install/install_any.pm30
1 files changed, 18 insertions, 12 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 70675e4b7..be0c9e84c 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -887,28 +887,34 @@ sub loadO {
sub generate_automatic_stage1_params {
my ($o) = @_;
- my @ks = "method:$o->{method}";
+ my $method = $o->{method};
+ my @ks;
if ($o->{method} eq 'http') {
- $ENV{URLPREFIX} =~ m|http://([^/:]+)(/.*)| or die;
- push @ks, "server:$1", "directory:$2";
+ $ENV{URLPREFIX} =~ m!(http|ftp)://([^/:]+)(/.*)! or die;
+ $method = $1; #- in stage1, FTP via HTTP proxy is available through FTP config, not HTTP
+ @ks = (server => $2, directory => $3);
} elsif ($o->{method} eq 'ftp') {
- push @ks, "server:$ENV{HOST}", "directory:$ENV{PREFIX}", "user:$ENV{LOGIN}", "pass:$ENV{PASSWORD}";
+ @ks = (server => $ENV{HOST}, directory => $ENV{PREFIX}, user => $ENV{LOGIN}, pass => $ENV{PASSWORD});
} elsif ($o->{method} eq 'nfs') {
cat_("/proc/mounts") =~ m|(\S+):(\S+)\s+/tmp/image nfs| or die;
- push @ks, "server:$1", "directory:$2";
+ @ks = (server => $1, directory => $2);
}
+ @ks = (method => $method, @ks);
if (member($o->{method}, qw(http ftp nfs))) {
- my ($intf) = values %{$o->{intf}};
- push @ks, "interface:$intf->{DEVICE}";
+ if ($ENV{PROXY}) {
+ push @ks, proxy_host => $ENV{PROXY}, proxy_port => $ENV{PROXYPORT};
+ }
+ push @ks, interface => first(values %{$o->{intf}})->{DEVICE};
if ($intf->{BOOTPROTO} eq 'dhcp') {
- push @ks, "network:dhcp";
+ push @ks, network => 'dhcp';
} else {
+ push @ks, network => 'static', ip => $intf->{IPADDR}, netmask => $intf->{NETMASK}, gateway => $o->{netc}{GATEWAY};
require network::network;
- push @ks, "network:static", "ip:$intf->{IPADDR}", "netmask:$intf->{NETMASK}", "gateway:$o->{netc}{GATEWAY}";
- my @dnss = network::network::dnsServers($o->{netc});
- push @ks, "dns:$dnss[0]" if @dnss;
+ if (my @dnss = network::network::dnsServers($o->{netc})) {
+ push @ks, dns => $dnss[0];
+ }
}
}
@@ -917,7 +923,7 @@ sub generate_automatic_stage1_params {
adsluser => 'adslu', adslpass => 'adslp', hostname => 'hos', domain => 'dom', server => 'ser',
directory => 'dir', user => 'use', pass => 'pas', disk => 'dis', partition => 'par');
- 'automatic='.join(',', map { /^([^:]+)(:.*)/ && $aliases{$1} ? $aliases{$1}.$2 : $_ } @ks);
+ 'automatic=' . join(',', map { ($aliases{$_->[0]} || $_->[0]) . ':' . $_->[1] } group_by2(@ks));
}
sub guess_mount_point {
='n353' href='#n353'>353 354 355 356
#!/usr/bin/perl -wT
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

# Glossary:
# series:   An individual, defined set of data plotted over time.
# data set: What a series is called in the UI.
# line:     A set of one or more series, to be summed and drawn as a single
#           line when the series is plotted.
# chart:    A set of lines
#
# So when you select rows in the UI, you are selecting one or more lines, not
# series.

# Generic Charting TODO:
#
# JS-less chart creation - hard.
# Broken image on error or no data - need to do much better.
# Centralise permission checking, so Bugzilla->user->in_group('editbugs')
#   not scattered everywhere.
# User documentation :-)
#
# Bonus:
# Offer subscription when you get a "series already exists" error?

use 5.10.1;
use strict;
use lib qw(. lib);

use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::CGI;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::Chart;
use Bugzilla::Series;
use Bugzilla::Token;

# For most scripts we don't make $cgi and $template global variables. But
# when preparing Bugzilla for mod_perl, this script used these
# variables in so many subroutines that it was easier to just
# make them globals.
local our $cgi = Bugzilla->cgi;
local our $template = Bugzilla->template;
local our $vars = {};
my $dbh = Bugzilla->dbh;

my $user = Bugzilla->login(LOGIN_REQUIRED);

if (!Bugzilla->feature('new_charts')) {
    ThrowUserError('feature_disabled', { feature => 'new_charts' });
}

# Go back to query.cgi if we are adding a boolean chart parameter.
if (grep(/^cmd-/, $cgi->param())) {
    my $params = $cgi->canonicalise_query("format", "ctype", "action");
    print $cgi->redirect("query.cgi?format=" . $cgi->param('query_format') .
                                               ($params ? "&$params" : ""));
    exit;
}

my $action = $cgi->param('action');
my $series_id = $cgi->param('series_id');
$vars->{'doc_section'} = 'using.html#charts';

# Because some actions are chosen by buttons, we can't encode them as the value
# of the action param, because that value is localization-dependent. So, we
# encode it in the name, as "action-<action>". Some params even contain the
# series_id they apply to (e.g. subscribe, unsubscribe).
my @actions = grep(/^action-/, $cgi->param());
if ($actions[0] && $actions[0] =~ /^action-([^\d]+)(\d*)$/) {
    $action = $1;
    $series_id = $2 if $2;
}

$action ||= "assemble";

# Go to buglist.cgi if we are doing a search.
if ($action eq "search") {
    my $params = $cgi->canonicalise_query("format", "ctype", "action");
    print $cgi->redirect("buglist.cgi" . ($params ? "?$params" : ""));
    exit;
}

$user->in_group(Bugzilla->params->{"chartgroup"})
  || ThrowUserError("auth_failure", {group  => Bugzilla->params->{"chartgroup"},
                                     action => "use",
                                     object => "charts"});

# Only admins may create public queries
$user->in_group('admin') || $cgi->delete('public');

# All these actions relate to chart construction.
if ($action =~ /^(assemble|add|remove|sum|subscribe|unsubscribe)$/) {
    # These two need to be done before the creation of the Chart object, so
    # that the changes they make will be reflected in it.
    if ($action =~ /^subscribe|unsubscribe$/) {
        detaint_natural($series_id) || ThrowCodeError("invalid_series_id");
        my $series = new Bugzilla::Series($series_id);
        $series->$action($user->id);
    }

    my $chart = new Bugzilla::Chart($cgi);

    if ($action =~ /^remove|sum$/) {
        $chart->$action(getSelectedLines());
    }
    elsif ($action eq "add") {
        my @series_ids = getAndValidateSeriesIDs();
        $chart->add(@series_ids);
    }

    view($chart);
}
elsif ($action eq "plot") {
    plot();
}
elsif ($action eq "wrap") {
    # For CSV "wrap", we go straight to "plot".