Browse Source

Fix incorrect sorting of country lists for English

Since the changes in version 2.32 the English country lists no longer get
sorted in debconf, so we need to make sure the template file gets generated
with correct sort order. As the mirrorlist script already has access to
iso-3166 data, it's possible to generate a correctly sorted country code +
name list there and mktemplates can be simplified.

r62229
tags/2.33
Frans Pop 11 years ago
parent
commit
40e8059a13
4 changed files with 13 additions and 19 deletions
  1. +1
    -0
      debian/changelog
  2. +6
    -3
      mirrorlist
  3. +5
    -15
      mktemplates
  4. +1
    -1
      sort-templates

+ 1
- 0
debian/changelog View File

@@ -1,6 +1,7 @@
choose-mirror (2.33) UNRELEASED; urgency=low

* Correctly move progress bar to 100% after reading suites.
* Fix incorrect sorting of country lists for English. Closes: #569199.

-- Frans Pop <fjp@debian.org> Thu, 04 Feb 2010 20:30:18 +0100



+ 6
- 3
mirrorlist View File

@@ -113,10 +113,13 @@ if ($type =~ /(.*)list/) {
foreach my $id (0..$#data) {
next unless exists $data[$id]->{"archive-$type"} and
exists $data[$id]->{country};
$countries{$data[$id]->{country}} = 1;
my $cc = $data[$id]->{country};
die "Error: country code '$cc' does not occur in iso-3166 table"
unless exists $iso3166{$cc};
$countries{$iso3166{$cc}} = $cc;
}
foreach my $country (sort (keys %countries)) {
print LIST "${country}\n";
foreach my $country (sort (keys %countries)) {
print LIST "$countries{$country}\t${country}\n";
}
close LIST;
}


+ 5
- 15
mktemplates View File

@@ -12,35 +12,25 @@ TEMPLATES="$@"
ISO3166TRANSLATIONS=debian/iso-codes

if [ -z "$DEB_HOST_ARCH" ]; then
DEB_HOST_ARCH="$(dpkg-architecture -qDEB_HOST_ARCH)"
DEB_HOST_ARCH="$(dpkg-architecture -qDEB_HOST_ARCH)"
fi

# Get the English names for the country codes in the list
country_names() {
local list=$1
local code name
for code in $(xargs < $list); do
# Ensure commas in country names are escaped
name="$(perl -ne 's/,/\\\\,/g; if (/^'$code'\t(.*)/) { print "$1"; }' debian/iso_3166.tab)"
if [ "$name" ]; then
echo -n ", $name"
else
echo "Warning: no country name found for '$code'" >&2
echo -n ", $code"
fi
done
# Ensure commas in country names end up escaped
perl -ne 'chomp; s/.*\t//; s/,/\\\\,/; print ", $_"' $1
}

# Get the ordered list of countries from the iso_3166.xml, sorted
# according to the regionmap.

printf "Creating the list of countries for HTTP mirrors..."
HTTPCODECHOICES="$(xargs < debian/httplist-countries | sed 's/ /, /g')"
HTTPCODECHOICES="$(cut -f1 debian/httplist-countries | xargs | sed 's/ /, /g')"
HTTPCHOICES="$(country_names debian/httplist-countries)"
printf " Done.\n"

printf "Creating the list of countries for FTP mirrors..."
FTPCODECHOICES="$(xargs < debian/ftplist-countries | sed 's/ /, /g')"
FTPCODECHOICES="$(cut -f1 debian/ftplist-countries | xargs | sed 's/ /, /g')"
FTPCHOICES="$(country_names debian/ftplist-countries)"
printf " Done.\n"



+ 1
- 1
sort-templates View File

@@ -42,7 +42,7 @@ for template in $templates; do
if [ -z "$unilang" ]; then
echo "W: language '$lang' skipped: no UTF-8 variant found" >&2
else
if [ ! -d ../locales/$unilang.UTF-8 ]; then
if [ ! -d ../locales/$unilang.UTF-8 ]; then
localedef -c -f UTF-8 -i $unilang ../locales/$unilang.UTF-8
fi
# sed statement adds index for 1st (unsorted) value back in


Loading…
Cancel
Save