[gentoo-commits] proj/gentoo-mirrorstats:master commit in: conf/rsync/
commit: 8607ca6f71850c2c0b6c26e06c5e0cfa04111662 Author: Sam James gentoo org> AuthorDate: Sat Sep 9 04:33:25 2023 + Commit: Sam James gentoo org> CommitDate: Sat Sep 9 04:33:25 2023 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=8607ca6f conf/rsync/g.mirrors.extra: drop swan.g.o Retired in Sept 2021. Signed-off-by: Sam James gentoo.org> conf/rsync/g.mirrors.extra | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/rsync/g.mirrors.extra b/conf/rsync/g.mirrors.extra index 946afac..63e5116 100644 --- a/conf/rsync/g.mirrors.extra +++ b/conf/rsync/g.mirrors.extra @@ -2,5 +2,4 @@ gentoo rsync://masterportage.gentoo.org/ gentoo rsync://albatross.gentoo.org/ gentoo rsync://dipper.gentoo.org/ gentoo rsync://starling.gentoo.org/ -gentoo rsync://swan.gentoo.org/ gentoo rsync://turnstone.gentoo.org/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: conf/rsync/
commit: f453a0b455282a111eee31bed77a6a8378a5bedb Author: Sam James gentoo org> AuthorDate: Sat Sep 9 03:20:40 2023 + Commit: Sam James gentoo org> CommitDate: Sat Sep 9 03:20:40 2023 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=f453a0b4 conf/rsync/g.mirrors.extra: drop boobie.g.o Decommissioned a while ago. Signed-off-by: Sam James gentoo.org> conf/rsync/g.mirrors.extra | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/rsync/g.mirrors.extra b/conf/rsync/g.mirrors.extra index 4ead170..946afac 100644 --- a/conf/rsync/g.mirrors.extra +++ b/conf/rsync/g.mirrors.extra @@ -1,6 +1,5 @@ gentoo rsync://masterportage.gentoo.org/ gentoo rsync://albatross.gentoo.org/ -gentoo rsync://boobie.gentoo.org/ gentoo rsync://dipper.gentoo.org/ gentoo rsync://starling.gentoo.org/ gentoo rsync://swan.gentoo.org/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 005122b3fd5ec2dcabd1ce9a717937ab6950b1b0 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Mar 22 17:44:06 2023 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Mar 22 17:44:06 2023 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=005122b3 probe-mirmon: fix warning Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 1 + 1 file changed, 1 insertion(+) diff --git a/probe-mirmon b/probe-mirmon index 233b6a3..cfade50 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -117,6 +117,7 @@ sub handle_rsync { sub munge_date { no warnings 'numeric'; ## no critic (TestingAndDebugging::ProhibitNoWarnings) my $timestr = shift; + return -1 if !$timestr; my $timestamp = int($timestr); my $year2020 = 1577836800; my $year2038 = 2145916800;
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: fbfd5e0969fa94b51c4f73f13bf0f6d6e56e7440 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Mar 22 16:13:15 2023 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Mar 22 16:13:15 2023 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=fbfd5e09 probe-mirmon: workaround: back to wget for FTP Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 6 ++ 1 file changed, 6 insertions(+) diff --git a/probe-mirmon b/probe-mirmon index ff73776..a40be16 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -29,6 +29,11 @@ sub main { if ( $url =~ m,^rsync://, ) { handle_rsync( $timeout, $url ); } + elsif ( $url =~ m,^ftp://, ) { + # Hacky, at some point CURL stopped returning the output here; just go back to wget for now. +#handle_libcurl( $timeout, $url ); +handle_wget( $timeout, $url ); + } else { handle_libcurl( $timeout, $url ); } @@ -44,6 +49,7 @@ sub handle_libcurl { $curl->setopt(CURLOPT_TIMEOUT, $timeout); $curl->setopt(CURLOPT_FTP_USE_EPSV, 1); $curl->setopt(CURLOPT_URL, $url); + $curl->setopt(CURLOPT_VERBOSE, 1) if $url =~ m,^ftp://,; # A filehandle, reference to a scalar or reference to a typeglob can be used here. my $response_body;
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: a8e55ea71ba5602d791561c105310a53566f0503 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Mar 22 16:29:34 2023 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Mar 22 16:29:34 2023 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a8e55ea7 probe-mirmon: cleanup Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 35 +++ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/probe-mirmon b/probe-mirmon index a40be16..233b6a3 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -76,7 +76,15 @@ sub handle_wget { my ( $timeout, $url ) = @_; # TODO: replace this with native HTTP # TODO: munge the output! - exec {'/usr/bin/wget'} 'wget', qw( -q --passive-ftp -O - -T ), $timeout, '-t', 1, $url; + # kill -9 wget when it gets really stuck. + my $tmpdir = File::Tempdir->new(); + my $dir= $tmpdir->name; + my $file = $url; + + $file =~ s/\W/_/g;# translate all non-letters to _ + system {'/usr/bin/timeout'} qw(--preserve-status -s KILL -k ), ($timeout + 1), ($timeout + 0.5), + 'wget', qw( -q --passive-ftp -T ), $timeout, '-t', 1, '-O', "$dir/$file", $url; + slurp_and_output("$dir/$file"); } sub handle_rsync { @@ -90,20 +98,18 @@ sub handle_rsync { # https://stackoverflow.com/a/6331618/1583179 my ($stdout, $stderr, $ret) = capture { - system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file"; + system {'/usr/bin/rsync'} qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file"; }; + #print "STDOUT: $stdout\n"; + #print "STDERR $stderr\n"; + #print "RET: $ret\n"; if ($ret!=0) { #warn "rsync failed, exit code $fail, $! $? $@\n"; #exit $ret; exit 800; } - open my $fh, '<', "$dir/$file" or do { -warn "Opening Downloaded timestamp Failed"; -exit 900; # rediculous exit code. - }; - - print munge_date(<$fh>); + slurp_and_output("$dir/$file"); exit 0; } @@ -123,3 +129,16 @@ sub munge_date { } return -1; } + +sub slurp_and_output { + my $filename = shift; + open my $fh, '<', $filename or do { +warn "Opening Downloaded timestamp Failed"; +exit 900; # rediculous exit code. + }; + my $line = <$fh>; + #print "RAW: $line\n"; + + print munge_date($line), "\n"; + exit 0; +}
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: conf/rsync/
commit: b471c2c65cc4d5c946c07bf71c25f63610ae2663 Author: Robin H. Johnson gentoo org> AuthorDate: Sun Aug 2 04:15:44 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Sun Aug 2 04:15:44 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=b471c2c6 conf/rsync/g.mirrors.extra: missing mirror Signed-off-by: Robin H. Johnson gentoo.org> conf/rsync/g.mirrors.extra | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/rsync/g.mirrors.extra b/conf/rsync/g.mirrors.extra index b77eb9e..4ead170 100644 --- a/conf/rsync/g.mirrors.extra +++ b/conf/rsync/g.mirrors.extra @@ -4,3 +4,4 @@ gentoo rsync://boobie.gentoo.org/ gentoo rsync://dipper.gentoo.org/ gentoo rsync://starling.gentoo.org/ gentoo rsync://swan.gentoo.org/ +gentoo rsync://turnstone.gentoo.org/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: a0bd86ca404ac92f7751c6407445cb51419c44d0 Author: Max Magorsch gentoo org> AuthorDate: Sun Jun 7 21:55:13 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun Jun 7 21:55:13 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a0bd86ca Enlarge the page when using the filters Signed-off-by: Max Magorsch gentoo.org> html/stats.jinja2 | 41 - 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 482a2cf..9c04d5a 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -78,7 +78,7 @@ - + Gentoo {% if type != "all" %}{{ type[0]|upper}}{{type[1:]}}{%endif%} Mirrors @@ -98,6 +98,12 @@ + + + + + + @@ -207,9 +213,13 @@ -$(function() { +var map; +function drawMap() { + if(map){ + map.remove(); + } L.Icon.Default.imagePath = 'https://www.gentoo.org/assets/img/maps/'; - var map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2); + map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2); var markers = {}; map.addLayer(new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © https://openstreetmap.org">OpenStreetMap contributors' })); @@ -307,7 +317,9 @@ markers[index] = marker; } }); -}); +} + +drawMap();
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 0c18044a46251aeefb66a8145f75d964ccbe691c Author: Max Magorsch gentoo org> AuthorDate: Sun Jun 7 20:39:47 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun Jun 7 20:39:47 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0c18044a Add filters Signed-off-by: Max Magorsch gentoo.org> html/stats.jinja2 | 31 +++ 1 file changed, 31 insertions(+) diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 98d8474..482a2cf 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -8,6 +8,13 @@ https://www.gentoo.org/assets/css/leaflet.css; rel="stylesheet" media="screen"> https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.css"/> https://www.gentoo.org/favicon.ico; type="image/x-icon"> + +.filter-button, .filter-button:hover { +color: #495057; +background-color: #fff; +border: 1px solid #ced4da; +} + @@ -345,6 +352,7 @@ ], "initComplete": function( settings, json ) { setTimeout(function(){ +$('#table_id_length').prepend("Toggle Filters"); table.buttons().container().prependTo($('#table_id_length')); $('#table_id_length').prepend(" Show "); document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4"; @@ -353,6 +361,29 @@ }); } ); +function addFilters(){ + +if($("#filterRow").length) { +$("#filterRow").remove(); +}else{ +$('#table_id thead tr').clone(true).appendTo('#table_id thead'); +$('#table_id thead tr:eq(1)').attr("id", "filterRow"); +$('#table_id thead tr:eq(1) th').each(function (i) { +var title = $(this).text(); +$(this).html(''); + +$('input', this).on('keyup change', function () { +if (table.column(i).search() !== this.value) { +table +.column(i) +.search(this.value) +.draw(); +} +}); +}); +} +} +
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 5e1952bf1d469fdfa23402ff60e9525c693a4194 Author: Max Magorsch gentoo org> AuthorDate: Sun Jun 7 20:17:32 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun Jun 7 20:17:32 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=5e1952bf Show the tls version for https mirrors only Signed-off-by: Max Magorsch gentoo.org> html/stats.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 02b50ff..98d8474 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -114,7 +114,7 @@ {{ stat['Protocol'] }} {{ stat['StateHistory'] }} {{ stat['ProbeHistory'] }} -{{ mirrors[mirror]['TLSVersion'] }} +{% if stat['Protocol'] == "https" %}{{ mirrors[mirror]['TLSVersion'] }}{% endif %} {% if stat['StatusLastProbe'] == "ok" %} OK
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: dfbd3fa53c78c389bf99940c6726a417e2d52cfb Author: Max Magorsch gentoo org> AuthorDate: Sun Jun 7 19:53:36 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun Jun 7 19:53:36 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=dfbd3fa5 Check TLS version and display it in the table Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 31 +++ html/stats.jinja2 | 29 - 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/html/generate.py b/html/generate.py index d88e030..a4b75e8 100755 --- a/html/generate.py +++ b/html/generate.py @@ -15,6 +15,7 @@ import datetime import socket +import ssl import os import tempfile import urllib.request, json @@ -64,6 +65,19 @@ def getIp(hostname): ip = "" return ip +# +# Get TLS version of the given host +# +def getTLSVersion(hostname): +socket.setdefaulttimeout(2) +try: +with socket.create_connection((hostname, 443)) as sock: +with ssl.create_default_context().wrap_socket(sock, server_hostname=hostname) as ssock: +return ssock.version().replace("TLSv", "", 1) +except: +print("err") +return '' + # # Render the stats template for a given page, i.e. all, rsync, distfiles... @@ -87,6 +101,12 @@ if os.path.exists(cache_path): with open(cache_path, mode='rt') as json_file: try: cache_data = json.load(json_file) +if 'ips' not in cache_data: +cache_data['ips'] = {} +if 'hosts' not in cache_data: +cache_data['hosts'] = {} +if 'tls_version' not in cache_data: +cache_data['tls_version'] = {} except: pass @@ -150,6 +170,17 @@ def getHostList(mirrorstatsList): # populate cache with new value cache_data['ips'][ip] = mirrorGeoData['loc'] +for host in hosts: +if 'https' not in hosts[host]['Protocols']: +hosts[host]['TLSVersion'] = '' +continue +if host in cache_data['tls_version']: +hosts[host]['TLSVersion'] = cache_data['tls_version'][host] +else: +tlsVersion = getTLSVersion(host) +hosts[host]['TLSVersion'] = tlsVersion +cache_data['tls_version'][host] = tlsVersion + return lastUpdate, hosts diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 22fb50d..02b50ff 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -6,7 +6,7 @@ https://assets.gentoo.org/tyrian/v2/tyrian.min.css; rel="stylesheet" media="screen"> https://www.gentoo.org/assets/css/leaflet.css; rel="stylesheet" media="screen"> -https://cdn.datatables.net/v/bs4/dt-1.10.20/datatables.min.css"/> +https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.css"/> https://www.gentoo.org/favicon.ico; type="image/x-icon"> @@ -100,6 +100,7 @@ Protocol Daily Stats Probe Stats +TLS Last State @@ -113,6 +114,7 @@ {{ stat['Protocol'] }} {{ stat['StateHistory'] }} {{ stat['ProbeHistory'] }} +{{ mirrors[mirror]['TLSVersion'] }} {% if stat['StatusLastProbe'] == "ok" %} OK @@ -194,7 +196,7 @@ https://www.gentoo.org/assets/js/leaflet.js"> - https://cdn.datatables.net/v/bs4/dt-1.10.20/rg-1.1.1/datatables.min.js"> + https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.js"> @@ -302,9 +304,9 @@
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: d4c309a69808b12c6e70532b6b295bf0d1b4d5e4 Author: Max Magorsch gentoo org> AuthorDate: Thu May 7 21:00:14 2020 + Commit: Max Magorsch gentoo org> CommitDate: Thu May 7 21:00:14 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=d4c309a6 Add an option to show all entries in the datatable Signed-off-by: Max Magorsch gentoo.org> html/stats.jinja2 | 1 + 1 file changed, 1 insertion(+) diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 9596930..22fb50d 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -307,6 +307,7 @@ $('#table_id').DataTable({ "autoWidth": true, "iDisplayLength": 25, +"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], // TODO Group by Region in future // rowGroup: { // dataSrc: 1
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 30f11878cf9a37ba3ab5759db5d0546be4e6f0d5 Author: Max Magorsch gentoo org> AuthorDate: Thu May 7 20:44:12 2020 + Commit: Max Magorsch gentoo org> CommitDate: Thu May 7 20:44:12 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=30f11878 Fix the chmod by using the 0o prefix Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/generate.py b/html/generate.py index 3d7c458..d88e030 100755 --- a/html/generate.py +++ b/html/generate.py @@ -177,7 +177,7 @@ template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html") # with tempfile.NamedTemporaryFile(dir=os.path.dirname(cache_path), delete=False, mode='wt') as fout: json.dump(cache_data, fout) -os.chmod(fout.name, 644) +os.chmod(fout.name, 0o644) os.replace(fout.name, cache_path)
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 6f7e496c82c0f3f0c194e78691af8ba2e3a65b8e Author: Max Magorsch gentoo org> AuthorDate: Thu May 7 20:25:15 2020 + Commit: Max Magorsch gentoo org> CommitDate: Thu May 7 20:25:15 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=6f7e496c Fix os.chmod by using an int instead of a string Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/generate.py b/html/generate.py index 8d79cbe..3d7c458 100755 --- a/html/generate.py +++ b/html/generate.py @@ -177,7 +177,7 @@ template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html") # with tempfile.NamedTemporaryFile(dir=os.path.dirname(cache_path), delete=False, mode='wt') as fout: json.dump(cache_data, fout) -os.chmod(fout.name, '0644') +os.chmod(fout.name, 644) os.replace(fout.name, cache_path)
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: b29132aafc10f1a3758b5145a84e320502e6f7d4 Author: Robin H. Johnson gentoo org> AuthorDate: Thu May 7 17:53:39 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu May 7 18:18:10 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=b29132aa html/generate.py: improve cache file handling Signed-off-by: Robin H. Johnson gentoo.org> html/generate.py | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/html/generate.py b/html/generate.py index 8eb7622..8d79cbe 100755 --- a/html/generate.py +++ b/html/generate.py @@ -15,6 +15,8 @@ import datetime import socket +import os +import tempfile import urllib.request, json import xml.etree.ElementTree as ET import jinja2 @@ -81,8 +83,12 @@ def renderStatsTemplate(templateEnv, page): # read the cache -with open(cache_path) as json_file: -cache_data = json.load(json_file) +if os.path.exists(cache_path): +with open(cache_path, mode='rt') as json_file: +try: +cache_data = json.load(json_file) +except: +pass # # The all mirrors that are present in the given list @@ -169,8 +175,10 @@ template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html") # # write the cache # -with open(cache_path, 'w') as fp: -json.dump(cache_data, fp) +with tempfile.NamedTemporaryFile(dir=os.path.dirname(cache_path), delete=False, mode='wt') as fout: +json.dump(cache_data, fout) +os.chmod(fout.name, '0644') +os.replace(fout.name, cache_path) #
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 71512aa7cfffd1430c7aeb3409551a10da2a693b Author: Robin H. Johnson gentoo org> AuthorDate: Thu May 7 17:53:13 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu May 7 17:53:13 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=71512aa7 html/generate.py: disable success print spam Signed-off-by: Robin H. Johnson gentoo.org> html/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/generate.py b/html/generate.py index 025004d..8eb7622 100755 --- a/html/generate.py +++ b/html/generate.py @@ -176,4 +176,4 @@ with open(cache_path, 'w') as fp: # # finish # -print("Finished.") +#print("Finished.")
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 695894f1f677c29fc65a2e660beeefa669820e89 Author: Max Magorsch gentoo org> AuthorDate: Wed May 6 23:46:16 2020 + Commit: Max Magorsch gentoo org> CommitDate: Wed May 6 23:46:16 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=695894f1 Use https everywhere Signed-off-by: Max Magorsch gentoo.org> html/stats.jinja2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 35f012a..9596930 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -77,7 +77,7 @@ Gentoo {% if type != "all" %}{{ type[0]|upper}}{{type[1:]}}{%endif%} Mirrors {% if type != "all" %} -http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"> +https://www.w3.org/2000/svg; xmlns:xlink="https://www.w3.org/1999/xlink; aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"> {% endif %} @@ -150,7 +150,7 @@ Mirror Data as current of{{ lastUpdate }} - Data powered by:http://www.staff.science.uu.nl/~penni101/mirmon/;>Mirmon v2.11 + Data powered by:https://www.staff.science.uu.nl/~penni101/mirmon/;>Mirmon v2.11 @@ -203,7 +203,7 @@ var map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2); var markers = {}; - map.addLayer(new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © http://openstreetmap.org;>OpenStreetMap contributors' })); + map.addLayer(new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © https://openstreetmap.org;>OpenStreetMap contributors' })); var greenIcon = new L.Icon({
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: htdocs/, html/
commit: cd3b03e04c7f3f5693f4224caa44392ee8c066ae Author: Max Magorsch gentoo org> AuthorDate: Wed May 6 23:26:26 2020 + Commit: Max Magorsch gentoo org> CommitDate: Wed May 6 23:26:26 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=cd3b03e0 Move the tyrian based pages into production Signed-off-by: Max Magorsch gentoo.org> htdocs/.keep | 0 htdocs/index.html | 173 -- html/generate.py | 2 +- 3 files changed, 1 insertion(+), 174 deletions(-) diff --git a/htdocs/.keep b/htdocs/.keep new file mode 100644 index 000..e69de29 diff --git a/htdocs/index.html b/htdocs/index.html deleted file mode 100644 index 3d907cb..000 --- a/htdocs/index.html +++ /dev/null @@ -1,173 +0,0 @@ - - - -Gentoo mirrorstats - - - -https://assets.gentoo.org/tyrian/v1/bootstrap.min.css; rel="stylesheet" media="screen"> -https://assets.gentoo.org/tyrian/v1/tyrian.min.css; rel="stylesheet" media="screen"> -https://www.gentoo.org/favicon.ico; type="image/x-icon"> - - - - - - - - -https://get.gentoo.org/; role="button" class="btn get-gentoo"> Get Gentoo! - - - gentoo.org sites - - -https://www.gentoo.org/; title="Main Gentoo website"> gentoo.org -https://wiki.gentoo.org/; title="Find and contribute documentation"> Wiki -https://bugs.gentoo.org/; title="Report issues and find common issues"> Bugs -https://forums.gentoo.org/; title="Discuss with the community"> Forums -https://packages.gentoo.org/; title="Find software for your Gentoo"> Packages - -https://planet.gentoo.org/; title="Find out what's going on in the developer community"> Planet -https://archives.gentoo.org/; title="Read up on past discussions"> Archives -https://sources.gentoo.org/; title="Browse our source code"> Sources - -https://infra-status.gentoo.org/; title="Get updates on the services provided by Gentoo"> Infra Status - - - - - - -https://assets.gentoo.org/tyrian/v1/site-logo.svg; type="image/svg+xml"> - https://assets.gentoo.org/tyrian/v1/site-logo.png; alt="Gentoo Linux Logo"> - - - mirrorstats - - - - - - - - - -Toggle navigation - - - - - - - -Home - - -rsync - - -distfiles - - -snapshots - - -releases - - -experimental - - - - - - - - - - - Gentoo mirrorstats - - - Welcome to the Gentoo Linux mirrorstats system. -This page links to the mirror status for rsync source mirrors. - - - Gentoo rsync mirrors - Gentoo rsync mirrors tracked include both official mirrors run by the Gentoo Infrastructure team, as well as community-run mirrors. - - https://www.gentoo.org/support/rsync-mirrors/;>Listing of Gentoo rsync mirrors - https://wiki.gentoo.org/wiki/Project:Infrastructure/Mirrors/Rsync;>How to contribute a new rsync mirror - Status of Gentoo rsync mirrors - - - Gentoo source mirrors - - https://www.gentoo.org/downloads/mirrors/;>Listing of Gentoo source mirrors - https://wiki.gentoo.org/wiki/Project:Infrastructure/Mirrors/Source;>How to contribute a new source mirror - Status of Gentoo source mirrors: /distfiles/ - Status of Gentoo source mirrors: /experimental/ - Status of Gentoo source mirrors: /releases/ - Status of Gentoo source mirrors: /snapshots/ - - - - If you experience problems with a specific mirror, please file clearly marked bugs in https://bugs.gentoo.org/enter_bug.cgi?product=Mirrors;>Gentoo Bugzilla (product Mirrors). - Please include lots of details about the problem, as the Gentoo - mirror team will have to contact the administrator of individual - mirrors to work on problems. -
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 65aa6442fc6d8cc3d5688255911667bd133b97fc Author: Max Magorsch gentoo org> AuthorDate: Sun May 3 23:07:46 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun May 3 23:07:46 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=65aa6442 Use index.html instead of all.html for the landing page Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 4 +++- html/help.jinja2 | 2 +- html/stats.jinja2 | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/html/generate.py b/html/generate.py index abb7100..8ab5898 100755 --- a/html/generate.py +++ b/html/generate.py @@ -69,12 +69,14 @@ def getIp(hostname): def renderStatsTemplate(templateEnv, page): if page == "all": mirrorstatsList = mirrorstats +page_name = "index" else: mirrorstatsList = ['https://mirrorstats.gentoo.org/' + page + '/state.json'] +page_name = page lastUpdate, hostList = getHostList(mirrorstatsList) template = templateEnv.get_template("stats.jinja2") -template.stream(lastUpdate=lastUpdate, type=page, mirrors=hostList, locations=json.dumps(hostList)).dump(html_folder + page + ".html") +template.stream(lastUpdate=lastUpdate, type=page, mirrors=hostList, locations=json.dumps(hostList)).dump(html_folder + page_name + ".html") return lastUpdate diff --git a/html/help.jinja2 b/html/help.jinja2 index 6e08363..678e649 100644 --- a/html/help.jinja2 +++ b/html/help.jinja2 @@ -55,7 +55,7 @@ -Home +Home Rsync Distfiles Snapshots diff --git a/html/stats.jinja2 b/html/stats.jinja2 index e13cd45..35f012a 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -57,7 +57,7 @@ -Home +Home Rsync Distfiles Snapshots
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 7f9568e9554cf7d174535eceff778a40aa499cd0 Author: Max Magorsch gentoo org> AuthorDate: Sun May 3 22:53:06 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun May 3 22:53:06 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=7f9568e9 Use absolute path for the html template folder Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/html/generate.py b/html/generate.py index d6f21c0..33a3cd5 100755 --- a/html/generate.py +++ b/html/generate.py @@ -20,6 +20,7 @@ import xml.etree.ElementTree as ET import jinja2 html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/" +template_folder = "/var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/html/" cache_path = "/var/www/mirrorstats.gentoo.org/var/html_data_cache.json" @@ -147,7 +148,7 @@ def getHostList(mirrorstatsList): # # render jinja2 # -templateLoader = jinja2.FileSystemLoader(searchpath="./") +templateLoader = jinja2.FileSystemLoader(searchpath=template_folder) templateEnv = jinja2.Environment(loader=templateLoader) ## stats @@ -174,5 +175,3 @@ with open(cache_path, 'w') as fp: # finish # print("Finished.") - -
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: e11cf4a53e7086c2afd51a55d287de45daba4951 Author: Max Magorsch gentoo org> AuthorDate: Sun May 3 22:53:55 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun May 3 22:53:55 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=e11cf4a5 Use separate folder for the html pages Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/generate.py b/html/generate.py index 33a3cd5..abb7100 100755 --- a/html/generate.py +++ b/html/generate.py @@ -19,7 +19,7 @@ import urllib.request, json import xml.etree.ElementTree as ET import jinja2 -html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/" +html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/new/" template_folder = "/var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/html/" cache_path = "/var/www/mirrorstats.gentoo.org/var/html_data_cache.json"
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
commit: 1676f2fc64880251befdb18ad22f59dae0ae1f4e Author: Max Magorsch gentoo org> AuthorDate: Sun May 3 22:45:07 2020 + Commit: Max Magorsch gentoo org> CommitDate: Sun May 3 22:45:07 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=1676f2fc Generate html pages based on the mirmon data A python script is used to generate html pages based on the data produced by mirmon. The html pages visualize the mirror stats using the gentoo tyrian theme. Signed-off-by: Max Magorsch gentoo.org> html/generate.py | 178 html/help.jinja2 | 163 ++ html/stats.jinja2 | 339 ++ 3 files changed, 680 insertions(+) diff --git a/html/generate.py b/html/generate.py new file mode 100755 index 000..d6f21c0 --- /dev/null +++ b/html/generate.py @@ -0,0 +1,178 @@ +#!/usr/bin/python + +# +# Generate html pages based on the Mirmon data +# +# This script will parse the json files that contain the mirmon +# data and have been generated before. The json data is used to +# generate html pages that visualize the mirmon data in a human +# readable way. +# +# +# Leaflet is used to visualize the mirrors on a world map. Further- +# more Datatables are used to display the mirrors. +# + +import datetime +import socket +import urllib.request, json +import xml.etree.ElementTree as ET +import jinja2 + +html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/" +cache_path = "/var/www/mirrorstats.gentoo.org/var/html_data_cache.json" + + +mirrorstats = [ 'https://mirrorstats.gentoo.org/rsync/state.json', +'https://mirrorstats.gentoo.org/distfiles/state.json', +'https://mirrorstats.gentoo.org/snapshots/state.json', +'https://mirrorstats.gentoo.org/releases/state.json', +'https://mirrorstats.gentoo.org/experimental/state.json' + ] + +cache_data = {} + + +# +# Retrieve and parse the JSON at the given URL +# +def getJson(url): +req = urllib.request.Request(url) +r = urllib.request.urlopen(req).read() +return json.loads(r.decode('utf-8')) + + +# +# Retrieve and parse the XML at the given URL +# +def getXML(url): +req = urllib.request.Request(url) +r = urllib.request.urlopen(req).read() +return ET.loads(r.decode('utf-8')).getroot() + + +# +# Get the ip of the given host +# +def getIp(hostname): +try: +ip = socket.gethostbyname(hostname) +except: +ip = "" +return ip + + +# +# Render the stats template for a given page, i.e. all, rsync, distfiles... +# +def renderStatsTemplate(templateEnv, page): +if page == "all": +mirrorstatsList = mirrorstats +else: +mirrorstatsList = ['https://mirrorstats.gentoo.org/' + page + '/state.json'] + +lastUpdate, hostList = getHostList(mirrorstatsList) +template = templateEnv.get_template("stats.jinja2") +template.stream(lastUpdate=lastUpdate, type=page, mirrors=hostList, locations=json.dumps(hostList)).dump(html_folder + page + ".html") +return lastUpdate + + +# read the cache +with open(cache_path) as json_file: +cache_data = json.load(json_file) + +# +# The all mirrors that are present in the given list +# +def getHostList(mirrorstatsList): +hosts = {} +lastUpdate = "" + +# process all mirrors +for mirror_url in mirrorstatsList: + +mirrorData = getJson(mirror_url) +lastUpdate = datetime.datetime.fromtimestamp(int(mirrorData['LastUpdate'])).strftime('%Y-%m-%d %H:%M:%S') + +for mirror in mirrorData['Mirrors']: +if len(mirrorData['Mirrors'][mirror]) >= 0: +for mirrorHost in mirrorData['Mirrors'][mirror]: +hostname = mirrorHost['Host'] +if hostname not in hosts: +hosts[hostname] = {} + +hosts[hostname]['Hostname'] = hostname + +if hostname in cache_data['hosts']: +ip = cache_data['hosts'][hostname] +else: +ip = getIp(hostname) +# populate cache with new value +cache_data['hosts'][hostname] = ip + +if ip != "": +hosts[hostname]['Ip'] = ip + +if 'Stats' not in hosts[hostname]: +hosts[hostname]['Stats'] = [] + +mirrorHost['Type'] = mirror_url.replace("https://mirrorstats.gentoo.org/;, "").replace("/state.json", "") +hosts[hostname]['Stats'].append(mirrorHost) + +# compute available protocols +for host in hosts: +protocols = [] +for stat in hosts[host]['Stats']: +protocols.append(stat['Protocol']) + +hosts[host]['Protocols'] = list(set(protocols)) + +# compute mirror locations +for host in hosts: +if 'Ip' not in
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: a568c369788436b7a10b8de7cf8051f2c0130a23 Author: Robin H. Johnson gentoo org> AuthorDate: Fri May 1 17:59:16 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Fri May 1 17:59:16 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a568c369 mirmon-wrapper.sh: missed case in args Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 0340ec6..e641c75 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -122,6 +122,7 @@ INVALID= while [[ $# -gt 0 ]]; do case "$1" in + # Strs: --mode) MODE=$2 shift 2 @@ -135,6 +136,11 @@ while [[ $# -gt 0 ]]; do URL=$2 shift 2 ;; + # Bools: + --quiet) + QUIET=1 + shift + ;; --debug) DEBUG=1 shift @@ -147,8 +153,8 @@ while [[ $# -gt 0 ]]; do HELP=1 shift ;; + # End of options --) - # End of options break ;; *)
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 0a9a4c6f6942417fe26a8ce2d457ed340b4098dd Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 22:59:36 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 22:59:36 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0a9a4c6f probe-mirmon: ensure valid return from munge Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/probe-mirmon b/probe-mirmon index b0c3413..ff73776 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -112,6 +112,8 @@ sub munge_date { if($timestamp >= $year2020 && $timestamp <= $year2038) { return $timestamp; } else { - return Date::Parse::str2time($timestr); + my $timestamp = Date::Parse::str2time($timestr); + return $timestamp if defined($timestamp); } + return -1; }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: ea8162cb6dde42c2c827bea7c19d7f2eee9d59fd Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 22:56:36 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 22:56:36 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=ea8162cb probe-mirmon: improve capture usage Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/probe-mirmon b/probe-mirmon index cd97274..b0c3413 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -83,9 +83,8 @@ sub handle_rsync { $file =~ s/\W/_/g;# translate all non-letters to _ # https://stackoverflow.com/a/6331618/1583179 - my $ret; - my ($stdout, $stderr) = capture { - $ret = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file"; + my ($stdout, $stderr, $ret) = capture { + system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file"; }; if ($ret!=0) { #warn "rsync failed, exit code $fail, $! $? $@\n";
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 7fcc1ed190b63b194015a60f3a9fe71a63319c9f Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 22:53:34 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 22:53:34 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=7fcc1ed1 probe-mirmon: fix typo Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/probe-mirmon b/probe-mirmon index 5d99cda..cd97274 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -56,7 +56,7 @@ sub handle_libcurl { exit 800 unless ($retcode == 0); my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); - exit 801 unless ($response_code == 200) + exit 801 unless ($response_code == 200); exit 802 unless defined($response_body); chomp $response_body; print(munge_date($response_body), "\n");
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 1090b5588fa26cedc773014c9d46cdbf91ea55f7 Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 22:52:13 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 22:52:13 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=1090b558 mirmon-wrapper.sh: always shift old args Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 2cb6260..0340ec6 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -131,19 +131,21 @@ while [[ $# -gt 0 ]]; do XML_SRC=$2 shift 2 ;; - --url) URL=$2 shift 2 ;; --debug) DEBUG=1 + shift ;; --verbose) VERBOSE=1 + shift ;; --help) HELP=1 + shift ;; --) # End of options
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 89b22bd35232b7c4f10a8961c71f9f6d6077bf61 Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 22:17:26 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 22:17:26 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=89b22bd3 mirmon-wrapper.sh: fix arg handling Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 04be5ce..2cb6260 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -20,7 +20,7 @@ helpmsg() { } usage() { - helpmsg "Usage: ${NAME}$(printf " --%s=..." "${OPTIONS_STR[@]}" )$(printf " --%s" "${OPTIONS_BOOL[@]}")" + helpmsg "Usage: ${NAME}$(printf " --%s=..." "${OPTIONS_STR[@]}" )$(printf " [--%s]" "${OPTIONS_BOOL[@]}")" exit 3 } @@ -112,9 +112,9 @@ opts=$(getopt \ eval set --$opts -MODE='' -XML_SRC='' -URL='' +MODE= +XML_SRC= +URL= HELP= DEBUG= VERBOSE= @@ -138,15 +138,12 @@ while [[ $# -gt 0 ]]; do ;; --debug) DEBUG=1 - break ;; --verbose) VERBOSE=1 - break ;; --help) HELP=1 - break ;; --) # End of options
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 6167a39af9568ec73795d2568f30a43d86d2381a Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 21:26:38 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 21:26:38 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=6167a39a mirmon-wrapper.sh: support debug/verbose/quiet Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 70 +++ 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 74a12d6..04be5ce 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -2,24 +2,35 @@ NAME=$(basename "$0") -OPTIONS=( +OPTIONS_STR=( "mode" "xml-src" "url" ) +OPTIONS_BOOL=( + "help" + "debug" + "verbose" + "quiet" +) + + +helpmsg() { + echo "$*" 1>&2 +} usage() { - echo "Usage: ${NAME}$(printf " --%s=..." "${OPTIONS[@]}" )" 1>&2 + helpmsg "Usage: ${NAME}$(printf " --%s=..." "${OPTIONS_STR[@]}" )$(printf " --%s" "${OPTIONS_BOOL[@]}")" exit 3 } dohelp() { - echo "${NAME} TODO" 1>&2 + helpmsg "${NAME} TODO" exit 0 } die() { - echo "$*" 1>&2 + helpmsg "$*" exit 2 } @@ -34,7 +45,17 @@ main() { VAR_GMIRRORS=${VARDIR}/g.mirrors EXTRA_MIRRORS=${CONFDIR}/g.mirrors.extra # Lock outselves - [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "${VARDIR}/flock" "$0" "--xml-src=${XML_SRC}" "--mode=${MODE}" "--url=${URL}" || : + if [ "${FLOCKER}" != "$0" ]; then + exec \ + env FLOCKER="$0" flock -en "${VARDIR}/flock" \ + "$0" \ + ${DEBUG:+--debug} \ + ${QUIET:+--quiet} \ + ${VERBOSE:+--verbose} \ + "--xml-src=${XML_SRC}" \ + "--mode=${MODE}" \ + "--url=${URL}" + fi # Grab mirrors from the web mkdir -p "${VARDIR}" "${HTDOCS}" || die "Failed to mkdir" @@ -52,8 +73,16 @@ main() { test -w "${VARDIR}/mirmon.state" || die "Cannot write state file!" fi + MIRMON_OPTS=( +-c "${CONFFILE}" +-get update + ) + [[ $VERBOSE -eq 1 ]] && MIRMON_OPTS+=( '-v' ) + [[ $DEBUG -eq 1 ]] && MIRMON_OPTS+=( '-d' ) + [[ $QUIET -eq 1 ]] && MIRMON_OPTS+=( '-q' ) + # run mirmon - /usr/bin/perl "${MIRMON}" -c "${CONFFILE}" -q -get update || die "mirmon failed: $?" + /usr/bin/perl "${MIRMON}" "${MIRMON_OPTS[@]}" || die "mirmon failed: $?" # Set up a nice link to our mirror page directly: sed \ @@ -74,7 +103,8 @@ main() { } opts=$(getopt \ - --longoptions "$(printf "%s:," "${OPTIONS[@]}" )" \ + --longoptions "$(printf "%s:," "${OPTIONS_STR[@]}" )" \ + --longoptions "$(printf "%s," "${OPTIONS_BOOL[@]}" )" \ --name "$(basename "$0")" \ --options "" \ -- "$@" @@ -85,8 +115,10 @@ eval set --$opts MODE='' XML_SRC='' URL='' -HELP=0 -INVALID=0 +HELP= +DEBUG= +VERBOSE= +INVALID= while [[ $# -gt 0 ]]; do case "$1" in @@ -104,6 +136,14 @@ while [[ $# -gt 0 ]]; do URL=$2 shift 2 ;; + --debug) + DEBUG=1 + break + ;; + --verbose) + VERBOSE=1 + break + ;; --help) HELP=1 break @@ -143,12 +183,12 @@ for m in "${XML_SRC_INPUTS[@]}"; do done [[ $XML_SRC_VALID -eq 1 ]] || XML_SRC='' -[[ -z "$MODE" ]] && die "--mode must be one of: ${MODE_INPUTS[*]}" -[[ -z "$XML_SRC" ]] && die "--xml-src must be one of: ${XML_SRC_INPUTS[*]}" -[[ -z "$URL" ]] && die "--url unset" +[[ "$INVALID" == 1 ]] && usage +[[ "$HELP" == 1 ]] && dohelp -[[ $INVALID -eq 1 ]] && usage -[[ $HELP -eq 1 ]] && dohelp +if [[ -z "$MODE" ]]; then helpmsg "--mode must be one of: ${MODE_INPUTS[*]}" ; INVALID=1 ; fi +if [[ -z "$XML_SRC" ]]; then helpmsg "--xml-src must be one of: ${XML_SRC_INPUTS[*]}" ; INVALID=1 ; fi +if [[ -z "$URL" ]]; then helpmsg "--url unset" ; INVALID=1 ; fi +[[ "$INVALID" == 1 ]] && usage -OPTS=( ${opts} ) # for flock main
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 6bf3f8110e00e69c67bbe888b92d512152dfc94b Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 21:27:14 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 21:27:14 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=6bf3f811 mirmon: explicitly use --quiet for cronjobs Signed-off-by: Robin H. Johnson gentoo.org> mirmon-distfiles.sh| 1 + mirmon-experimental.sh | 1 + mirmon-releases.sh | 1 + mirmon-rsync.sh| 1 + mirmon-snapshots.sh| 1 + 5 files changed, 5 insertions(+) diff --git a/mirmon-distfiles.sh b/mirmon-distfiles.sh index 0a245e2..e70bf26 100755 --- a/mirmon-distfiles.sh +++ b/mirmon-distfiles.sh @@ -1,5 +1,6 @@ #!/bin/bash exec $(dirname "$0")/mirmon-wrapper.sh \ + --quiet \ --mode=distfiles \ --xml-src=distfiles \ --url=https://www.gentoo.org/downloads/mirrors/ diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh index a48d57f..63b2810 100755 --- a/mirmon-experimental.sh +++ b/mirmon-experimental.sh @@ -1,5 +1,6 @@ #!/bin/bash exec $(dirname "$0")/mirmon-wrapper.sh \ + --quiet \ --mode=experimental \ --xml-src=distfiles \ --url=https://www.gentoo.org/downloads/mirrors/ diff --git a/mirmon-releases.sh b/mirmon-releases.sh index 4839856..5462e04 100755 --- a/mirmon-releases.sh +++ b/mirmon-releases.sh @@ -1,5 +1,6 @@ #!/bin/bash exec $(dirname "$0")/mirmon-wrapper.sh \ + --quiet \ --mode=releases \ --xml-src=distfiles \ --url=https://www.gentoo.org/downloads/mirrors/ diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index d97e149..6698471 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -1,5 +1,6 @@ #!/bin/bash exec $(dirname "$0")/mirmon-wrapper.sh \ + --quiet \ --mode=rsync \ --xml-src=rsync \ --url=https://www.gentoo.org/support/rsync-mirrors/ diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh index bc591bc..e2c0fe5 100755 --- a/mirmon-snapshots.sh +++ b/mirmon-snapshots.sh @@ -1,5 +1,6 @@ #!/bin/bash exec $(dirname "$0")/mirmon-wrapper.sh \ + --quiet \ --mode=snapshots \ --xml-src=distfiles \ --url=https://www.gentoo.org/downloads/mirrors/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 29f83dc5cca5e06718842753c229bff6f417e244 Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 21:10:59 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 21:10:59 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=29f83dc5 probe-mirmon: handle curl error conditions better Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/probe-mirmon b/probe-mirmon index 1e10ef1..5d99cda 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -53,19 +53,16 @@ sub handle_libcurl { my $retcode = $curl->perform; # Looking at the results... - if ($retcode == 0) { - #print("Transfer went ok\n"); -my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); -# judge result and next action based on $response_code - #print("Received response: $response_code $response_body\n"); - chomp $response_body; - #print("s='$response_body'\n"); -print(munge_date($response_body), "\n"); - } else { -# Error code, type of error, error message - #print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n"); - exit 800; - } + exit 800 unless ($retcode == 0); + + my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); + exit 801 unless ($response_code == 200) + exit 802 unless defined($response_body); + chomp $response_body; + print(munge_date($response_body), "\n"); + + exit 0; + #print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n"); }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 8a60a36dfca344e002faad387f58b01b09cafa22 Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 20:29:38 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 20:29:38 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=8a60a36d probe-mirmon: make even less stderr Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/probe-mirmon b/probe-mirmon index 6d67fbf..1e10ef1 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -22,6 +22,7 @@ use warnings; use Date::Parse (); # dev-perl/TimeDate use File::Tempdir; # dev-perl/File-Tempdir use WWW::Curl::Easy; +use Capture::Tiny qw/capture/; sub main { my ( $timeout, $url ) = @_; @@ -84,9 +85,15 @@ sub handle_rsync { $file =~ s/\W/_/g;# translate all non-letters to _ - if ( my $fail = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file", '2>/dev/null' ) { + # https://stackoverflow.com/a/6331618/1583179 + my $ret; + my ($stdout, $stderr) = capture { + $ret = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file"; + }; + if ($ret!=0) { #warn "rsync failed, exit code $fail, $! $? $@\n"; -exit $fail; + #exit $ret; + exit 800; } open my $fh, '<', "$dir/$file" or do {
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: a8b0ba36853eea23c0e07bcc680bdbe877dcd68e Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 06:29:53 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 06:29:53 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a8b0ba36 probe-mirmon: use libcurl instead of exec wget Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/probe-mirmon b/probe-mirmon index 8c57691..6d67fbf 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -21,6 +21,7 @@ use strict; use warnings; use Date::Parse (); # dev-perl/TimeDate use File::Tempdir; # dev-perl/File-Tempdir +use WWW::Curl::Easy; sub main { my ( $timeout, $url ) = @_; @@ -28,10 +29,45 @@ sub main { handle_rsync( $timeout, $url ); } else { -handle_wget( $timeout, $url ); +handle_libcurl( $timeout, $url ); } } +sub handle_libcurl { + my ( $timeout, $url ) = @_; + + my $curl = WWW::Curl::Easy->new; + + $curl->setopt(CURLOPT_HEADER, 0); + $curl->setopt(CURLOPT_CONNECTTIMEOUT, $timeout); + $curl->setopt(CURLOPT_TIMEOUT, $timeout); + $curl->setopt(CURLOPT_FTP_USE_EPSV, 1); + $curl->setopt(CURLOPT_URL, $url); + + # A filehandle, reference to a scalar or reference to a typeglob can be used here. + my $response_body; + $curl->setopt(CURLOPT_WRITEDATA,\$response_body); + + # Starts the actual request + my $retcode = $curl->perform; + + # Looking at the results... + if ($retcode == 0) { + #print("Transfer went ok\n"); +my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); +# judge result and next action based on $response_code + #print("Received response: $response_code $response_body\n"); + chomp $response_body; + #print("s='$response_body'\n"); +print(munge_date($response_body), "\n"); + } else { +# Error code, type of error, error message + #print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n"); + exit 800; + } + +} + sub handle_wget { my ( $timeout, $url ) = @_; # TODO: replace this with native HTTP
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 5324a1b1396fe2f54245109cf1de407399d87aa3 Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 05:56:28 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 06:01:51 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=5324a1b1 probe-mirmon: discard rsync stderr Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/probe-mirmon b/probe-mirmon index 8dce832..8c57691 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -48,7 +48,7 @@ sub handle_rsync { $file =~ s/\W/_/g;# translate all non-letters to _ - if ( my $fail = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file" ) { + if ( my $fail = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file", '2>/dev/null' ) { #warn "rsync failed, exit code $fail, $! $? $@\n"; exit $fail; }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: htdocs/
commit: 8952d15e70c34f0fd554a7830450b026c19b30d8 Author: Max Magorsch gentoo org> AuthorDate: Wed Apr 29 09:42:37 2020 + Commit: Max Magorsch gentoo org> CommitDate: Wed Apr 29 09:42:37 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=8952d15e Clean up the new index page - Only the 'Home' tab should be active - Add missing closing div tags so that the fotoer get's correctly displayed - Use the new cdn urls including the version - Remove unused script Signed-off-by: Max Magorsch gentoo.org> htdocs/index.html | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index d19544e..3d907cb 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -5,8 +5,8 @@ -https://assets.gentoo.org/tyrian/bootstrap.min.css; rel="stylesheet" media="screen"> -https://assets.gentoo.org/tyrian/tyrian.min.css; rel="stylesheet" media="screen"> +https://assets.gentoo.org/tyrian/v1/bootstrap.min.css; rel="stylesheet" media="screen"> +https://assets.gentoo.org/tyrian/v1/tyrian.min.css; rel="stylesheet" media="screen"> https://www.gentoo.org/favicon.ico; type="image/x-icon"> @@ -39,8 +39,8 @@ -https://assets.gentoo.org/tyrian/site-logo.svg; type="image/svg+xml"> - https://assets.gentoo.org/tyrian/site-logo.png; alt="Gentoo Linux Logo"> +https://assets.gentoo.org/tyrian/v1/site-logo.svg; type="image/svg+xml"> + https://assets.gentoo.org/tyrian/v1/site-logo.png; alt="Gentoo Linux Logo"> mirrorstats @@ -64,19 +64,19 @@ Home -rsync +rsync -distfiles +distfiles -snapshots +snapshots -releases +releases -experimental +experimental @@ -131,6 +131,10 @@ Please remember to include mirrorstats in the summary line. + + + + @@ -163,8 +167,7 @@ -https://assets.gentoo.org/tyrian/jquery.min.js"> -https://assets.gentoo.org/tyrian/bootstrap.min.js"> - +https://assets.gentoo.org/tyrian/v1/jquery.min.js"> +https://assets.gentoo.org/tyrian/v1/bootstrap.min.js">
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: conf/snapshots/, conf/distfiles/, conf/experimental/, conf/rsync/, ...
commit: 88c2cac7973038093e5abcc245e75c1b5a78f65f Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 07:39:15 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 07:39:15 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=88c2cac7 conf: always probe gentoo/osuosl layers, and do it faster Signed-off-by: Robin H. Johnson gentoo.org> conf/distfiles/mirmon.conf| 2 ++ conf/experimental/mirmon.conf | 2 ++ conf/releases/mirmon.conf | 2 ++ conf/rsync/mirmon.conf| 2 ++ conf/snapshots/mirmon.conf| 2 ++ 5 files changed, 10 insertions(+) diff --git a/conf/distfiles/mirmon.conf b/conf/distfiles/mirmon.conf index ab0cb66..bf2921c 100644 --- a/conf/distfiles/mirmon.conf +++ b/conf/distfiles/mirmon.conf @@ -7,6 +7,8 @@ state /var/www/mirrorstats.gentoo.org/var/distfiles/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%distfiles/timestamp.mirmon project_url ///www.gentoo.org/ project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png +always_get gentoo osuosl +max_probes 64 # Fresh: 0 - 8h diff --git a/conf/experimental/mirmon.conf b/conf/experimental/mirmon.conf index dbce73d..1ccec2a 100644 --- a/conf/experimental/mirmon.conf +++ b/conf/experimental/mirmon.conf @@ -7,6 +7,8 @@ state /var/www/mirrorstats.gentoo.org/var/experimental/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%experimental/.timestamp-experimental.x project_url ///www.gentoo.org/ project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png +always_get gentoo osuosl +max_probes 64 # Fresh: 0 - 8h diff --git a/conf/releases/mirmon.conf b/conf/releases/mirmon.conf index 66201e6..3b096f2 100644 --- a/conf/releases/mirmon.conf +++ b/conf/releases/mirmon.conf @@ -7,6 +7,8 @@ state /var/www/mirrorstats.gentoo.org/var/releases/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%releases/.timestamp-releases.x project_url ///www.gentoo.org/ project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png +always_get gentoo osuosl +max_probes 64 # Fresh: 0 - 8h diff --git a/conf/rsync/mirmon.conf b/conf/rsync/mirmon.conf index bc5904d..eee35d0 100644 --- a/conf/rsync/mirmon.conf +++ b/conf/rsync/mirmon.conf @@ -7,6 +7,8 @@ state /var/www/mirrorstats.gentoo.org/var/rsync/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%gentoo-portage/metadata/timestamp project_url ///www.gentoo.org/ project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png +always_get gentoo osuosl +max_probes 64 # Fresh: 0 - 1h diff --git a/conf/snapshots/mirmon.conf b/conf/snapshots/mirmon.conf index 41840c0..1092b46 100644 --- a/conf/snapshots/mirmon.conf +++ b/conf/snapshots/mirmon.conf @@ -7,6 +7,8 @@ state /var/www/mirrorstats.gentoo.org/var/snapshots/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%snapshots/.timestamp-snapshots.x project_url ///www.gentoo.org/ project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png +always_get gentoo osuosl +max_probes 64 # Fresh: 0 - 8h # Oldish: 8 - 24h
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: conf/releases/, conf/experimental/, conf/snapshots/, conf/distfiles/
commit: 91d52d783fd65f70f53dbdbf1ac92854626302b8 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 07:38:52 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 07:38:52 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=91d52d78 conf: capture the mirror infrastructure better Signed-off-by: Robin H. Johnson gentoo.org> conf/distfiles/g.mirrors.extra| 4 conf/experimental/g.mirrors.extra | 4 conf/releases/g.mirrors.extra | 4 conf/snapshots/g.mirrors.extra| 4 4 files changed, 16 insertions(+) diff --git a/conf/distfiles/g.mirrors.extra b/conf/distfiles/g.mirrors.extra index 75c3d12..956aff4 100644 --- a/conf/distfiles/g.mirrors.extra +++ b/conf/distfiles/g.mirrors.extra @@ -1 +1,5 @@ gentoo http://distfiles.gentoo.org/ +gentoo rsync://masterdistfiles.gentoo.org/gentoo/ +osuosl rsync://ftp-nyc.osuosl.org/gentoo/ +osuosl rsync://ftp-chi.osuosl.org/gentoo/ +osuosl rsync://ftp-osl.osuosl.org/gentoo/ diff --git a/conf/experimental/g.mirrors.extra b/conf/experimental/g.mirrors.extra index 75c3d12..956aff4 100644 --- a/conf/experimental/g.mirrors.extra +++ b/conf/experimental/g.mirrors.extra @@ -1 +1,5 @@ gentoo http://distfiles.gentoo.org/ +gentoo rsync://masterdistfiles.gentoo.org/gentoo/ +osuosl rsync://ftp-nyc.osuosl.org/gentoo/ +osuosl rsync://ftp-chi.osuosl.org/gentoo/ +osuosl rsync://ftp-osl.osuosl.org/gentoo/ diff --git a/conf/releases/g.mirrors.extra b/conf/releases/g.mirrors.extra index 75c3d12..956aff4 100644 --- a/conf/releases/g.mirrors.extra +++ b/conf/releases/g.mirrors.extra @@ -1 +1,5 @@ gentoo http://distfiles.gentoo.org/ +gentoo rsync://masterdistfiles.gentoo.org/gentoo/ +osuosl rsync://ftp-nyc.osuosl.org/gentoo/ +osuosl rsync://ftp-chi.osuosl.org/gentoo/ +osuosl rsync://ftp-osl.osuosl.org/gentoo/ diff --git a/conf/snapshots/g.mirrors.extra b/conf/snapshots/g.mirrors.extra index 75c3d12..956aff4 100644 --- a/conf/snapshots/g.mirrors.extra +++ b/conf/snapshots/g.mirrors.extra @@ -1 +1,5 @@ gentoo http://distfiles.gentoo.org/ +gentoo rsync://masterdistfiles.gentoo.org/gentoo/ +osuosl rsync://ftp-nyc.osuosl.org/gentoo/ +osuosl rsync://ftp-chi.osuosl.org/gentoo/ +osuosl rsync://ftp-osl.osuosl.org/gentoo/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: conf/rsync/
commit: 8116a77d9261edafaff83dfb3c8a50c224067541 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 07:38:08 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 07:38:08 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=8116a77d rsync: update mirrors Signed-off-by: Robin H. Johnson gentoo.org> conf/rsync/g.mirrors.extra | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/rsync/g.mirrors.extra b/conf/rsync/g.mirrors.extra index 75a1939..b77eb9e 100644 --- a/conf/rsync/g.mirrors.extra +++ b/conf/rsync/g.mirrors.extra @@ -1,6 +1,6 @@ +gentoo rsync://masterportage.gentoo.org/ gentoo rsync://albatross.gentoo.org/ gentoo rsync://boobie.gentoo.org/ gentoo rsync://dipper.gentoo.org/ -gentoo rsync://quetzal.gentoo.org/ gentoo rsync://starling.gentoo.org/ gentoo rsync://swan.gentoo.org/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 0da786280a2a03ee6847c3e859cda90131d95718 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 06:43:31 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 06:43:31 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0da78628 wrapper: fix locker args Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 4fffee0..74a12d6 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -34,7 +34,7 @@ main() { VAR_GMIRRORS=${VARDIR}/g.mirrors EXTRA_MIRRORS=${CONFDIR}/g.mirrors.extra # Lock outselves - [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "${VARDIR}/flock" "$0" "${OPTS[@]}" || : + [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "${VARDIR}/flock" "$0" "--xml-src=${XML_SRC}" "--mode=${MODE}" "--url=${URL}" || : # Grab mirrors from the web mkdir -p "${VARDIR}" "${HTDOCS}" || die "Failed to mkdir"
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 8f37aa42f6bef7baf73a4ecc0bc2caafd4e7e546 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 06:39:18 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 06:39:18 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=8f37aa42 wrapper: ensure locking Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 4c5570b..4fffee0 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -33,6 +33,8 @@ main() { CONFFILE=$(readlink -f "${CONFDIR}"/mirmon.conf) VAR_GMIRRORS=${VARDIR}/g.mirrors EXTRA_MIRRORS=${CONFDIR}/g.mirrors.extra + # Lock outselves + [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "${VARDIR}/flock" "$0" "${OPTS[@]}" || : # Grab mirrors from the web mkdir -p "${VARDIR}" "${HTDOCS}" || die "Failed to mkdir" @@ -148,4 +150,5 @@ done [[ $INVALID -eq 1 ]] && usage [[ $HELP -eq 1 ]] && dohelp +OPTS=( ${opts} ) # for flock main
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: htdocs/
commit: c203352d79198ea09b6dfaad1b0113c88ad0975e Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 06:18:32 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 06:18:32 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=c203352d htdocs: throw in a shiny frontpage The root index.html wasn't even tracked anywhere in VCS before. Signed-off-by: Robin H. Johnson gentoo.org> htdocs/index.html | 170 ++ 1 file changed, 170 insertions(+) diff --git a/htdocs/index.html b/htdocs/index.html new file mode 100644 index 000..d19544e --- /dev/null +++ b/htdocs/index.html @@ -0,0 +1,170 @@ + + + +Gentoo mirrorstats + + + +https://assets.gentoo.org/tyrian/bootstrap.min.css; rel="stylesheet" media="screen"> +https://assets.gentoo.org/tyrian/tyrian.min.css; rel="stylesheet" media="screen"> +https://www.gentoo.org/favicon.ico; type="image/x-icon"> + + + + + + + + +https://get.gentoo.org/; role="button" class="btn get-gentoo"> Get Gentoo! + + + gentoo.org sites + + +https://www.gentoo.org/; title="Main Gentoo website"> gentoo.org +https://wiki.gentoo.org/; title="Find and contribute documentation"> Wiki +https://bugs.gentoo.org/; title="Report issues and find common issues"> Bugs +https://forums.gentoo.org/; title="Discuss with the community"> Forums +https://packages.gentoo.org/; title="Find software for your Gentoo"> Packages + +https://planet.gentoo.org/; title="Find out what's going on in the developer community"> Planet +https://archives.gentoo.org/; title="Read up on past discussions"> Archives +https://sources.gentoo.org/; title="Browse our source code"> Sources + +https://infra-status.gentoo.org/; title="Get updates on the services provided by Gentoo"> Infra Status + + + + + + +https://assets.gentoo.org/tyrian/site-logo.svg; type="image/svg+xml"> + https://assets.gentoo.org/tyrian/site-logo.png; alt="Gentoo Linux Logo"> + + + mirrorstats + + + + + + + + + +Toggle navigation + + + + + + + +Home + + +rsync + + +distfiles + + +snapshots + + +releases + + +experimental + + + + + + + + + + + Gentoo mirrorstats + + + Welcome to the Gentoo Linux mirrorstats system. +This page links to the mirror status for rsync source mirrors. + + + Gentoo rsync mirrors + Gentoo rsync mirrors tracked include both official mirrors run by the Gentoo Infrastructure team, as well as community-run mirrors. + + https://www.gentoo.org/support/rsync-mirrors/;>Listing of Gentoo rsync mirrors + https://wiki.gentoo.org/wiki/Project:Infrastructure/Mirrors/Rsync;>How to contribute a new rsync mirror + Status of Gentoo rsync mirrors + + + Gentoo source mirrors + + https://www.gentoo.org/downloads/mirrors/;>Listing of Gentoo source mirrors + https://wiki.gentoo.org/wiki/Project:Infrastructure/Mirrors/Source;>How to contribute a new source mirror + Status of Gentoo source mirrors: /distfiles/ + Status of Gentoo source mirrors: /experimental/ + Status of Gentoo source mirrors: /releases/ + Status of Gentoo source mirrors: /snapshots/ + + + + If you experience problems with a specific mirror, please file clearly marked bugs in https://bugs.gentoo.org/enter_bug.cgi?product=Mirrors;>Gentoo Bugzilla (product Mirrors). + Please include lots of details about the problem, as the Gentoo + mirror team will have to contact the administrator of individual + mirrors to work on problems. + + Hostname of the mirror (in the summary description) +
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: ee0addc4c7531ff8262f3715b67bf9fc9b73d259 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:48:28 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:48:28 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=ee0addc4 Git ignore not needed anymore Signed-off-by: Robin H. Johnson gentoo.org> .gitignore | 5 - 1 file changed, 5 deletions(-) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 061ee03..000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -rsync_mirrors/var/ -distfiles_mirrors/var/ -experimental_mirrors/var/ -releases_mirrors/var/ -snapshots_mirrors/var/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: distfiles_mirrors/, conf/rsync/, rsync_mirrors/, snapshots_mirrors/, /, ...
commit: 354c8ccd31a81616c408e6558f5f50907abd0abe Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:47:59 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:47:59 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=354c8ccd Update config location Signed-off-by: Robin H. Johnson gentoo.org> {distfiles_mirrors => conf/distfiles}/g.mirrors.extra | 0 {distfiles_mirrors => conf/distfiles}/mirmon.conf | 0 .../experimental}/g.mirrors.extra | 0 {experimental_mirrors => conf/experimental}/mirmon.conf | 0 {releases_mirrors => conf/releases}/g.mirrors.extra | 0 {releases_mirrors => conf/releases}/mirmon.conf | 0 {rsync_mirrors => conf/rsync}/g.mirrors.extra | 0 {rsync_mirrors => conf/rsync}/mirmon.conf | 0 {snapshots_mirrors => conf/snapshots}/g.mirrors.extra | 0 {snapshots_mirrors => conf/snapshots}/mirmon.conf | 0 mirmon-wrapper.sh | 6 +++--- validation/mirror-validate.sh | 15 +++ 12 files changed, 14 insertions(+), 7 deletions(-) diff --git a/distfiles_mirrors/g.mirrors.extra b/conf/distfiles/g.mirrors.extra similarity index 100% rename from distfiles_mirrors/g.mirrors.extra rename to conf/distfiles/g.mirrors.extra diff --git a/distfiles_mirrors/mirmon.conf b/conf/distfiles/mirmon.conf similarity index 100% rename from distfiles_mirrors/mirmon.conf rename to conf/distfiles/mirmon.conf diff --git a/experimental_mirrors/g.mirrors.extra b/conf/experimental/g.mirrors.extra similarity index 100% rename from experimental_mirrors/g.mirrors.extra rename to conf/experimental/g.mirrors.extra diff --git a/experimental_mirrors/mirmon.conf b/conf/experimental/mirmon.conf similarity index 100% rename from experimental_mirrors/mirmon.conf rename to conf/experimental/mirmon.conf diff --git a/releases_mirrors/g.mirrors.extra b/conf/releases/g.mirrors.extra similarity index 100% rename from releases_mirrors/g.mirrors.extra rename to conf/releases/g.mirrors.extra diff --git a/releases_mirrors/mirmon.conf b/conf/releases/mirmon.conf similarity index 100% rename from releases_mirrors/mirmon.conf rename to conf/releases/mirmon.conf diff --git a/rsync_mirrors/g.mirrors.extra b/conf/rsync/g.mirrors.extra similarity index 100% rename from rsync_mirrors/g.mirrors.extra rename to conf/rsync/g.mirrors.extra diff --git a/rsync_mirrors/mirmon.conf b/conf/rsync/mirmon.conf similarity index 100% rename from rsync_mirrors/mirmon.conf rename to conf/rsync/mirmon.conf diff --git a/snapshots_mirrors/g.mirrors.extra b/conf/snapshots/g.mirrors.extra similarity index 100% rename from snapshots_mirrors/g.mirrors.extra rename to conf/snapshots/g.mirrors.extra diff --git a/snapshots_mirrors/mirmon.conf b/conf/snapshots/mirmon.conf similarity index 100% rename from snapshots_mirrors/mirmon.conf rename to conf/snapshots/mirmon.conf diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 2c50369..4c5570b 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -26,13 +26,13 @@ die() { main() { SITEDIR=/var/www/mirrorstats.gentoo.org REPODIR=${SITEDIR}/gentoo-mirrorstats/ - MODEDIR=${REPODIR}/${MODE}_mirrors/ + CONFDIR=${REPODIR}/conf/${MODE}/ VARDIR=${SITEDIR}/var/${MODE} HTDOCS=${SITEDIR}/htdocs/${MODE} MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) - CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) + CONFFILE=$(readlink -f "${CONFDIR}"/mirmon.conf) VAR_GMIRRORS=${VARDIR}/g.mirrors - EXTRA_MIRRORS=${MODEDIR}/g.mirrors.extra + EXTRA_MIRRORS=${CONFDIR}/g.mirrors.extra # Grab mirrors from the web mkdir -p "${VARDIR}" "${HTDOCS}" || die "Failed to mkdir" diff --git a/validation/mirror-validate.sh b/validation/mirror-validate.sh index e5348ec..8d50ad7 100755 --- a/validation/mirror-validate.sh +++ b/validation/mirror-validate.sh @@ -9,12 +9,19 @@ . /etc/init.d/functions.sh -if [[ $1 != "distfiles" ]] && [[ $1 != "rsync" ]]; then -echo "Need to specify distfiles or rsync" +case $1 in + distfiles) ;; + rsync) ;; + releases) ;; + snapshots) ;; + experimental) ;; + *) +echo "Need to specify valid mode" 1>&2 exit 1 -fi + ;; +esac -STATE_FILE="/var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/$1_mirrors/var/mirmon.state" +STATE_FILE="/var/www/mirrorstats.gentoo.org/var/$1/mirmon.state" count_bad_status() { BAD_STATUS_COUNT=0
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: a0841c139bd7830a56ad9e0dfb215148711a68c7 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:41:28 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:41:28 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a0841c13 probe-mirmon: be quiet if rsync site is broken Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/probe-mirmon b/probe-mirmon index ddd8546..8dce832 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -48,8 +48,8 @@ sub handle_rsync { $file =~ s/\W/_/g;# translate all non-letters to _ - if ( my $fail = system '/usr/bin/rsync', qw( --no-motd --timeout ), $timeout, $url, "$dir/$file" ) { -warn "rsync failed, exit code $fail, $! $? $@\n"; + if ( my $fail = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file" ) { + #warn "rsync failed, exit code $fail, $! $? $@\n"; exit $fail; }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: rsync_mirrors/
commit: c6b34c96b6e4665930989ae8b5a61af2c8504b6d Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:37:13 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:37:13 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=c6b34c96 rsync: fix URL Signed-off-by: Robin H. Johnson gentoo.org> rsync_mirrors/g.mirrors.extra | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rsync_mirrors/g.mirrors.extra b/rsync_mirrors/g.mirrors.extra index 340865c..75a1939 100644 --- a/rsync_mirrors/g.mirrors.extra +++ b/rsync_mirrors/g.mirrors.extra @@ -1,6 +1,6 @@ -gentoo rsync://albatross.gentoo.org -gentoo rsync://boobie.gentoo.org -gentoo rsync://dipper.gentoo.org -gentoo rsync://quetzal.gentoo.org -gentoo rsync://starling.gentoo.org -gentoo rsync://swan.gentoo.org +gentoo rsync://albatross.gentoo.org/ +gentoo rsync://boobie.gentoo.org/ +gentoo rsync://dipper.gentoo.org/ +gentoo rsync://quetzal.gentoo.org/ +gentoo rsync://starling.gentoo.org/ +gentoo rsync://swan.gentoo.org/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: adddc138088d7f2157cfcdd72402b9395be4ccb0 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:33:48 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:33:48 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=adddc138 wrapper: input validations Signed-off-by: Robin H. Johnson gentoo.org> mirmon-wrapper.sh | 74 +-- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index ba731c6..2c50369 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -24,9 +24,6 @@ die() { } main() { - [[ -z "$MODE" ]] && die "--mode unset" - [[ -z "$XML_SRC" ]] && die "--xml-src unset" - [[ -z "$URL" ]] && die "--url unset" SITEDIR=/var/www/mirrorstats.gentoo.org REPODIR=${SITEDIR}/gentoo-mirrorstats/ MODEDIR=${REPODIR}/${MODE}_mirrors/ @@ -35,35 +32,40 @@ main() { MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) VAR_GMIRRORS=${VARDIR}/g.mirrors - - # Grab mirrors from the web - mkdir -p "${VARDIR}" - "${REPODIR}"/get-mirrors-from-${XML_SRC}-xml.rb > "${VAR_GMIRRORS}".tmp - EXTRA_MIRRORS=${MODEDIR}/g.mirrors.extra + + # Grab mirrors from the web + mkdir -p "${VARDIR}" "${HTDOCS}" || die "Failed to mkdir" + "${REPODIR}/get-mirrors-from-${XML_SRC}-xml.rb" > "${VAR_GMIRRORS}".tmp || die "Unable to fetch mirror list" + [[ -e "${EXTRA_MIRRORS}" ]] && cat "${EXTRA_MIRRORS}" >>"${VAR_GMIRRORS}".tmp - + # Atomic rotate into place - mv -f "${VAR_GMIRRORS}"{.tmp,} - + mv -f "${VAR_GMIRRORS}"{.tmp,} || die "Failed to set mirror list" + # fatal if the state file is NOT present. - [[ -e ${VARDIR}/mirmon.state ]] || touch "${VARDIR}/mirmon.state" - + if [[ ! -e ${VARDIR}/mirmon.state ]]; then + touch "${VARDIR}/mirmon.state" || die "Could not create state file" + else + test -w "${VARDIR}/mirmon.state" || die "Cannot write state file!" + fi + # run mirmon - /usr/bin/perl "${MIRMON}" -c "${CONFFILE}" -q -get update - + /usr/bin/perl "${MIRMON}" -c "${CONFFILE}" -q -get update || die "mirmon failed: $?" + # Set up a nice link to our mirror page directly: - mkdir -p ${HTDOCS} sed \ - -e "s#mirrors#mirrors#" \ + -e "s#mirrors#mirrors#" \ >"${HTDOCS}"/index.html.tmp <"${HTDOCS}"/index-wip.html \ - && mv -f "${HTDOCS}"/index.html{.tmp,} - + || die "Failed to fix URLs(sed)" + mv -f "${HTDOCS}"/index.html{.tmp,} || die "Failed to fix URLs(mv)" + # Generate a json file containing the state of each mirror "${REPODIR}"/generate-json.py \ "${VARDIR}"/mirmon.state \ >"${HTDOCS}"/state.json.tmp \ - && mv -f "${HTDOCS}"/state.json{.tmp,} + || die "Failed to generate JSON (py)" + mv -f "${HTDOCS}"/state.json{.tmp,} || die "Failed to generate JSON (mv)" # Done exit 0 @@ -115,11 +117,35 @@ while [[ $# -gt 0 ]]; do esac done +# Validations +MODE_INPUTS=( + distfiles + rsync + snapshots + experimental + releases +) +MODE_VALID=0 +for m in "${MODE_INPUTS[@]}"; do + [[ "$m" == "$MODE" ]] && MODE_VALID=1 +done +[[ $MODE_VALID -eq 1 ]] || MODE='' + +XML_SRC_INPUTS=( + distfiles + rsync +) +XML_SRC_VALID=0 +for m in "${XML_SRC_INPUTS[@]}"; do + [[ "$m" == "$XML_SRC" ]] && XML_SRC_VALID=1 +done +[[ $XML_SRC_VALID -eq 1 ]] || XML_SRC='' + +[[ -z "$MODE" ]] && die "--mode must be one of: ${MODE_INPUTS[*]}" +[[ -z "$XML_SRC" ]] && die "--xml-src must be one of: ${XML_SRC_INPUTS[*]}" +[[ -z "$URL" ]] && die "--url unset" + [[ $INVALID -eq 1 ]] && usage [[ $HELP -eq 1 ]] && dohelp main - -#MODE=snapshots -#XML_SRC=distfiles -#URL=https://www.gentoo.org/downloads/mirrors/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: b0b29736aeb8eaddcf111c0a0c1da693fbbb60e0 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 04:52:08 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 04:52:08 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=b0b29736 snapshots: fix URL Signed-off-by: Robin H. Johnson gentoo.org> mirmon-snapshots.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh index 0f10688..5a5c127 100755 --- a/mirmon-snapshots.sh +++ b/mirmon-snapshots.sh @@ -12,6 +12,7 @@ HTDOCS=${SITEDIR}/htdocs/${MODE} MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) VAR_GMIRRORS=${VARDIR}/g.mirrors +URL=https://www.gentoo.org/downloads/mirrors/ # Grab mirrors from the web mkdir -p "${VARDIR}" @@ -32,7 +33,7 @@ mv -f "${VAR_GMIRRORS}"{.tmp,} # Set up a nice link to our mirror page directly: mkdir -p ${HTDOCS} sed \ --e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ +-e "s#mirrors#mirrors#" \ >"${HTDOCS}"/index.html.tmp <"${HTDOCS}"/index-wip.html \ && mv -f "${HTDOCS}"/index.html{.tmp,}
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: distfiles_mirrors/, rsync_mirrors/, experimental_mirrors/, /, snapshots_mirrors/, ...
commit: 6925ffcc3d6adef82c582c9d895878bf219a2260 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:20:09 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:20:09 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=6925ffcc switch to new refactored scripts Signed-off-by: Robin H. Johnson gentoo.org> distfiles_mirrors/mirmon.conf| 8 experimental_mirrors/mirmon.conf | 8 mirmon-distfiles.sh | 21 - mirmon-experimental.sh | 21 - mirmon-releases.sh | 21 - mirmon-rsync.sh | 34 -- releases_mirrors/mirmon.conf | 8 rsync_mirrors/g.mirrors.extra| 6 ++ rsync_mirrors/mirmon.conf| 8 snapshots_mirrors/mirmon.conf| 3 +-- 10 files changed, 39 insertions(+), 99 deletions(-) diff --git a/distfiles_mirrors/mirmon.conf b/distfiles_mirrors/mirmon.conf index fa2ab1b..ab0cb66 100644 --- a/distfiles_mirrors/mirmon.conf +++ b/distfiles_mirrors/mirmon.conf @@ -2,11 +2,11 @@ project_name Gentoo Linux (distfiles) web_page /var/www/mirrorstats.gentoo.org/htdocs/distfiles/index-wip.html icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list -mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/g.mirrors -state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state +mirror_list /var/www/mirrorstats.gentoo.org/var/distfiles/g.mirrors +state /var/www/mirrorstats.gentoo.org/var/distfiles/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%distfiles/timestamp.mirmon -project_url http://www.gentoo.org/ -project_logo http://www.gentoo.org/images/gentoo-new.gif +project_url ///www.gentoo.org/ +project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png # Fresh: 0 - 8h diff --git a/experimental_mirrors/mirmon.conf b/experimental_mirrors/mirmon.conf index b27bea0..dbce73d 100644 --- a/experimental_mirrors/mirmon.conf +++ b/experimental_mirrors/mirmon.conf @@ -2,11 +2,11 @@ project_name Gentoo Linux (experimental) web_page /var/www/mirrorstats.gentoo.org/htdocs/experimental/index-wip.html icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list -mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/g.mirrors -state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state +mirror_list /var/www/mirrorstats.gentoo.org/var/experimental/g.mirrors +state /var/www/mirrorstats.gentoo.org/var/experimental/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%experimental/.timestamp-experimental.x -project_url http://www.gentoo.org/ -project_logo http://www.gentoo.org/images/gentoo-new.gif +project_url ///www.gentoo.org/ +project_logo ///www.gentoo.org/assets/img/logo/gentoo-3d-small.png # Fresh: 0 - 8h diff --git a/mirmon-distfiles.sh b/mirmon-distfiles.sh index 5738c99..0a245e2 100755 --- a/mirmon-distfiles.sh +++ b/mirmon-distfiles.sh @@ -1,18 +1,5 @@ #!/bin/bash - -cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors -# Grab mirrors from the web -[[ -d ./var ]] || mkdir ./var -../get-mirrors-from-distfiles-xml.rb > ./var/g.mirrors -# fatal if the state file is NOT present. -[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state -# run mirmon -/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update -# Set up a nice link to our mirror page directly: -[[ -d ../../htdocs/distfiles ]] || mkdir ../../htdocs/distfiles -sed \ --e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ ->../../htdocs/distfiles/index.html <../../htdocs/distfiles/index-wip.html -# Generate a json file containing the state of each mirror -..//generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state \ - > ../../htdocs/distfiles/state.json +exec $(dirname "$0")/mirmon-wrapper.sh \ + --mode=distfiles \ + --xml-src=distfiles \ + --url=https://www.gentoo.org/downloads/mirrors/ diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh index 5b671bf..a48d57f 100755 --- a/mirmon-experimental.sh +++ b/mirmon-experimental.sh @@ -1,18 +1,5 @@ #!/bin/bash - -cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors -# Grab mirrors from the web -[[ -d ./var ]] || mkdir ./var -../get-mirrors-from-distfiles-xml.rb > ./var/g.mirrors -# fatal if the state file is NOT present. -[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state -# run mirmon -/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update -# Set up a nice link to our mirror page directly: -[[ -d ../../htdocs/experimental ]] || mkdir ../../htdocs/experimental -sed \ --e
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 2e17262f3b54e829f7aa875bdaa543703d8c6e55 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:09:59 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:09:59 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=2e17262f snapshots: call new wrapper Signed-off-by: Robin H. Johnson gentoo.org> mirmon-snapshots.sh | 5 + 1 file changed, 5 insertions(+) diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh new file mode 100755 index 000..bc591bc --- /dev/null +++ b/mirmon-snapshots.sh @@ -0,0 +1,5 @@ +#!/bin/bash +exec $(dirname "$0")/mirmon-wrapper.sh \ + --mode=snapshots \ + --xml-src=distfiles \ + --url=https://www.gentoo.org/downloads/mirrors/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 3481f1fa6e8dba159ded86d4f09ea860e307049a Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 05:09:34 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 05:09:34 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=3481f1fa Convert refactored runner to wrapper Signed-off-by: Robin H. Johnson gentoo.org> mirmon-snapshots.sh | 44 -- mirmon-wrapper.sh | 125 2 files changed, 125 insertions(+), 44 deletions(-) diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh deleted file mode 100755 index 5a5c127..000 --- a/mirmon-snapshots.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -set -e - -MODE=snapshots -SRC=distfiles -SITEDIR=/var/www/mirrorstats.gentoo.org -REPODIR=${SITEDIR}/gentoo-mirrorstats/ -MODEDIR=${REPODIR}/${MODE}_mirrors/ -VARDIR=${SITEDIR}/var/${MODE} -HTDOCS=${SITEDIR}/htdocs/${MODE} -MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) -CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) -VAR_GMIRRORS=${VARDIR}/g.mirrors -URL=https://www.gentoo.org/downloads/mirrors/ - -# Grab mirrors from the web -mkdir -p "${VARDIR}" -"${REPODIR}"/get-mirrors-from-${SRC}-xml.rb > "${VAR_GMIRRORS}".tmp - -EXTRA_MIRRORS=${MODEDIR}/g.mirrors.extra -[[ -e "${EXTRA_MIRRORS}" ]] && cat "${EXTRA_MIRRORS}" >>"${VAR_GMIRRORS}".tmp - -# Atomic rotate into place -mv -f "${VAR_GMIRRORS}"{.tmp,} - -# fatal if the state file is NOT present. -[[ -e ${VARDIR}/mirmon.state ]] || touch "${VARDIR}/mirmon.state" - -# run mirmon -/usr/bin/perl "${MIRMON}" -c "${CONFFILE}" -q -get update - -# Set up a nice link to our mirror page directly: -mkdir -p ${HTDOCS} -sed \ --e "s#mirrors#mirrors#" \ ->"${HTDOCS}"/index.html.tmp <"${HTDOCS}"/index-wip.html \ - && mv -f "${HTDOCS}"/index.html{.tmp,} - -# Generate a json file containing the state of each mirror -"${REPODIR}"/generate-json.py \ - "${VARDIR}"/mirmon.state \ - >"${HTDOCS}"/state.json.tmp \ - && mv -f "${HTDOCS}"/state.json{.tmp,} diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh new file mode 100755 index 000..ba731c6 --- /dev/null +++ b/mirmon-wrapper.sh @@ -0,0 +1,125 @@ +#!/bin/bash -e + +NAME=$(basename "$0") + +OPTIONS=( + "mode" + "xml-src" + "url" +) + +usage() { + echo "Usage: ${NAME}$(printf " --%s=..." "${OPTIONS[@]}" )" 1>&2 + exit 3 +} + +dohelp() { + echo "${NAME} TODO" 1>&2 + exit 0 +} + +die() { + echo "$*" 1>&2 + exit 2 +} + +main() { + [[ -z "$MODE" ]] && die "--mode unset" + [[ -z "$XML_SRC" ]] && die "--xml-src unset" + [[ -z "$URL" ]] && die "--url unset" + SITEDIR=/var/www/mirrorstats.gentoo.org + REPODIR=${SITEDIR}/gentoo-mirrorstats/ + MODEDIR=${REPODIR}/${MODE}_mirrors/ + VARDIR=${SITEDIR}/var/${MODE} + HTDOCS=${SITEDIR}/htdocs/${MODE} + MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) + CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) + VAR_GMIRRORS=${VARDIR}/g.mirrors + + # Grab mirrors from the web + mkdir -p "${VARDIR}" + "${REPODIR}"/get-mirrors-from-${XML_SRC}-xml.rb > "${VAR_GMIRRORS}".tmp + + EXTRA_MIRRORS=${MODEDIR}/g.mirrors.extra + [[ -e "${EXTRA_MIRRORS}" ]] && cat "${EXTRA_MIRRORS}" >>"${VAR_GMIRRORS}".tmp + + # Atomic rotate into place + mv -f "${VAR_GMIRRORS}"{.tmp,} + + # fatal if the state file is NOT present. + [[ -e ${VARDIR}/mirmon.state ]] || touch "${VARDIR}/mirmon.state" + + # run mirmon + /usr/bin/perl "${MIRMON}" -c "${CONFFILE}" -q -get update + + # Set up a nice link to our mirror page directly: + mkdir -p ${HTDOCS} + sed \ + -e "s#mirrors#mirrors#" \ + >"${HTDOCS}"/index.html.tmp <"${HTDOCS}"/index-wip.html \ + && mv -f "${HTDOCS}"/index.html{.tmp,} + + # Generate a json file containing the state of each mirror + "${REPODIR}"/generate-json.py \ + "${VARDIR}"/mirmon.state \ + >"${HTDOCS}"/state.json.tmp \ + && mv -f "${HTDOCS}"/state.json{.tmp,} + + # Done + exit 0 +} + +opts=$(getopt \ + --longoptions "$(printf "%s:," "${OPTIONS[@]}" )" \ + --name "$(basename "$0")" \ + --options "" \ + -- "$@" +) + +eval set --$opts + +MODE='' +XML_SRC='' +URL='' +HELP=0 +INVALID=0 + +while [[ $# -gt 0 ]]; do +case "$1" in +--mode) +MODE=$2 +shift 2 +;; + +--xml-src) +XML_SRC=$2 +shift 2 +;; + +--url) +URL=$2 +shift 2 +;; + --help) + HELP=1 + break + ;; + --) + # End of options + break +
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: experimental_mirrors/, snapshots_mirrors/, releases_mirrors/, /, ...
commit: 448bf5d0dededcbcc24c82318eb9e5f05ba10eb8 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 04:46:23 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 04:46:23 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=448bf5d0 snapshots: prepare for common mirmon runner code via specific mirrors Signed-off-by: Robin H. Johnson gentoo.org> distfiles_mirrors/g.mirrors.extra| 1 + experimental_mirrors/g.mirrors.extra | 1 + mirmon-snapshots.sh | 9 - releases_mirrors/g.mirrors.extra | 1 + snapshots_mirrors/g.mirrors.extra| 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/distfiles_mirrors/g.mirrors.extra b/distfiles_mirrors/g.mirrors.extra new file mode 100644 index 000..75c3d12 --- /dev/null +++ b/distfiles_mirrors/g.mirrors.extra @@ -0,0 +1 @@ +gentoo http://distfiles.gentoo.org/ diff --git a/experimental_mirrors/g.mirrors.extra b/experimental_mirrors/g.mirrors.extra new file mode 100644 index 000..75c3d12 --- /dev/null +++ b/experimental_mirrors/g.mirrors.extra @@ -0,0 +1 @@ +gentoo http://distfiles.gentoo.org/ diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh index b1198de..0f10688 100755 --- a/mirmon-snapshots.sh +++ b/mirmon-snapshots.sh @@ -11,10 +11,17 @@ VARDIR=${SITEDIR}/var/${MODE} HTDOCS=${SITEDIR}/htdocs/${MODE} MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) +VAR_GMIRRORS=${VARDIR}/g.mirrors # Grab mirrors from the web mkdir -p "${VARDIR}" -"${REPODIR}"/get-mirrors-from-${SRC}-xml.rb > "${VARDIR}"/g.mirrors.tmp && mv -f "${VARDIR}"/g.mirrors{.tmp,} +"${REPODIR}"/get-mirrors-from-${SRC}-xml.rb > "${VAR_GMIRRORS}".tmp + +EXTRA_MIRRORS=${MODEDIR}/g.mirrors.extra +[[ -e "${EXTRA_MIRRORS}" ]] && cat "${EXTRA_MIRRORS}" >>"${VAR_GMIRRORS}".tmp + +# Atomic rotate into place +mv -f "${VAR_GMIRRORS}"{.tmp,} # fatal if the state file is NOT present. [[ -e ${VARDIR}/mirmon.state ]] || touch "${VARDIR}/mirmon.state" diff --git a/releases_mirrors/g.mirrors.extra b/releases_mirrors/g.mirrors.extra new file mode 100644 index 000..75c3d12 --- /dev/null +++ b/releases_mirrors/g.mirrors.extra @@ -0,0 +1 @@ +gentoo http://distfiles.gentoo.org/ diff --git a/snapshots_mirrors/g.mirrors.extra b/snapshots_mirrors/g.mirrors.extra new file mode 100644 index 000..75c3d12 --- /dev/null +++ b/snapshots_mirrors/g.mirrors.extra @@ -0,0 +1 @@ +gentoo http://distfiles.gentoo.org/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/, /
commit: 26ccdfc4d14f78e850630c9ff81c8a9ee229f274 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 04:26:01 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 04:26:01 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=26ccdfc4 Update json path Signed-off-by: Robin H. Johnson gentoo.org> json/generate-json.py => generate-json.py | 0 mirmon-distfiles.sh | 2 +- mirmon-experimental.sh| 2 +- mirmon-releases.sh| 2 +- mirmon-rsync.sh | 2 +- mirmon-snapshots.sh | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/json/generate-json.py b/generate-json.py similarity index 100% rename from json/generate-json.py rename to generate-json.py diff --git a/mirmon-distfiles.sh b/mirmon-distfiles.sh index fedefdc..5738c99 100755 --- a/mirmon-distfiles.sh +++ b/mirmon-distfiles.sh @@ -14,5 +14,5 @@ sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ >../../htdocs/distfiles/index.html <../../htdocs/distfiles/index-wip.html # Generate a json file containing the state of each mirror -../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state \ +..//generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state \ > ../../htdocs/distfiles/state.json diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh index fae7df6..5b671bf 100755 --- a/mirmon-experimental.sh +++ b/mirmon-experimental.sh @@ -14,5 +14,5 @@ sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ >../../htdocs/experimental/index.html <../../htdocs/experimental/index-wip.html # Generate a json file containing the state of each mirror -../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state \ +..//generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state \ > ../../htdocs/experimental/state.json diff --git a/mirmon-releases.sh b/mirmon-releases.sh index 6790756..bbd5640 100755 --- a/mirmon-releases.sh +++ b/mirmon-releases.sh @@ -14,5 +14,5 @@ sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ >../../htdocs/releases/index.html <../../htdocs/releases/index-wip.html # Generate a json file containing the state of each mirror -../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors/var/mirmon.state \ +..//generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors/var/mirmon.state \ > ../../htdocs/releases/state.json diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index 1e432e2..0f37f78 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -27,5 +27,5 @@ sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors-rsync.xml;>mirrors#' \ >../../htdocs/rsync/index.html <../../htdocs/rsync/index-wip.html # Generate a json file containing the state of each mirror -../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/mirmon.state \ +..//generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/mirmon.state \ > ../../htdocs/rsync/state.json diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh index ee0338b..b1198de 100755 --- a/mirmon-snapshots.sh +++ b/mirmon-snapshots.sh @@ -30,7 +30,7 @@ sed \ && mv -f "${HTDOCS}"/index.html{.tmp,} # Generate a json file containing the state of each mirror -../json/generate-json.py \ +"${REPODIR}"/generate-json.py \ "${VARDIR}"/mirmon.state \ >"${HTDOCS}"/state.json.tmp \ && mv -f "${HTDOCS}"/state.json{.tmp,}
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: snapshots_mirrors/, /
commit: 14510bcfe2f4639f971d6c478124648eb1e26a6b Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 29 04:05:33 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 29 04:05:33 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=14510bcf snapshots: fix var dir switch Signed-off-by: Robin H. Johnson gentoo.org> mirmon-snapshots.sh | 2 +- snapshots_mirrors/mirmon.conf | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh index 894e94b..ee0338b 100755 --- a/mirmon-snapshots.sh +++ b/mirmon-snapshots.sh @@ -6,7 +6,7 @@ MODE=snapshots SRC=distfiles SITEDIR=/var/www/mirrorstats.gentoo.org REPODIR=${SITEDIR}/gentoo-mirrorstats/ -MODEDIR=${SITEDIR}/${MODE}_mirrors/ +MODEDIR=${REPODIR}/${MODE}_mirrors/ VARDIR=${SITEDIR}/var/${MODE} HTDOCS=${SITEDIR}/htdocs/${MODE} MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) diff --git a/snapshots_mirrors/mirmon.conf b/snapshots_mirrors/mirmon.conf index 6d689bb..846b994 100644 --- a/snapshots_mirrors/mirmon.conf +++ b/snapshots_mirrors/mirmon.conf @@ -2,11 +2,11 @@ project_name Gentoo Linux (snapshots) web_page /var/www/mirrorstats.gentoo.org/htdocs/snapshots/index-wip.html icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list -mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors/var/g.mirrors -state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors/var/mirmon.state +mirror_list /var/www/mirrorstats.gentoo.org/var/snapshots/g.mirrors +state /var/www/mirrorstats.gentoo.org/var/snapshots/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%snapshots/.timestamp-snapshots.x -project_url http://www.gentoo.org/ -project_logo http://www.gentoo.org/images/gentoo-new.gif +project_url ///www.gentoo.org/ +project_logo ///www.gentoo.org/images/gentoo-new.gif # Fresh: 0 - 8h
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 017ef815975b6ffef58fbe8f27ce7e48e5053e9d Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 17:45:00 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 17:45:00 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=017ef815 gitignore: missed var for snapshot Signed-off-by: Robin H. Johnson gentoo.org> .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2e314d5..061ee03 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ rsync_mirrors/var/ distfiles_mirrors/var/ experimental_mirrors/var/ releases_mirrors/var/ +snapshots_mirrors/var/
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 97ea3377d7030d39b2f7340ebf060eb072ec2343 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 23:21:21 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 23:21:21 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=97ea3377 mirmon-snapshots.sh: test refactor of runner Signed-off-by: Robin H. Johnson gentoo.org> mirmon-snapshots.sh | 36 +++- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh old mode 100644 new mode 100755 index 692a1ef..894e94b --- a/mirmon-snapshots.sh +++ b/mirmon-snapshots.sh @@ -1,18 +1,36 @@ #!/bin/bash -cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors +set -e + +MODE=snapshots +SRC=distfiles +SITEDIR=/var/www/mirrorstats.gentoo.org +REPODIR=${SITEDIR}/gentoo-mirrorstats/ +MODEDIR=${SITEDIR}/${MODE}_mirrors/ +VARDIR=${SITEDIR}/var/${MODE} +HTDOCS=${SITEDIR}/htdocs/${MODE} +MIRMON=$(readlink -f "${SITEDIR}"/mirmon/mirmon) +CONFFILE=$(readlink -f "${MODEDIR}"/mirmon.conf) + # Grab mirrors from the web -[[ -d ./var ]] || mkdir ./var -../get-mirrors-from-distfiles-xml.rb > ./var/g.mirrors +mkdir -p "${VARDIR}" +"${REPODIR}"/get-mirrors-from-${SRC}-xml.rb > "${VARDIR}"/g.mirrors.tmp && mv -f "${VARDIR}"/g.mirrors{.tmp,} + # fatal if the state file is NOT present. -[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state +[[ -e ${VARDIR}/mirmon.state ]] || touch "${VARDIR}/mirmon.state" + # run mirmon -/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update +/usr/bin/perl "${MIRMON}" -c "${CONFFILE}" -q -get update + # Set up a nice link to our mirror page directly: -[[ -d ../../htdocs/snapshots ]] || mkdir ../../htdocs/snapshots +mkdir -p ${HTDOCS} sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ ->../../htdocs/snapshots/index.html <../../htdocs/snapshots/index-wip.html +>"${HTDOCS}"/index.html.tmp <"${HTDOCS}"/index-wip.html \ + && mv -f "${HTDOCS}"/index.html{.tmp,} + # Generate a json file containing the state of each mirror -../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors/var/mirmon.state \ - > ../../htdocs/snapshots/state.json +../json/generate-json.py \ + "${VARDIR}"/mirmon.state \ + >"${HTDOCS}"/state.json.tmp \ + && mv -f "${HTDOCS}"/state.json{.tmp,}
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 23444534405ec900f3eac60bb6e4e768ac59de61 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 17:42:06 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 17:42:06 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=23444534 rsync: trailing / on mirrors Signed-off-by: Robin H. Johnson gentoo.org> mirmon-rsync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index 2391a0f..1e432e2 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -15,7 +15,7 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors ../get-mirrors-from-rsync-xml.rb > ./var/g.mirrors # infra mirrors, "manually added" to list to check for i in ${INFRA}; do - echo "gentoo rsync://$i.gentoo.org" >> ./var/g.mirrors + echo "gentoo rsync://$i.gentoo.org/" >> ./var/g.mirrors done # fatal if the state file is NOT present. [[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: c28531f526f8cd385b96fe8da40615bda9360ff0 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 17:34:13 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 17:34:13 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=c28531f5 mirmor: drop GCP mirror that was tested Signed-off-by: Robin H. Johnson gentoo.org> mirmon-rsync.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index 93f76b2..2391a0f 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -17,8 +17,6 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors for i in ${INFRA}; do echo "gentoo rsync://$i.gentoo.org" >> ./var/g.mirrors done -# Test GCP mirror; added by antarus -echo "gentoo rsync://35.190.132.250" >> ./var/g.mirrors # fatal if the state file is NOT present. [[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state # run mirmon
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: snapshots_mirrors/, /
commit: c830c7267db4b8ed88e440a39e75768a20fd9fa0 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 17:29:31 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 17:29:31 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=c830c726 snapshots: also test this Signed-off-by: Robin H. Johnson gentoo.org> mirmon-snapshots.sh | 18 ++ snapshots_mirrors/mirmon.conf | 23 +++ 2 files changed, 41 insertions(+) diff --git a/mirmon-snapshots.sh b/mirmon-snapshots.sh new file mode 100644 index 000..692a1ef --- /dev/null +++ b/mirmon-snapshots.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors +# Grab mirrors from the web +[[ -d ./var ]] || mkdir ./var +../get-mirrors-from-distfiles-xml.rb > ./var/g.mirrors +# fatal if the state file is NOT present. +[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state +# run mirmon +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update +# Set up a nice link to our mirror page directly: +[[ -d ../../htdocs/snapshots ]] || mkdir ../../htdocs/snapshots +sed \ +-e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ +>../../htdocs/snapshots/index.html <../../htdocs/snapshots/index-wip.html +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors/var/mirmon.state \ + > ../../htdocs/snapshots/state.json diff --git a/snapshots_mirrors/mirmon.conf b/snapshots_mirrors/mirmon.conf new file mode 100644 index 000..6d689bb --- /dev/null +++ b/snapshots_mirrors/mirmon.conf @@ -0,0 +1,23 @@ +project_name Gentoo Linux (snapshots) +web_page /var/www/mirrorstats.gentoo.org/htdocs/snapshots/index-wip.html +icons ../icons +countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list +mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors/var/g.mirrors +state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/snapshots_mirrors/var/mirmon.state +probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%snapshots/.timestamp-snapshots.x +project_url http://www.gentoo.org/ +project_logo http://www.gentoo.org/images/gentoo-new.gif + + +# Fresh: 0 - 8h +# Oldish: 8 - 24h +# Old: 24h - inf +# Bad: No reachable, no state saved + +max_poll 4h +min_sync 4h +max_sync 20h + +put_histo top +timeout 30 +
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: distfiles_mirrors/, /, experimental_mirrors/, releases_mirrors/, rsync_mirrors/
commit: cc533641381eda01900675f3b265d939b44ba2ea Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 17:27:30 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 17:27:30 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=cc533641 refactor mirror list generation Signed-off-by: Robin H. Johnson gentoo.org> distfiles_mirrors/get-mirror-list-distfiles.rb | 18 .../get-mirror-list-experimental.rb| 18 get-mirrors-from-distfiles-xml.rb | 24 ++ get-mirrors-from-rsync-xml.rb | 24 ++ mirmon-distfiles.sh| 2 +- mirmon-experimental.sh | 2 +- mirmon-releases.sh | 2 +- mirmon-rsync.sh| 2 +- releases_mirrors/get-mirror-list-releases.rb | 18 rsync_mirrors/get-mirror-list-rsync.rb | 18 10 files changed, 52 insertions(+), 76 deletions(-) diff --git a/distfiles_mirrors/get-mirror-list-distfiles.rb b/distfiles_mirrors/get-mirror-list-distfiles.rb deleted file mode 100755 index 0794df3..000 --- a/distfiles_mirrors/get-mirror-list-distfiles.rb +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/ruby - -MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml; - -%w[ rexml/document open-uri ].each {|lib| require lib } - -m = URI.parse(MIRROR_DATA).read -x = REXML::Document.new(m) - -REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| - country = el.attributes['country'] - - el.each_element('mirror/uri/') do |mirror| -puts "#{country.downcase} #{mirror[0].to_s}" - end - -} - diff --git a/experimental_mirrors/get-mirror-list-experimental.rb b/experimental_mirrors/get-mirror-list-experimental.rb deleted file mode 100755 index 0794df3..000 --- a/experimental_mirrors/get-mirror-list-experimental.rb +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/ruby - -MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml; - -%w[ rexml/document open-uri ].each {|lib| require lib } - -m = URI.parse(MIRROR_DATA).read -x = REXML::Document.new(m) - -REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| - country = el.attributes['country'] - - el.each_element('mirror/uri/') do |mirror| -puts "#{country.downcase} #{mirror[0].to_s}" - end - -} - diff --git a/get-mirrors-from-distfiles-xml.rb b/get-mirrors-from-distfiles-xml.rb new file mode 100755 index 000..02b9418 --- /dev/null +++ b/get-mirrors-from-distfiles-xml.rb @@ -0,0 +1,24 @@ +#!/usr/bin/ruby +require 'rexml/document' +require 'open-uri' + +MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml; + +m = URI.parse(MIRROR_DATA).read +x = REXML::Document.new(m) + +def normalize_mirror(xml_elem) + return xml_elem.texts().join(' ').sub(/\/+$/, '') + '/' +end + +def select_mirror(xml_elem) + 1 +end + +REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| + country = el.attributes['country'] + + el.each_element('mirror/uri/') do |uri_elem| +puts "#{country.downcase} #{normalize_mirror(uri_elem)}" if select_mirror(uri_elem) + end +} diff --git a/get-mirrors-from-rsync-xml.rb b/get-mirrors-from-rsync-xml.rb new file mode 100755 index 000..100dffc --- /dev/null +++ b/get-mirrors-from-rsync-xml.rb @@ -0,0 +1,24 @@ +#!/usr/bin/ruby +require 'rexml/document' +require 'open-uri' + +MIRROR_DATA="https://api.gentoo.org/mirrors/rsync.xml; + +m = URI.parse(MIRROR_DATA).read +x = REXML::Document.new(m) + +def normalize_mirror(xml_elem) + return xml_elem.texts().join(' ').sub(/\/+$/, '') + '/' +end + +def select_mirror(xml_elem) + xml_elem.texts().join(' ') =~ /rsync\d+\./ +end + +REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| + country = el.attributes['country'] + + el.each_element('mirror/uri/') do |uri_elem| +puts "#{country.downcase} #{normalize_mirror(uri_elem)}" if select_mirror(uri_elem) + end +} diff --git a/mirmon-distfiles.sh b/mirmon-distfiles.sh index 3e14e87..fedefdc 100755 --- a/mirmon-distfiles.sh +++ b/mirmon-distfiles.sh @@ -3,7 +3,7 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors # Grab mirrors from the web [[ -d ./var ]] || mkdir ./var -./get-mirror-list-distfiles.rb > ./var/g.mirrors +../get-mirrors-from-distfiles-xml.rb > ./var/g.mirrors # fatal if the state file is NOT present. [[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state # run mirmon diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh index f76a3d3..fae7df6 100755 --- a/mirmon-experimental.sh +++ b/mirmon-experimental.sh @@ -3,7 +3,7 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors # Grab mirrors from the web [[ -d ./var ]] || mkdir ./var -./get-mirror-list-experimental.rb > ./var/g.mirrors +../get-mirrors-from-distfiles-xml.rb > ./var/g.mirrors # fatal if the state file is NOT present.
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 34db670aff7f8da1eb1c90b7ad68cec526cfb4c6 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 16:45:32 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 16:45:52 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=34db670a probe-mirmon: fix rsync case Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/probe-mirmon b/probe-mirmon index 7b57923..ddd8546 100755 --- a/probe-mirmon +++ b/probe-mirmon @@ -17,6 +17,8 @@ main(@ARGV); +use strict; +use warnings; use Date::Parse (); # dev-perl/TimeDate use File::Tempdir; # dev-perl/File-Tempdir @@ -56,19 +58,20 @@ sub handle_rsync { exit 900; # rediculous exit code. }; - print munge_date(); + print munge_date(<$fh>); exit 0; } sub munge_date { - my $timestr = $_; + no warnings 'numeric'; ## no critic (TestingAndDebugging::ProhibitNoWarnings) + my $timestr = shift; my $timestamp = int($timestr); my $year2020 = 1577836800; my $year2038 = 2145916800; # If the string starts with an epoch, just use that - if($int_timestamp >= $year2020 && $int_timestamp <= $year2038) { - return $int_timestamp; + if($timestamp >= $year2020 && $timestamp <= $year2038) { + return $timestamp; } else { return Date::Parse::str2time($timestr); }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: experimental_mirrors/, releases_mirrors/
commit: 2360bf2e7540d90c2fff6a10b1b7aae8ad98b394 Author: Max Magorsch gentoo org> AuthorDate: Tue Apr 28 11:46:05 2020 + Commit: Max Magorsch gentoo org> CommitDate: Tue Apr 28 11:46:05 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=2360bf2e Fix the url for releases and experimental mirrors Signed-off-by: Max Magorsch gentoo.org> experimental_mirrors/get-mirror-list-experimental.rb | 6 +- releases_mirrors/get-mirror-list-releases.rb | 6 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/experimental_mirrors/get-mirror-list-experimental.rb b/experimental_mirrors/get-mirror-list-experimental.rb index 3e4bae4..0794df3 100755 --- a/experimental_mirrors/get-mirror-list-experimental.rb +++ b/experimental_mirrors/get-mirror-list-experimental.rb @@ -11,11 +11,7 @@ REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| country = el.attributes['country'] el.each_element('mirror/uri/') do |mirror| -if mirror[0].to_s.end_with?("/") - puts "#{country.downcase} #{mirror[0].to_s}experimental/" -else - puts "#{country.downcase} #{mirror[0].to_s}/experimental/" -end +puts "#{country.downcase} #{mirror[0].to_s}" end } diff --git a/releases_mirrors/get-mirror-list-releases.rb b/releases_mirrors/get-mirror-list-releases.rb index bb6b14c..0794df3 100755 --- a/releases_mirrors/get-mirror-list-releases.rb +++ b/releases_mirrors/get-mirror-list-releases.rb @@ -11,11 +11,7 @@ REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| country = el.attributes['country'] el.each_element('mirror/uri/') do |mirror| -if mirror[0].to_s.end_with?("/") - puts "#{country.downcase} #{mirror[0].to_s}releases/" -else - puts "#{country.downcase} #{mirror[0].to_s}/releases/" -end +puts "#{country.downcase} #{mirror[0].to_s}" end }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: releases_mirrors/, experimental_mirrors/
commit: 12797334a6b3d9e7276770aba56e2f8ac4cced3d Author: Max Magorsch gentoo org> AuthorDate: Tue Apr 28 11:23:18 2020 + Commit: Max Magorsch gentoo org> CommitDate: Tue Apr 28 11:23:18 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=12797334 Fix get-mirror script for releases and experimental Signed-off-by: Max Magorsch gentoo.org> experimental_mirrors/get-mirror-list-experimental.rb | 6 +- releases_mirrors/get-mirror-list-releases.rb | 6 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/experimental_mirrors/get-mirror-list-experimental.rb b/experimental_mirrors/get-mirror-list-experimental.rb index 0794df3..3e4bae4 100755 --- a/experimental_mirrors/get-mirror-list-experimental.rb +++ b/experimental_mirrors/get-mirror-list-experimental.rb @@ -11,7 +11,11 @@ REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| country = el.attributes['country'] el.each_element('mirror/uri/') do |mirror| -puts "#{country.downcase} #{mirror[0].to_s}" +if mirror[0].to_s.end_with?("/") + puts "#{country.downcase} #{mirror[0].to_s}experimental/" +else + puts "#{country.downcase} #{mirror[0].to_s}/experimental/" +end end } diff --git a/releases_mirrors/get-mirror-list-releases.rb b/releases_mirrors/get-mirror-list-releases.rb index 0794df3..bb6b14c 100755 --- a/releases_mirrors/get-mirror-list-releases.rb +++ b/releases_mirrors/get-mirror-list-releases.rb @@ -11,7 +11,11 @@ REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| country = el.attributes['country'] el.each_element('mirror/uri/') do |mirror| -puts "#{country.downcase} #{mirror[0].to_s}" +if mirror[0].to_s.end_with?("/") + puts "#{country.downcase} #{mirror[0].to_s}releases/" +else + puts "#{country.downcase} #{mirror[0].to_s}/releases/" +end end }
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: releases_mirrors/, experimental_mirrors/
commit: 35522ec67c3121cb62dde989a12ab5cf621ec995 Author: Max Magorsch gentoo org> AuthorDate: Tue Apr 28 11:10:21 2020 + Commit: Max Magorsch gentoo org> CommitDate: Tue Apr 28 11:10:21 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=35522ec6 Fix the name of the scripts for experimental and releases Signed-off-by: Max Magorsch gentoo.org> .../{get-mirror-list-distfiles.rb => get-mirror-list-experimental.rb} | 0 .../{get-mirror-list-distfiles.rb => get-mirror-list-releases.rb} | 0 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/experimental_mirrors/get-mirror-list-distfiles.rb b/experimental_mirrors/get-mirror-list-experimental.rb similarity index 100% rename from experimental_mirrors/get-mirror-list-distfiles.rb rename to experimental_mirrors/get-mirror-list-experimental.rb diff --git a/releases_mirrors/get-mirror-list-distfiles.rb b/releases_mirrors/get-mirror-list-releases.rb similarity index 100% rename from releases_mirrors/get-mirror-list-distfiles.rb rename to releases_mirrors/get-mirror-list-releases.rb
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: e7bd76858e286a650870dcc7da279ced52f3d4d6 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 07:54:05 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 07:54:05 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=e7bd7685 Fixup deployment pieces Signed-off-by: Robin H. Johnson gentoo.org> .gitignore | 2 ++ mirmon-experimental.sh | 0 mirmon-releases.sh | 0 3 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 608618c..2e314d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ rsync_mirrors/var/ distfiles_mirrors/var/ +experimental_mirrors/var/ +releases_mirrors/var/ diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh old mode 100644 new mode 100755 diff --git a/mirmon-releases.sh b/mirmon-releases.sh old mode 100644 new mode 100755
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: rsync_mirrors/, distfiles_mirrors/
commit: e5710f6af6a04401919a329e1d260ce9f2b8dcae Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 07:41:49 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 07:43:51 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=e5710f6a consistency in title Signed-off-by: Robin H. Johnson gentoo.org> distfiles_mirrors/mirmon.conf | 2 +- rsync_mirrors/mirmon.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/distfiles_mirrors/mirmon.conf b/distfiles_mirrors/mirmon.conf index e43d772..fa2ab1b 100644 --- a/distfiles_mirrors/mirmon.conf +++ b/distfiles_mirrors/mirmon.conf @@ -1,4 +1,4 @@ -project_name Gentoo Linux +project_name Gentoo Linux (distfiles) web_page /var/www/mirrorstats.gentoo.org/htdocs/distfiles/index-wip.html icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list diff --git a/rsync_mirrors/mirmon.conf b/rsync_mirrors/mirmon.conf index 94887a9..d285f8d 100644 --- a/rsync_mirrors/mirmon.conf +++ b/rsync_mirrors/mirmon.conf @@ -1,4 +1,4 @@ -project_name Gentoo Linux +project_name Gentoo Linux (rsync) web_page /var/www/mirrorstats.gentoo.org/htdocs/rsync/index-wip.html icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: rsync_mirrors/, distfiles_mirrors/, /
commit: 4b612418355ae1f3f4b4575db4f7bbae1e8781e4 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 07:33:32 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 07:43:51 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=4b612418 mirmon: start refactor of probe Signed-off-by: Robin H. Johnson gentoo.org> distfiles_mirrors/mirmon.conf | 2 +- .../probe-mirmon-distfiles => probe-mirmon | 18 ++- rsync_mirrors/mirmon.conf | 2 +- rsync_mirrors/probe-mirmon-rsync | 60 -- 4 files changed, 18 insertions(+), 64 deletions(-) diff --git a/distfiles_mirrors/mirmon.conf b/distfiles_mirrors/mirmon.conf index 7994130..e43d772 100644 --- a/distfiles_mirrors/mirmon.conf +++ b/distfiles_mirrors/mirmon.conf @@ -4,7 +4,7 @@ icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/g.mirrors state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state -probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/probe-mirmon-distfiles %TIMEOUT% %URL%distfiles/timestamp.mirmon +probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%distfiles/timestamp.mirmon project_url http://www.gentoo.org/ project_logo http://www.gentoo.org/images/gentoo-new.gif diff --git a/distfiles_mirrors/probe-mirmon-distfiles b/probe-mirmon similarity index 79% rename from distfiles_mirrors/probe-mirmon-distfiles rename to probe-mirmon index 6e8ae52..7b57923 100755 --- a/distfiles_mirrors/probe-mirmon-distfiles +++ b/probe-mirmon @@ -32,6 +32,8 @@ sub main { sub handle_wget { my ( $timeout, $url ) = @_; + # TODO: replace this with native HTTP + # TODO: munge the output! exec {'/usr/bin/wget'} 'wget', qw( -q --passive-ftp -O - -T ), $timeout, '-t', 1, $url; } @@ -54,8 +56,20 @@ sub handle_rsync { exit 900; # rediculous exit code. }; - print <$fh>; -# print Date::Parse::str2time(<$fh>); + print munge_date(); exit 0; } + +sub munge_date { + my $timestr = $_; + my $timestamp = int($timestr); + my $year2020 = 1577836800; + my $year2038 = 2145916800; + # If the string starts with an epoch, just use that + if($int_timestamp >= $year2020 && $int_timestamp <= $year2038) { + return $int_timestamp; + } else { + return Date::Parse::str2time($timestr); + } +} diff --git a/rsync_mirrors/mirmon.conf b/rsync_mirrors/mirmon.conf index 6627f55..94887a9 100644 --- a/rsync_mirrors/mirmon.conf +++ b/rsync_mirrors/mirmon.conf @@ -4,7 +4,7 @@ icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/g.mirrors state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/mirmon.state -probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/probe-mirmon-rsync %TIMEOUT% %URL%gentoo-portage/metadata/timestamp +probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%gentoo-portage/metadata/timestamp project_url http://www.gentoo.org/ project_logo http://www.gentoo.org/images/gentoo-new.gif diff --git a/rsync_mirrors/probe-mirmon-rsync b/rsync_mirrors/probe-mirmon-rsync deleted file mode 100755 index 2709319..000 --- a/rsync_mirrors/probe-mirmon-rsync +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/perl -# $Id: probe-mirmon,v 1.4 2009/08/19 23:15:46 karl Exp $ -# public domain. Originally written by Karl Berry, 2009. -# -# Probe rsync url's for mirmon; use wget for anything else. -# From description at http://people.cs.uu.nl/henkp/mirmon. -# -# Also requires a patch to mirmon itself to accept rsync urls -# (and I wanted https too): -# --- /usr/local/share/mirmon/ORIG/mirmon 2007-08-18 18:05:47.0 +0200 -# +++ /usr/local/share/mirmon/mirmon 2009-07-03 22:38:00.0 +0200 -# @@ -386,3 +386,3 @@ -# my ( $type, $site, $home ) ; -# -if ( $url =~ m!^(ftp|http)://([^/:]+)(:\d+)?/! ) -# +if ( $url =~ m!^(ftp|https?|rsync)://([^/:]+)(:\d+)?/! ) -#{ $type = $1 ; $site = $2 ; $home = $& ; } - -main(@ARGV); - -use Date::Parse (); # dev-perl/TimeDate -use File::Tempdir; # dev-perl/File-Tempdir - -sub main { - my ( $timeout, $url ) = @_; - if ( $url =~ m,^rsync://, ) { -handle_rsync( $timeout, $url ); - } - else { -handle_wget( $timeout, $url ); - } -} - -sub handle_wget { - my ( $timeout, $url ) = @_; - exec {'/usr/bin/wget'} 'wget', qw( -q --passive-ftp -O - -T ), $timeout, '-t', 1, $url; -} - -sub handle_rsync { - my ( $timeout, $url ) = @_; - - my $tmpdir = File::Tempdir->new(); - my $dir= $tmpdir->name; - my $file = $url; - - $file =~ s/\W/_/g;
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /, experimental_mirrors/, releases_mirrors/
commit: 92e5c14c71eb10d67d6880be56e8aab860f97092 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Apr 28 07:42:33 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Apr 28 07:43:52 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=92e5c14c mirrorstats: track experimental & releases seperately Signed-off-by: Robin H. Johnson gentoo.org> experimental_mirrors/get-mirror-list-distfiles.rb | 18 ++ experimental_mirrors/mirmon.conf | 23 +++ mirmon-experimental.sh| 18 ++ mirmon-releases.sh| 18 ++ releases_mirrors/get-mirror-list-distfiles.rb | 18 ++ releases_mirrors/mirmon.conf | 23 +++ 6 files changed, 118 insertions(+) diff --git a/experimental_mirrors/get-mirror-list-distfiles.rb b/experimental_mirrors/get-mirror-list-distfiles.rb new file mode 100755 index 000..0794df3 --- /dev/null +++ b/experimental_mirrors/get-mirror-list-distfiles.rb @@ -0,0 +1,18 @@ +#!/usr/bin/ruby + +MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml; + +%w[ rexml/document open-uri ].each {|lib| require lib } + +m = URI.parse(MIRROR_DATA).read +x = REXML::Document.new(m) + +REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| + country = el.attributes['country'] + + el.each_element('mirror/uri/') do |mirror| +puts "#{country.downcase} #{mirror[0].to_s}" + end + +} + diff --git a/experimental_mirrors/mirmon.conf b/experimental_mirrors/mirmon.conf new file mode 100644 index 000..b27bea0 --- /dev/null +++ b/experimental_mirrors/mirmon.conf @@ -0,0 +1,23 @@ +project_name Gentoo Linux (experimental) +web_page /var/www/mirrorstats.gentoo.org/htdocs/experimental/index-wip.html +icons ../icons +countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list +mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/g.mirrors +state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state +probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%experimental/.timestamp-experimental.x +project_url http://www.gentoo.org/ +project_logo http://www.gentoo.org/images/gentoo-new.gif + + +# Fresh: 0 - 8h +# Oldish: 8 - 24h +# Old: 24h - inf +# Bad: No reachable, no state saved + +max_poll 4h +min_sync 4h +max_sync 20h + +put_histo top +timeout 30 + diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh new file mode 100644 index 000..f76a3d3 --- /dev/null +++ b/mirmon-experimental.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors +# Grab mirrors from the web +[[ -d ./var ]] || mkdir ./var +./get-mirror-list-experimental.rb > ./var/g.mirrors +# fatal if the state file is NOT present. +[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state +# run mirmon +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update +# Set up a nice link to our mirror page directly: +[[ -d ../../htdocs/experimental ]] || mkdir ../../htdocs/experimental +sed \ +-e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ +>../../htdocs/experimental/index.html <../../htdocs/experimental/index-wip.html +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state \ + > ../../htdocs/experimental/state.json diff --git a/mirmon-releases.sh b/mirmon-releases.sh new file mode 100644 index 000..a6bf5fd --- /dev/null +++ b/mirmon-releases.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors +# Grab mirrors from the web +[[ -d ./var ]] || mkdir ./var +./get-mirror-list-releases.rb > ./var/g.mirrors +# fatal if the state file is NOT present. +[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state +# run mirmon +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update +# Set up a nice link to our mirror page directly: +[[ -d ../../htdocs/releases ]] || mkdir ../../htdocs/releases +sed \ +-e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ +>../../htdocs/releases/index.html <../../htdocs/releases/index-wip.html +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors/var/mirmon.state \ + > ../../htdocs/releases/state.json diff --git a/releases_mirrors/get-mirror-list-distfiles.rb b/releases_mirrors/get-mirror-list-distfiles.rb new file mode 100755 index 000..0794df3 --- /dev/null +++ b/releases_mirrors/get-mirror-list-distfiles.rb @@ -0,0 +1,18 @@ +#!/usr/bin/ruby + +MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml; + +%w[ rexml/document open-uri ].each {|lib| require
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/
commit: 0f28dae401157afc08aede61016ad363ac344bd8 Author: Max Magorsch gentoo org> AuthorDate: Mon Apr 27 19:23:11 2020 + Commit: Max Magorsch gentoo org> CommitDate: Mon Apr 27 19:23:11 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0f28dae4 Add the host of the mirror to the json files Signed-off-by: Max Magorsch gentoo.org> json/generate-json.py | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/json/generate-json.py b/json/generate-json.py index ced3cc8..c452e81 100755 --- a/json/generate-json.py +++ b/json/generate-json.py @@ -24,11 +24,13 @@ try: line = raw_line.split(" ") protocol = line[0].split("://")[0] -url = line[0].split("://")[1] +host = line[0].split("://")[1] +host = host.split("/")[0] state = { "Protocol" : protocol, -"Url" : url, +"Host" : host, +"Url" : line[0], "Age" : line[1], "StatusLastProbe" : line[2], "TimeLastSuccessfulProbe" : line[3], @@ -37,10 +39,10 @@ try: "LastProbe" : line[6].strip(), } -if url not in mirrors: -mirrors[url] = [] +if host not in mirrors: +mirrors[host] = [] -mirrors[url].append(state) +mirrors[host].append(state) data = {} data["LastUpdate"] = int(time.time())
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/
commit: 137484f7612b9b2ec741f94744d1e5e30ad895b5 Author: Max Magorsch gentoo org> AuthorDate: Mon Apr 27 19:11:14 2020 + Commit: Max Magorsch gentoo org> CommitDate: Mon Apr 27 19:11:14 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=137484f7 Add the timestamp of the last update to the json files Signed-off-by: Max Magorsch gentoo.org> json/generate-json.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/json/generate-json.py b/json/generate-json.py index 1786bf9..ced3cc8 100755 --- a/json/generate-json.py +++ b/json/generate-json.py @@ -15,6 +15,7 @@ import json import sys +import time try: with open(str(sys.argv[1])) as file_in: @@ -41,7 +42,10 @@ try: mirrors[url].append(state) -print(json.dumps(mirrors)) +data = {} +data["LastUpdate"] = int(time.time()) +data["Mirrors"] = mirrors +print(json.dumps(data)) except Exception as e: print("Could not convert mirmon state file to json: " + str(e), file=sys.stderr)
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/, /
commit: 92ea4ca1710dd5eefbda4f97687ea76e34812d50 Author: Max Magorsch gentoo org> AuthorDate: Mon Apr 27 18:08:22 2020 + Commit: Max Magorsch gentoo org> CommitDate: Mon Apr 27 18:08:22 2020 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=92ea4ca1 Generate a json file containing the mirmon data The new generate-json.py script will parse the data generated by mirmon which is present in the state file and convert it to json. A json file called 'state.json' will be created so that the mirmon data can be properly parsed. Signed-off-by: Max Magorsch gentoo.org> json/generate-json.py | 47 +++ mirmon-distfiles.sh | 4 +++- mirmon-rsync.sh | 4 +++- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/json/generate-json.py b/json/generate-json.py new file mode 100755 index 000..1786bf9 --- /dev/null +++ b/json/generate-json.py @@ -0,0 +1,47 @@ +#!/usr/bin/python + +# +# Convert a mirmon.state file to json +# +# This script will parse a mirmon state file, convert the content +# to json and print the json to stdout. +# +# Usage: +# $ generate-json.py path_to_mirmon_state_file +# +# The json will be printed to stdout. In case of an error, the +# exception will be printed to stderr. +# + +import json +import sys + +try: +with open(str(sys.argv[1])) as file_in: +mirrors = {} +for raw_line in file_in: + +line = raw_line.split(" ") +protocol = line[0].split("://")[0] +url = line[0].split("://")[1] + +state = { +"Protocol" : protocol, +"Url" : url, +"Age" : line[1], +"StatusLastProbe" : line[2], +"TimeLastSuccessfulProbe" : line[3], +"ProbeHistory" : line[4], +"StateHistory" : line[5], +"LastProbe" : line[6].strip(), +} + +if url not in mirrors: +mirrors[url] = [] + +mirrors[url].append(state) + +print(json.dumps(mirrors)) + +except Exception as e: +print("Could not convert mirmon state file to json: " + str(e), file=sys.stderr) diff --git a/mirmon-distfiles.sh b/mirmon-distfiles.sh index f8012cc..3e14e87 100755 --- a/mirmon-distfiles.sh +++ b/mirmon-distfiles.sh @@ -13,4 +13,6 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors2.xml;>mirrors#' \ >../../htdocs/distfiles/index.html <../../htdocs/distfiles/index-wip.html - +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state \ + > ../../htdocs/distfiles/state.json diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index 5df1c73..900832d 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -28,4 +28,6 @@ echo "gentoo rsync://35.190.132.250" >> ./var/g.mirrors sed \ -e 's#mirrors#http://www.gentoo.org/main/en/mirrors-rsync.xml;>mirrors#' \ >../../htdocs/rsync/index.html <../../htdocs/rsync/index-wip.html - +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/mirmon.state \ + > ../../htdocs/rsync/state.json
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 343409ae01cf6c8cf95f6a59fdeee995aa469e5b Author: Alec Warner gentoo org> AuthorDate: Sat Dec 15 18:57:27 2018 + Commit: Alec Warner gentoo org> CommitDate: Sat Dec 15 18:57:40 2018 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=343409ae Add my GCP mirror IP to the mirmon state. Signed-off-by: Alec Warner gentoo.org> mirmon-rsync.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index c8c5ba0..5df1c73 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -17,6 +17,8 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors for i in ${INFRA}; do echo "gentoo rsync://$i.gentoo.org" >> ./var/g.mirrors done +# Test GCP mirror; added by antarus +echo "gentoo rsync://35.190.132.250" >> ./var/g.mirrors # fatal if the state file is NOT present. [[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state # run mirmon
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: /
commit: 26b584d6b1a64dabaa1080966ef3e5b6fdce96a3 Author: Robin H. Johnson gentoo org> AuthorDate: Sat Nov 5 18:01:50 2016 + Commit: Robin H. Johnson gentoo org> CommitDate: Sat Nov 5 18:01:50 2016 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=26b584d6 Drop two older infra mirrors that were removed from rsync.g.o rotation long ago. Signed-off-by: Robin H. Johnson gentoo.org> mirmon-rsync.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index 1934d90..c8c5ba0 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -2,10 +2,8 @@ INFRA=" albatross -bobolink boobie dipper -magpie quetzal starling swan
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: rsync_mirrors/, distfiles_mirrors/
commit: 1986f0f44c0ab818b5745bcf55063a1b0f44d791 Author: Alex Legler alex AT a3li DOT li AuthorDate: Tue Apr 14 11:39:50 2015 + Commit: Alex Legler a3li AT gentoo DOT org CommitDate: Tue Apr 14 11:39:50 2015 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=1986f0f4 Update mirror data URIs and fetch method distfiles_mirrors/get-mirror-list-distfiles.rb | 6 -- rsync_mirrors/get-mirror-list-rsync.rb | 6 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/distfiles_mirrors/get-mirror-list-distfiles.rb b/distfiles_mirrors/get-mirror-list-distfiles.rb index 1aa22ea..0794df3 100755 --- a/distfiles_mirrors/get-mirror-list-distfiles.rb +++ b/distfiles_mirrors/get-mirror-list-distfiles.rb @@ -1,8 +1,10 @@ #!/usr/bin/ruby -%w[ rexml/document net/http ].each {|lib| require lib } +MIRROR_DATA=https://api.gentoo.org/mirrors/distfiles.xml; -m = Net::HTTP.get('www.gentoo.org', '/main/en/mirrors3.xml?passthru=1') +%w[ rexml/document open-uri ].each {|lib| require lib } + +m = URI.parse(MIRROR_DATA).read x = REXML::Document.new(m) REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| diff --git a/rsync_mirrors/get-mirror-list-rsync.rb b/rsync_mirrors/get-mirror-list-rsync.rb index 7269ece..252bfd2 100755 --- a/rsync_mirrors/get-mirror-list-rsync.rb +++ b/rsync_mirrors/get-mirror-list-rsync.rb @@ -1,8 +1,10 @@ #!/usr/bin/ruby -%w[ rexml/document net/http ].each {|lib| require lib } +MIRROR_DATA=https://api.gentoo.org/mirrors/rsync.xml; -m = Net::HTTP.get('www.gentoo.org', '/main/en/mirrors-rsync-data.xml?passthru=1') +%w[ rexml/document open-uri ].each {|lib| require lib } + +m = URI.parse(MIRROR_DATA).read x = REXML::Document.new(m) REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el|
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: distfiles_mirrors/, /
commit: a4938a7a8e2d56e0251dd5d25365f1ce74438d63 Author: Alex Legler alex AT a3li DOT li AuthorDate: Tue Apr 14 11:43:25 2015 + Commit: Alex Legler a3li AT gentoo DOT org CommitDate: Tue Apr 14 11:43:25 2015 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a4938a7a Update URIs distfiles_mirrors/mirmon.conf | 2 +- mirmon-distfiles.sh | 5 +++-- mirmon-rsync.sh | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/distfiles_mirrors/mirmon.conf b/distfiles_mirrors/mirmon.conf index 64d9737..2e6c9db 100644 --- a/distfiles_mirrors/mirmon.conf +++ b/distfiles_mirrors/mirmon.conf @@ -1,5 +1,5 @@ project_name Gentoo Linux -web_page /var/www/mirrorstats.gentoo.org/htdocs/index-wip.html +web_page /var/www/mirrorstats.gentoo.org/htdocs/distfiles/index-wip.html icons icons countries /var/www/mirrorstats.gentoo.org/countries.list mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/g.mirrors diff --git a/mirmon-distfiles.sh b/mirmon-distfiles.sh index d9a1d48..f8012cc 100755 --- a/mirmon-distfiles.sh +++ b/mirmon-distfiles.sh @@ -7,9 +7,10 @@ cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors # fatal if the state file is NOT present. [[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state # run mirmon -/usr/bin/perl ../../mirmon -c ./mirmon.conf -q -get update +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update # Set up a nice link to our mirror page directly: +[[ -d ../../htdocs/distfiles ]] || mkdir ../../htdocs/distfiles sed \ -e 's#mirrors/H2#a href=http://www.gentoo.org/main/en/mirrors2.xml;mirrors/a/H2#' \ -../../htdocs/index.html ../../htdocs/index-wip.html +../../htdocs/distfiles/index.html ../../htdocs/distfiles/index-wip.html diff --git a/mirmon-rsync.sh b/mirmon-rsync.sh index 0efc6e0..1934d90 100755 --- a/mirmon-rsync.sh +++ b/mirmon-rsync.sh @@ -22,7 +22,7 @@ done # fatal if the state file is NOT present. [[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state # run mirmon -/usr/bin/perl ../../mirmon -c ./mirmon.conf -q -get update +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update [[ -d ../../htdocs/rsync ]] || mkdir ../../htdocs/rsync # Set up a nice link to our mirror page directly: sed \
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: distfiles_mirrors/, rsync_mirrors/
commit: 23a2330e3cbab6c8dab7f5c9a59c246d85bde017 Author: Alex Legler alex AT a3li DOT li AuthorDate: Tue Apr 14 11:44:34 2015 + Commit: Alex Legler a3li AT gentoo DOT org CommitDate: Tue Apr 14 11:44:34 2015 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=23a2330e Update countries list location distfiles_mirrors/mirmon.conf | 2 +- rsync_mirrors/mirmon.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/distfiles_mirrors/mirmon.conf b/distfiles_mirrors/mirmon.conf index 2e6c9db..ea75c6f 100644 --- a/distfiles_mirrors/mirmon.conf +++ b/distfiles_mirrors/mirmon.conf @@ -1,7 +1,7 @@ project_name Gentoo Linux web_page /var/www/mirrorstats.gentoo.org/htdocs/distfiles/index-wip.html icons icons -countries /var/www/mirrorstats.gentoo.org/countries.list +countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/g.mirrors state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/probe-mirmon-distfiles %TIMEOUT% %URL%distfiles/timestamp.mirmon diff --git a/rsync_mirrors/mirmon.conf b/rsync_mirrors/mirmon.conf index e19c6b1..6627f55 100644 --- a/rsync_mirrors/mirmon.conf +++ b/rsync_mirrors/mirmon.conf @@ -1,7 +1,7 @@ project_name Gentoo Linux web_page /var/www/mirrorstats.gentoo.org/htdocs/rsync/index-wip.html icons ../icons -countries /var/www/mirrorstats.gentoo.org/countries.list +countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/g.mirrors state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/var/mirmon.state probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/rsync_mirrors/probe-mirmon-rsync %TIMEOUT% %URL%gentoo-portage/metadata/timestamp
[gentoo-commits] proj/gentoo-mirrorstats:master commit in: distfiles_mirrors/
commit: 13e3a8d50dbf4e43f29c3dc6456a545ce6cc618d Author: Alex Legler alex AT a3li DOT li AuthorDate: Tue Apr 14 11:50:37 2015 + Commit: Alex Legler a3li AT gentoo DOT org CommitDate: Tue Apr 14 11:50:37 2015 + URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=13e3a8d5 fix icons path distfiles_mirrors/mirmon.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distfiles_mirrors/mirmon.conf b/distfiles_mirrors/mirmon.conf index ea75c6f..7994130 100644 --- a/distfiles_mirrors/mirmon.conf +++ b/distfiles_mirrors/mirmon.conf @@ -1,6 +1,6 @@ project_name Gentoo Linux web_page /var/www/mirrorstats.gentoo.org/htdocs/distfiles/index-wip.html -icons icons +icons ../icons countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/g.mirrors state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/distfiles_mirrors/var/mirmon.state