~ubuntu-installer/choose-mirror/master

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Data structure for representing http, https, and ftp mirror information.
 * Contains essentially the same information as Mirrors.masterlist,
 * but only as much information as is necessary.
 */
struct mirror_t {
	char *site;
	char *country; /* NULL for GeoDNS */
	char *root;
};

#define DEBCONF_BASE "mirror/"

/*
 * The string defined below must match the string used in the templates
 * (http, https, and ftp) for this option.
 */
#define MANUAL_ENTRY "manual"

/*
 * Allow to read the full Architectures: line from Release file,
 * which is up to 123 bytes long at time of writing.
 */
#define BUFFER_LENGTH 256

#define SUITE_LENGTH 32

/* Stack of suites */
static const char suites[][SUITE_LENGTH] = {
	/* higher preference */
	"oldstable",
	"stable",
	"testing",
	"unstable"
	/* lower preference */
};

/*
 * Allow for two more releases than the number of suites:
 * - all suites
 * - default release (if not in suites)
 * - NULL list terminator
 */
#define MAXRELEASES (sizeof(suites)/SUITE_LENGTH + 2)

/*
 * Data structure containing information on releases supported by a mirror
 */
struct release_t {
	char *name;
	char *suite;
	char *archs;
	int status;
};

/* Values for status field in release_t */
#define IS_VALID	0x1
#define IS_DEFAULT	0x2
#define GET_SUITE	0x4
#define GET_CODENAME	0x8