Browse Source

Filter releases by architecture (Closes: #783548)

Only list releases the current arch is included in.  For example,
don't display a "jessie" release for kfreebsd-* or hurd.
tags/2.63
Steven Chamberlain 5 years ago
parent
commit
c8d512413f
3 changed files with 30 additions and 5 deletions
  1. +15
    -5
      choose-mirror.c
  2. +8
    -0
      debian/changelog
  3. +7
    -0
      mirrors.h

+ 15
- 5
choose-mirror.c View File

@@ -300,9 +300,9 @@ static int get_release(struct release_t *release, const char *name) {
char *command;
FILE *f = NULL;
char *wget_options, *hostname, *directory;
char line[80];
char line[BUFFER_LENGTH];
char *p;
char buf[SUITE_LENGTH];
char buf[BUFFER_LENGTH];

hostname = add_protocol("hostname");
debconf_get(debconf, hostname);
@@ -321,7 +321,7 @@ static int get_release(struct release_t *release, const char *name) {
}

wget_options = get_wget_options();
command = xasprintf("wget %s %s://%s%s/dists/%s/Release -O - | grep -E '^(Suite|Codename):'",
command = xasprintf("wget %s %s://%s%s/dists/%s/Release -O - | grep -E '^(Suite|Codename|Architectures):'",
wget_options, protocol, hostname, directory, name);
di_log(DI_LOG_LEVEL_DEBUG, "command: %s", command);
f = popen(command, "r");
@@ -337,12 +337,14 @@ static int get_release(struct release_t *release, const char *name) {
if (line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = '\0';
if ((value = strstr(line, ": ")) != NULL) {
strncpy(buf, value + 2, SUITE_LENGTH - 1);
buf[SUITE_LENGTH - 1] = '\0';
strncpy(buf, value + 2, BUFFER_LENGTH - 1);
buf[BUFFER_LENGTH - 1] = '\0';
if (strncmp(line, "Codename:", 9) == 0)
release->name = strdup(buf);
if (strncmp(line, "Suite:", 6) == 0)
release->suite = strdup(buf);
if (strncmp(line, "Architectures:", 14) == 0)
release->archs = strdup(buf);
}
}
if (release->name != NULL && strcmp(release->name, name) == 0)
@@ -354,6 +356,14 @@ static int get_release(struct release_t *release, const char *name) {
!(release->status & IS_VALID))
log_invalid_release(name, "Suite or Codename");

/* Does the release include this arch? */
if (release->archs != NULL && strstr(release->archs, ARCH_TEXT) == NULL) {
/* No: disregard this release */
log_invalid_release(name, "Architectures");
release->status &= ~IS_VALID;
release->name = NULL;
}

/* Cross-validate the Release file */
if (release->status & IS_VALID)
if (! cross_validate_release(release))


+ 8
- 0
debian/changelog View File

@@ -1,3 +1,11 @@
choose-mirror (2.63) UNRELEASED; urgency=medium

* Only list releases the current arch is included in. For example,
don't display a "jessie" release for kfreebsd-* or hurd.
(Closes: #783548)

-- Steven Chamberlain <steven@pyro.eu.org> Mon, 27 Apr 2015 11:28:22 +0000

choose-mirror (2.62) unstable; urgency=medium

* Update Mirrors.masterlist


+ 7
- 0
mirrors.h View File

@@ -17,6 +17,12 @@ struct mirror_t {
*/
#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 */
@@ -43,6 +49,7 @@ static const char suites[][SUITE_LENGTH] = {
struct release_t {
char *name;
char *suite;
char *archs;
int status;
};



Loading…
Cancel
Save