summaryrefslogtreecommitdiffstats
path: root/urpm/mirrors.pm
blob: 0ea9b58f9892e1fd4f49eedcb15936a6742e18d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
-rw-r--r--
perl-install/ChangeLog246
1 files changed, 245 insertions, 1 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 9c6ec24e6..b63409e8c 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,3 +1,247 @@
+2003/02/24 alus
+
+ * share/po/pl.po: one entry
+
+2003/02/24 Pablo Saratxaga <pablo@mandrakesoft.com>
+
+ * share/po/id.po, share/po/sk.po, share/po/ru.po, share/po/gl.po,
+ share/po/br.po, share/po/th.po, share/po/sl.po, share/po/no.po,
+ share/po/ja.po, share/po/hr.po, share/po/tr.po, share/po/mt.po,
+ share/po/ga.po, share/po/be.po, share/po/uk.po, share/po/ko.po,
+ share/po/sv.po, share/po/sr.po, share/po/fi.po, share/po/lt.po,
+ share/po/he.po, share/po/sp.po, share/po/cy.po, share/po/ca.po,
+ share/po/da.po, share/po/ar.po, share/po/tg.po, share/po/bs.po,
+ share/po/uz.po, share/po/ro.po, share/po/wa.po, share/po/is.po,
+ share/po/af.po, share/po/az.po, share/po/zh_TW.po, share/po/zh_CN.po,
+ share/po/vi.po, share/po/ta.po, share/po/fr.po, share/po/sq.po,
+ share/po/it.po, share/po/nl.po, share/po/eu.po, share/po/es.po,
+ share/po/de.po, share/po/eo.po, share/po/el.po, share/po/cs.po,
+ share/po/bg.po, share/po/lv.po, share/po/hu.po: updated Welsh, Greek,
+ Swedish and Chinese files
+
+ * lang.pm: improved default fonts for KDE, completed the geographic
+ location
+ by continent for a few remaining country codes
+
+ * share/po/et.po: updated Estonian file
+ updated Welsh, Greek, Swedish and Chinese files
+
+ * share/po/pt_BR.po, share/po/DrakX.pot, share/po/pl.po, share/po/pt.po:
+ updated Portuguese file
+ updated Welsh, Greek, Swedish and Chinese files
+
+2003/02/24 Pixel <pixel@mandrakesoft.com>
+
+ * lang.pm: use Sans & Monospace for kde (as requested by lmontel)
+
+ * mdk-stage1/probing.c: replace checking hd[a-h] with hd[a-t] (cf bug
+ #1801)
+
+ * install_steps_interactive.pm: allow neuneus to quit install at license
+ step (esp. for Ann & Warly's father)
+
+2003/02/24 Stew Benedict <sbenedict@mandrakesoft.com>
+
+ * modules.pm: dmasound_awacs -> dmasound_pmac
+
+2003/02/24 Thierry Vignaud <tvignaud@mandrakesoft.com>
+
+ * ugtk2.pm: final embedding cleanups
+ - clean up embedding; since socket automatically emit plug-added gtk+
+ signal
+ when plug is realize, it's just cleaner to centralize/consolidate the
+ child
+ embedding in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR2', $::CCPID;"
+ - keyboarddrake, xfdrake, drakautoinst: goto cleaning btw
+ - clean up embedding; since socket get automatically destroyed on
+ child exit
+ and since they emit plug-removed at that moment, it's just cleaner to
+ centralize/consolidate the child exit in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR1', $::CCPID;"
+ - drakautoinst, drakxservices, keyboardrake: fix fscking embedding
+ managment
+
+ * standalone.pm: final embedding cleanups
+
+ * standalone/harddrake2: fix size when embedded
+ first attempt at making printerdrake to behave smoother when embedded in
+ the
+ mcc
+ - untabify
+ - hide devices which has no driver or whose driver is an url,
+ a graphic server and consolidate the test by the way
+ prefix devfs device name with "/dev/" too
+
+ * standalone/drakfloppy:
+ - fix packing (#1760)
+ - --expert command line option switch to expert mode by default
+ - only hide expert stuff if not in expert mode at startup
+
+ * standalone/logdrake:
+ - remove debug statements
+ - print an error message if we die on something other than wizcancel
+ fix mail alert generation
+ - do not crash without any message in strict mode (wizcancel die
+ miscatched)
+ - make the generated script be 'use strict' and perl_checker compliant
+ simplify
+ - clean up embedding; since socket automatically emit plug-added gtk+
+ signal
+ when plug is realize, it's just cleaner to centralize/consolidate the
+ child
+ embedding in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR2', $::CCPID;"
+ - keyboarddrake, xfdrake, drakautoinst: goto cleaning btw
+
+ * standalone/printerdrake, standalone/drakconnect,
+ standalone/scannerdrake:
+ - clean up embedding; since socket automatically emit plug-added gtk+
+ signal
+ when plug is realize, it's just cleaner to centralize/consolidate the
+ child
+ embedding in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR2', $::CCPID;"
+ - keyboarddrake, xfdrake, drakautoinst: goto cleaning btw
+
+ * standalone/drakfont: looks better like this
+ - clean up embedding; since socket get automatically destroyed on
+ child exit
+ and since they emit plug-removed at that moment, it's just cleaner to
+ centralize/consolidate the child exit in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR1', $::CCPID;"
+ - drakautoinst, drakxservices, keyboardrake: fix fscking embedding
+ managment
+
+ * interactive/gtk.pm, printer/printerdrake.pm: first attempt at making
+ printerdrake to behave smoother when embedded in the
+ mcc
+
+ * standalone/drakautoinst, my_gtk.pm, standalone/XFdrake,
+ standalone/keyboarddrake:
+ - clean up embedding; since socket automatically emit plug-added gtk+
+ signal
+ when plug is realize, it's just cleaner to centralize/consolidate the
+ child
+ embedding in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR2', $::CCPID;"
+ - keyboarddrake, xfdrake, drakautoinst: goto cleaning btw
+ - clean up embedding; since socket get automatically destroyed on
+ child exit
+ and since they emit plug-removed at that moment, it's just cleaner to
+ centralize/consolidate the child exit in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR1', $::CCPID;"
+ - drakautoinst, drakxservices, keyboardrake: fix fscking embedding
+ managment
+
+ * drakxtools.spec: 9.1-6mdk
+ more fixes
+ 9.1-5mdk
+ - clean up embedding; since socket get automatically destroyed on
+ child exit
+ and since they emit plug-removed at that moment, it's just cleaner to
+ centralize/consolidate the child exit in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR1', $::CCPID;"
+ - drakautoinst, drakxservices, keyboardrake: fix fscking embedding
+ managment
+
+ * standalone/net_monitor: fix embedding (even if we don't embbed it, it's
+ better)
+
+ * bootlook.pm: perl_checker fix
+ clean up:
+ - no more directly handle embeddign
+ - use ugtk2
+ - clean up embedding; since socket automatically emit plug-added gtk+
+ signal
+ when plug is realize, it's just cleaner to centralize/consolidate the
+ child
+ embedding in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR2', $::CCPID;"
+ - keyboarddrake, xfdrake, drakautoinst: goto cleaning btw
+ - clean up embedding; since socket get automatically destroyed on
+ child exit
+ and since they emit plug-removed at that moment, it's just cleaner to
+ centralize/consolidate the child exit in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR1', $::CCPID;"
+ - drakautoinst, drakxservices, keyboardrake: fix fscking embedding
+ managment
+
+ * standalone/drakxservices, diskdrake/hd_gtk.pm, standalone/drakboot,
+ standalone/drakTermServ:
+ - clean up embedding; since socket get automatically destroyed on
+ child exit
+ and since they emit plug-removed at that moment, it's just cleaner to
+ centralize/consolidate the child exit in mcc
+ this of course, need a newer up-to-date mcc
+ what's more, it allows to remove the somewhat mythical
+ "$::isEmbedded and kill 'USR1', $::CCPID;"
+ - drakautoinst, drakxservices, keyboardrake: fix fscking embedding
+ managment
+
+ * standalone/drakperm: fix #1771
+ level should not be editable
+
+ * services.pm: in standalone mode, only display a service as enabled at
+ boot time
+ only if it's really enabled in current runlevel.
+ what's more it's more coherent with other "only show current runlevel
+ status" tools like ntsysv.
+
+2003/02/24 Warly <warly@mandrakesoft.com>
+
+ * share/compssUsers: "Mail/Groupware/News" is now just "Mail"
+
+2003/02/23 Pablo Saratxaga <pablo@mandrakesoft.com>
+
+ * share/po/it.po: fixed several fuzzy lines
+
+2003/02/23 Pixel <pixel@mandrakesoft.com>
+
+ * timezone.pm: use output_p() instead of output() for
+ /etc/ntp/step-tickers
+
+2003/02/23 Till Kamppeter <till@mandrakesoft.com>
+
+ * standalone/scannerdrake: Fixed wait message not embedded in drakconf.
+
+ * printer/main.pm, printer/printerdrake.pm: Several bug fixes on
+ printerdrake
+ - "BrowsePoll <IP>:<Port>" needs "Browsing On" in
+ /etc/cups/cupsd.conf.
+ - If the same printer model is once on the parallel port and second on
+ USB,
+ there was a new USB queue created on every start of Printerdrake.
+ - Now CUPS is restarted whenever a new USB print queue is set up so
+ that
+ CUPS can provide the model-related USB URI.
+ - Made sure that the default printer is defined and that it is an
+ existing
+ queue so that during installation printerdrake does not show a line
+ only
+ containing " (Default)" in the list of installed printers.
+ - Cleaned up data structure after automatic queue generation.
+
2003/02/23 Pixel <pixel@mandrakesoft.com>
* diskdrake/interactive.pm (migrate_files): check return values (fixes bug
@@ -12671,7 +12915,7 @@
* Makefile.config: remove dir security
- * proxy.pm: add $Id: ChangeLog,v 1.791 2003/02/21 21:58:09 prigaux Exp $
+ * proxy.pm: add $Id: ChangeLog,v 1.792 2003/02/23 12:45:50 prigaux Exp $
* interactive/gtk.pm: use my_gtk {isWizard} and {isEmbedded} which are
more accurate than
ass="hl opt">}; } } $must_succeed and $urpm->{fatal}(10, N("Could not find a mirror from mirrorlist %s", $mirrorlists)); undef; } #- side-effects: $urpm->{mirrors_cache} sub _pick_one_ { my ($urpm, $mirrorlist, $allow_cache_update, $set_network_mtime) = @_; my $cache = _cache__may_clean_if_outdated($urpm, $mirrorlist, $allow_cache_update); if (!$cache->{chosen}) { if (!$cache->{list}) { if (_is_only_one_mirror($mirrorlist)) { $cache->{list} = [ { url => $mirrorlist } ]; } else { $cache->{list} = [ _list($urpm, $mirrorlist) ]; } $cache->{time} = time(); # the cache will be deemed outdated if network_mtime is more recent than the cache's $cache->{network_mtime} = _network_mtime() if $set_network_mtime; } $cache->{chosen} = $cache->{list}[0]{url} or return; _save_cache($urpm); } $cache; } #- side-effects: $urpm->{mirrors_cache} sub black_list { my ($urpm, $mirrorlists, $url) = @_; foreach my $mirrorlist (split ' ', $mirrorlists) { my $cache = _cache($urpm, $mirrorlist); if ($cache->{list}) { @{$cache->{list}} = grep { $_->{url} ne $url } @{$cache->{list}}; } delete $cache->{chosen}; } } #- side-effects: #- + those of _cache ($urpm->{mirrors_cache}) sub _cache__may_clean_if_outdated { my ($urpm, $mirrorlist, $allow_cache_update) = @_; my $cache = _cache($urpm, $mirrorlist); if ($allow_cache_update) { if ($cache->{network_mtime} && _network_mtime() > $cache->{network_mtime}) { $urpm->{log}("not using cached mirror list $mirrorlist since network configuration changed"); %$cache = (); } elsif ($cache->{time} && time() > $cache->{time} + 24*60*60 * $urpm->{options}{'days-between-mirrorlist-update'}) { $urpm->{log}("not using outdated cached mirror list $mirrorlist"); %$cache = (); } } $cache; } #- side-effects: $urpm->{mirrors_cache} sub _cache { my ($urpm, $mirrorlist) = @_; my $full_cache = $urpm->{mirrors_cache} ||= _load_cache($urpm); $full_cache->{$mirrorlist} ||= {}; } sub cache_file { my ($urpm) = @_; "$urpm->{cachedir}/mirrors.cache"; } sub _load_cache { my ($urpm) = @_; my $cache; if (-e cache_file($urpm)) { $urpm->{debug} and $urpm->{debug}("loading mirrors cache"); $cache = eval(cat_(cache_file($urpm))); $@ and $urpm->{error}("failed to read " . cache_file($urpm) . ": $@"); $_->{nb_uses} = 0 foreach values %$cache; } if ($ENV{URPMI_ADDMEDIA_PRODUCT_VERSION} && delete $cache->{'$MIRRORLIST'}) { $urpm->{log}('not using cached mirror list $MIRRORLIST since URPMI_ADDMEDIA_PRODUCT_VERSION is set'); } $cache || {}; } sub _save_cache { my ($urpm) = @_; require Data::Dumper; my $s = Data::Dumper::Dumper($urpm->{mirrors_cache}); $s =~ s/.*?=//; # get rid of $VAR1 = output_safe(cache_file($urpm), $s); } #- side-effects: none sub _list { my ($urpm, $mirrorlist) = @_; my @mirrors = _mirrors_filtered($urpm, _expand($mirrorlist)); add_proximity_and_sort($urpm, \@mirrors); @mirrors; } sub _expand { my ($mirrorlist) = @_; # expand the variables if ($mirrorlist eq '$MIRRORLIST') { _MIRRORLIST(); } else { require urpm::cfg; urpm::cfg::expand_line($mirrorlist); } } #- side-effects: $mirrors sub add_proximity_and_sort { my ($urpm, $mirrors) = @_; my ($latitude, $longitude, $country_code); require Time::ZoneInfo; if (my $zone = Time::ZoneInfo->current_zone) { if (my $zones = Time::ZoneInfo->new) { if (($latitude, $longitude) = $zones->latitude_longitude_decimal($zone)) { $country_code = $zones->country($zone); $urpm->{log}(N("found geolocalisation %s %.2f %.2f from timezone %s", $country_code, $latitude, $longitude, $zone)); } } } defined $latitude && defined $longitude or return; foreach (@$mirrors) { $_->{latitude} || $_->{longitude} or next; my $PI = 3.14159265358979; my $x = $latitude - $_->{latitude}; my $y = ($longitude - $_->{longitude}) * cos($_->{latitude} / 180 * $PI); $_->{proximity} = sqrt($x * $x + $y * $y); } my ($best) = sort { $a->{proximity} <=> $b->{proximity} } @$mirrors; foreach (@$mirrors) { $_->{proximity_corrected} = $_->{proximity} * _random_correction(); $_->{proximity_corrected} *= _between_country_correction($country_code, $_->{country}) if $best; $_->{proximity_corrected} *= _between_continent_correction($best->{continent}, $_->{continent}) if $best; } @$mirrors = sort { $a->{proximity_corrected} <=> $b->{proximity_corrected} } @$mirrors; } # add +/- 5% random sub _random_correction() { my $correction = 0.05; 1 + (rand() - 0.5) * $correction * 2; } sub _between_country_correction { my ($here, $mirror) = @_; $here && $mirror or return 1; $here eq $mirror ? 0.5 : 1; } sub _between_continent_correction { my ($here, $mirror) = @_; $here && $mirror or return 1; $here eq $mirror ? 0.5 : # favor same continent $here eq 'SA' && $mirror eq 'NA' ? 0.9 : # favor going "South America" -> "North America" 1; } sub _mirrors_raw { my ($urpm, $url) = @_; $urpm->{log}(N("getting mirror list from %s", $url)); my @l = urpm::download::get_content($urpm, $url) or $urpm->{error}("mirror list not found"); @l; } sub _mirrors_filtered { my ($urpm, $mirrorlist) = @_; grep { $_->{type} eq 'distrib'; # type=updates seems to be history, and type=iso is not interesting here } map { chomp; parse_LDAP_namespace_structure($_) } _mirrors_raw($urpm, $mirrorlist); } sub _MIRRORLIST() { my $product_id = parse_LDAP_namespace_structure(cat_('/etc/product.id')); _mandriva_mirrorlist($product_id); } sub _mandriva_mirrorlist { my ($product_id, $o_arch) = @_; #- contact the following URL to retrieve the list of mirrors. #- http://wiki.mandriva.com/en/Product_id my $product_type = lc($product_id->{type}); $product_id =~ s/\s//g; my $arch = $o_arch || $product_id->{arch}; my @para = grep { $_ } $ENV{URPMI_ADDMEDIA_REASON}; my $product_version = $ENV{URPMI_ADDMEDIA_PRODUCT_VERSION} || $product_id->{version}; "http://api.mandriva.com/mirrors/$product_type.$product_version.$arch.list" . (@para ? '?' . join('&', @para) : ''); } #- heuristic to detect wether it is really a mirrorlist or a simple mirror url: sub _is_only_one_mirror { my ($mirrorlist) = @_; _expand($mirrorlist) !~ /\.list(\?|$)/; } sub _network_mtime() { (stat('/etc/resolv.conf'))[9] } sub parse_LDAP_namespace_structure { my ($s) = @_; my %h = map { /(.*?)=(.*)/ ? ($1 => $2) : () } split(',', $s); \%h; } 1;