3 # |_) /| Copyright (C) 2001 | richard@
4 # | \/¯| Richard Atterer | atterer.org
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License, version 2. See
8 # the file COPYING for details.
10 # Convert the list of Debian mirrors from Debian CVS into entries for
11 # the [Servers] section of a .jigdo file.
13 function jigdo(str, comment) {
14 if (str in recorded) return;
17 #result = substr(str, 7)" "substr(str, 1, 6);
19 result = result substr(" ",
20 length(str)) " # " comment;
26 for (dummy in x) { # Array empty => ignore
27 comment = x["Country"];
28 if ("Location" in x) {
29 # Remove repeated country name from Location
30 location = x["Location"];
31 loc = index(location, substr(comment, 4));
33 comment = comment " (" substr(location, 1, loc - 1) \
34 substr(location, loc + length(comment) - 3) ")";
36 comment = comment " (" location ")";
38 sub(/[ ,]+\)$| +\)/, ")", comment);
39 sub(/[ ,]+\( *\)$/, "", comment);
40 sub(/ +/, " ", comment);
42 if ("Archive-http" in x)
43 jigdo("Debian=http://" x["Site"] x["Archive-http"], comment);
44 else if ("Archive-ftp" in x)
45 jigdo("Debian=ftp://" x["Site"] x["Archive-ftp"], comment);
46 if ("NonUS-http" in x)
47 jigdo("Non-US=http://" x["Site"] x["NonUS-http"], comment);
48 else if ("NonUS-ftp" in x)
49 jigdo("Non-US=ftp://" x["Site"] x["NonUS-ftp"], comment);
50 split("", x); # Clear x[]
59 ($1 ~ /^[A-Za-z0-9_-]+:$/) {
60 field = substr($1, 1, length($1) - 1);
61 line = $0; sub(/^[^ ]+ /, "", line);
65 # Entry line continued on new line
67 line = $0; sub(/^[ ]+/, " ", line);
68 x[field] = x[field] line;