#include "util.h"
static const char *archpolicies[] = {
+#if defined(FEDORA) || defined(MAGEIA)
+ "x86_64", "x86_64:athlon:i686:i586:i486:i386",
+#else
"x86_64", "x86_64:i686:i586:i486:i386",
+#endif
"i686", "i686:i586:i486:i386",
"i586", "i586:i486:i386",
"i486", "i486:i386",
- "i386", "i386",
"s390x", "s390x:s390",
- "s390", "s390",
- "ia64", "ia64:i686:i586:i486:i386",
"ppc64", "ppc64:ppc",
- "ppc", "ppc",
- "armv7nhl", "armv7nhl:armv7hl",
- "armv7hl", "armv7hl",
- "armv7l", "armv7l:armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv6l", "armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv5tejl", "armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv5tel", "armv5tel:armv5l:armv4tl:armv4l:armv3l",
+ "ppc64p7", "ppc64p7:ppc64:ppc",
+ "ia64", "ia64:i686:i586:i486:i386",
+ "armv8hcnl", "armv8hcnl:armv8hnl:armv8hl:armv7hnl:armv7hl:armv6hl",
+ "armv8hnl", "armv8hnl:armv8hl:armv7hnl:armv7hl:armv6hl",
+ "armv8hl", "armv8hl:armv7hl:armv6hl",
+ "armv8l", "armv8l:armv7l:armv6l:armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv7hnl", "armv7hnl:armv7hl:armv6hl",
+ "armv7hl", "armv7hl:armv6hl",
+ "armv7l", "armv7l:armv6l:armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv6l", "armv6l:armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv5tejl", "armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv5tel", "armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv5tl", "armv5tl:armv5l:armv4tl:armv4l:armv3l",
"armv5l", "armv5l:armv4tl:armv4l:armv3l",
"armv4tl", "armv4tl:armv4l:armv3l",
"armv4l", "armv4l:armv3l",
- "armv3l", "armv3l",
- "sh3", "sh3",
- "sh4", "sh4",
"sh4a", "sh4a:sh4",
"sparc64v", "sparc64v:sparc64:sparcv9v:sparcv9:sparcv8:sparc",
"sparc64", "sparc64:sparcv9:sparcv8:sparc",
"sparcv9v", "sparcv9v:sparcv9:sparcv8:sparc",
"sparcv9", "sparcv9:sparcv8:sparc",
"sparcv8", "sparcv8:sparc",
- "sparc", "sparc",
+#if defined(FEDORA) || defined(MAGEIA)
+ "ia32e", "ia32e:x86_64:athlon:i686:i586:i486:i386",
+ "athlon", "athlon:i686:i586:i486:i386",
+ "amd64", "amd64:x86_64:athlon:i686:i586:i486:i386",
+ "geode", "geode:i586:i486:i386",
+ "ppc64iseries", "ppc64iseries:ppc64:ppc",
+ "ppc64pseries", "ppc64pseries:ppc64:ppc",
+#endif
0
};
if (arch)
{
int i;
-
/* convert arch to known policy */
for (i = 0; archpolicies[i]; i += 2)
if (!strcmp(archpolicies[i], arch))
- break;
- if (archpolicies[i])
- arch = archpolicies[i + 1];
- else
- arch = "";
+ {
+ arch = archpolicies[i + 1];
+ break;
+ }
}
pool_setarchpolicy(pool, arch);
}
Id *id2arch;
Id id, lastarch;
- pool->id2arch = sat_free(pool->id2arch);
- pool->id2color = sat_free(pool->id2color);
+ pool->id2arch = solv_free(pool->id2arch);
+ pool->id2color = solv_free(pool->id2color);
if (!arch)
{
pool->lastarch = 0;
return;
}
-#ifndef DEBIAN_SEMANTICS
- id = ARCH_NOARCH;
-#else
- id = ARCH_ALL;
-#endif
+ id = pool->noarchid;
lastarch = id + 255;
- id2arch = sat_calloc(lastarch + 1, sizeof(Id));
+ /* note that we overallocate one element to be compatible with
+ * old versions that accessed id2arch[lastarch].
+ * id2arch[lastarch] will always be zero */
+ id2arch = solv_calloc(lastarch + 1, sizeof(Id));
id2arch[id] = 1; /* the "noarch" class */
d = 0;
l = strcspn(arch, ":=>");
if (l)
{
- id = strn2id(pool, arch, l, 1);
- if (id > lastarch)
+ id = pool_strn2id(pool, arch, l, 1);
+ if (id >= lastarch)
{
- id2arch = sat_realloc2(id2arch, (id + 255 + 1), sizeof(Id));
+ id2arch = solv_realloc2(id2arch, (id + 255 + 1), sizeof(Id));
memset(id2arch + lastarch + 1, 0, (id + 255 - lastarch) * sizeof(Id));
lastarch = id + 255;
}
const char *s;
unsigned char color;
- if (arch > pool->lastarch)
+ if ((unsigned int)arch >= (unsigned int)pool->lastarch)
return ARCHCOLOR_ALL;
if (!pool->id2color)
- pool->id2color = sat_calloc(pool->lastarch + 1, 1);
- s = id2str(pool, arch);
- if (arch == ARCH_NOARCH || arch == ARCH_ALL)
+ pool->id2color = solv_calloc(pool->lastarch + 1, 1);
+ s = pool_id2str(pool, arch);
+ if (arch == ARCH_NOARCH || arch == ARCH_ALL || arch == ARCH_ANY)
color = ARCHCOLOR_ALL;
else if (!strcmp(s, "s390x") || strstr(s, "64"))
color = ARCHCOLOR_64;
else
color = ARCHCOLOR_32;
+ pool->id2color[arch] = color;
return color;
}