2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
11 * create architecture policies
23 const char *archpolicies[] = {
24 "x86_64", "x86_64:i686:i586:i486:i386",
25 "i686", "i686:i586:i486:i386",
26 "i586", "i586:i486:i386",
29 "s390x", "s390x:s390",
31 "ia64", "ia64:i686:i586:i486:i386",
34 "armv6l", "armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
35 "armv5tejl", "armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
36 "armv5tel", "armv5tel:armv5l:armv4tl:armv4l:armv3l",
37 "armv5l", "armv5l:armv4tl:armv4l:armv3l",
38 "armv4tl", "armv4tl:armv4l:armv3l",
39 "armv4l", "armv4l:armv3l",
44 "sparc64v", "sparc64v:sparc64:sparcv9v:sparcv9:sparcv8:sparc",
45 "sparc64", "sparc64:sparcv9:sparcv8:sparc",
46 "sparcv9v", "sparcv9v:sparcv9:sparcv8:sparc",
47 "sparcv9", "sparcv9:sparcv8:sparc",
48 "sparcv8", "sparcv8:sparc",
54 pool_setarch(Pool *pool, const char *arch)
57 unsigned int score = 0x10001;
64 pool->id2arch = sat_free(pool->id2arch);
65 pool->id2color = sat_free(pool->id2color);
71 #ifndef DEBIAN_SEMANTICS
77 id2arch = sat_calloc(lastarch + 1, sizeof(Id));
81 for (i = 0; archpolicies[i]; i += 2)
82 if (!strcmp(archpolicies[i], arch))
85 a = archpolicies[i + 1];
89 l = strcspn(a, ":=>");
92 id = strn2id(pool, a, l, 1);
95 id2arch = sat_realloc(id2arch, (id + 255 + 1) * sizeof(Id));
96 memset(id2arch + lastarch + 1, 0, (id + 255 - lastarch) * sizeof(Id));
112 pool->id2arch = id2arch;
113 pool->lastarch = lastarch;
117 pool_arch2color_slow(Pool *pool, Id arch)
122 if (arch > pool->lastarch)
123 return ARCHCOLOR_ALL;
125 pool->id2color = sat_calloc(pool->lastarch + 1, 1);
126 s = id2str(pool, arch);
127 if (arch == ARCH_NOARCH || arch == ARCH_ALL)
128 color = ARCHCOLOR_ALL;
129 else if (!strcmp(s, "s390x") || strstr(s, "64"))
130 color = ARCHCOLOR_64;
132 color = ARCHCOLOR_32;