diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-12-20 22:49:21 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-12-20 22:49:21 (EST) |
commit | cdeb4ec7a68b9a9f240d19b525849c77118c0ff0 (patch) | |
tree | de473039908c2da11b2d632818464861451be556 /libopkg/pkg_parse.c | |
parent | ec5a26e8047307658a0b78ffaa65f9d2daedd7b0 (diff) |
Set the arch_priority when parsing the Architecture.
git-svn-id: http://opkg.googlecode.com/svn/trunk@507 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg_parse.c')
-rw-r--r-- | libopkg/pkg_parse.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c index 6c9c7ee..f1725de 100644 --- a/libopkg/pkg_parse.c +++ b/libopkg/pkg_parse.c @@ -149,6 +149,19 @@ parse_version(pkg_t *pkg, const char *vstr) } static int +get_arch_priority(const char *arch) +{ + nv_pair_list_elt_t *l; + + list_for_each_entry(l , &conf->arch_list.head, node) { + nv_pair_t *nv = (nv_pair_t *)l->data; + if (strcmp(nv->name, arch) == 0) + return strtol(nv->value, NULL, 0); + } + return 0; +} + +static int pkg_parse_line(pkg_t *pkg, const char *line, uint mask) { /* these flags are a bit hackish... */ @@ -163,9 +176,10 @@ pkg_parse_line(pkg_t *pkg, const char *line, uint mask) switch (*line) { case 'A': - if ((mask & PFM_ARCHITECTURE ) && is_field("Architecture", line)) + if ((mask & PFM_ARCHITECTURE ) && is_field("Architecture", line)) { pkg->architecture = parse_simple("Architecture", line); - else if ((mask & PFM_AUTO_INSTALLED) && is_field("Auto-Installed", line)) { + pkg->arch_priority = get_arch_priority(pkg->architecture); + } else if ((mask & PFM_AUTO_INSTALLED) && is_field("Auto-Installed", line)) { char *tmp = parse_simple("Auto-Installed", line); if (strcmp(tmp, "yes") == 0) pkg->auto_installed = 1; |