Skip to content
Commits on Source (2)
......@@ -17,7 +17,7 @@ import sys, os, re, dbm, ssl
from urllib.request import urlopen
import yaml
def extract_excuses(url, name, type):
def extract_excuses(url, name, type, experimental):
excuses_db = dbm.open(f"excuses-{name}-new", 'c')
debian_ca_path = '/etc/ssl/ca-debian'
if os.path.isdir(debian_ca_path):
......@@ -42,6 +42,10 @@ def extract_excuses(url, name, type):
re_greater_old = re.compile(r'\(> ')
re_target = re.compile(r' target="_blank"')
re_other_pkg = re.compile(r'href="#')
if experimental:
excuses_href = 'href="excuses.php?experimental=1&package='
else:
excuses_href = 'href="excuses.php?package='
for source in ex['sources']:
package = source['source']
......@@ -50,8 +54,13 @@ def extract_excuses(url, name, type):
continue
version = source['old-version']
excuse = "<!-- Testing_version: " + version + " -->\n"
excuse += "<h2>Excuse for " + package + "</h2>\n<ul>"
# "Excuse for " must not be changed as grep-excuses relies on it
if experimental:
excuse = "<!-- Unstable_version: " + version + " -->\n"
excuse += "<h2>Experimental: Pseudo-Excuse for " + package + "</h2>\n<ul>"
else:
excuse = "<!-- Testing_version: " + version + " -->\n"
excuse += "<h2>Testing: Excuse for " + package + "</h2>\n<ul>"
indented = False
for line in source['excuses']:
......@@ -72,7 +81,7 @@ def extract_excuses(url, name, type):
line = re_greater_eq.sub('(&gt;= ', line)
line = re_greater_old.sub('(&gt; ', line)
line = re_target.sub('', line)
line = re_other_pkg.sub('href="excuses.php?package=', line)
line = re_other_pkg.sub(excuses_href, line)
excuse += '<li>' + line + '</li>\n'
if indented:
excuse += "</ul>\n"
......@@ -80,7 +89,7 @@ def extract_excuses(url, name, type):
try:
for depends in source['dependencies']['blocked-by']:
excuse += '<li>Depends: ' + package
excuse += ' <a href="excuses.php?package='
excuse += ' <a ' + excuses_href
excuse += depends + '">' + depends
excuse += '</a> (not considered)</li>\n'
except KeyError:
......@@ -90,7 +99,7 @@ def extract_excuses(url, name, type):
for depends in source['dependencies']['migrate-after']:
if '/' not in depends:
excuse += '<li>Depends: ' + package
excuse += ' <a href="excuses.php?package='
excuse += ' <a ' + excuses_href
excuse += depends + '">' + depends
excuse += '</a></li>\n'
except KeyError:
......@@ -105,7 +114,7 @@ def extract_excuses(url, name, type):
excuses_db.close()
return
extract_excuses("https://release.debian.org/britney/excuses.yaml", 'testing', 'excuses')
extract_excuses("https://release.debian.org/britney/pseudo-excuses-experimental.yaml", 'experimental', 'pseudo-excuses')
extract_excuses("https://release.debian.org/britney/excuses.yaml", 'testing', 'excuses', False)
extract_excuses("https://release.debian.org/britney/pseudo-excuses-experimental.yaml", 'experimental', 'pseudo-excuses', True)
# vim:sw=4:softtabstop=4:expandtab
......@@ -28,18 +28,21 @@ $filter_re = '/^[a-z0-9][-+.a-z0-9]+$/'; // only accept valid package names
$default_title = 'Search testing migration excuses or experimental manual migration pseudo-excuses';
// "No excuse for " must not be changed as grep-excuses relies on it
$suites = array(
array (
'name' => 'testing',
'title' => 'Testing Excuses for ',
'link' => 'excuses.php?package=',
'text' => 'Testing migration excuses for ',
'none' => 'Testing: No excuse for ',
),
array (
'name' => 'experimental',
'title' => 'Experimental Pseudo-Excuses for ',
'link' => 'excuses.php?experimental=1&package=',
'text' => 'Experimental manual migration pseudo-excuses for ',
'none' => 'Experimental: No excuse for ',
),
);
......@@ -82,8 +85,7 @@ function print_excuse($data_suite, $link_suite, $package)
} else {
header('Status: 404 Not Found', FALSE, 404);
start_output('No '.$data_suite['title'].$package);
// "No excuse for" must not be changed as grep-excuses relies on it
print html_h("No excuse for $package", 2);
print html_h($data_suite['none'].$package, 2);
}
$url_pkg = urlencode($package);
......