summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-05-28 00:49:11 +0200
committerGuillem Jover <guillem@debian.org>2014-05-28 00:49:11 +0200
commitd3d70a975903a567c799b3f05f2cc4521a497dbf (patch)
tree16010ed1fe6b22f701a10dcaacea948efd2781f0
parent90d16af0604d35ca7d90921f5d59d685d3f2c560 (diff)
downloaddpkg-d3d70a975903a567c799b3f05f2cc4521a497dbf.tar.gz
libdpkg: Uppercase and namespace dpkg_arch_type enum values
-rw-r--r--dpkg-deb/build.c2
-rw-r--r--lib/dpkg/arch.c51
-rw-r--r--lib/dpkg/arch.h18
-rw-r--r--lib/dpkg/depcon.c11
-rw-r--r--lib/dpkg/dump.c4
-rw-r--r--lib/dpkg/fields.c8
-rw-r--r--lib/dpkg/parse.c16
-rw-r--r--lib/dpkg/pkg-db.c8
-rw-r--r--lib/dpkg/pkg-show.c6
-rw-r--r--lib/dpkg/pkg-spec.c15
-rw-r--r--lib/dpkg/pkg.c6
-rw-r--r--lib/dpkg/test/t-arch.c56
-rw-r--r--src/divertcmd.c4
-rw-r--r--src/enquiry.c10
-rw-r--r--src/main.c8
-rw-r--r--src/unpack.c11
16 files changed, 120 insertions, 114 deletions
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 5f62e5f39..71d06eb64 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -419,7 +419,7 @@ pkg_get_pathname(const char *dir, struct pkginfo *pkg)
const char *versionstring, *arch_sep;
versionstring = versiondescribe(&pkg->available.version, vdew_never);
- arch_sep = pkg->available.arch->type == arch_none ? "" : "_";
+ arch_sep = pkg->available.arch->type == DPKG_ARCH_NONE ? "" : "_";
m_asprintf(&path, "%s/%s_%s%s%s%s", dir, pkg->set->name, versionstring,
arch_sep, pkg->available.arch->name, DEBEXT);
diff --git a/lib/dpkg/arch.c b/lib/dpkg/arch.c
index 043d833f0..921eda629 100644
--- a/lib/dpkg/arch.c
+++ b/lib/dpkg/arch.c
@@ -4,7 +4,7 @@
*
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
- * Copyright © 2011-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,28 +80,28 @@ dpkg_arch_name_is_illegal(const char *name)
* structure to handle. */
static struct dpkg_arch arch_item_none = {
.name = "",
- .type = arch_none,
+ .type = DPKG_ARCH_NONE,
.next = NULL,
};
static struct dpkg_arch arch_item_empty = {
.name = "",
- .type = arch_empty,
+ .type = DPKG_ARCH_EMPTY,
.next = NULL,
};
static struct dpkg_arch arch_item_any = {
.name = "any",
- .type = arch_wildcard,
+ .type = DPKG_ARCH_WILDCARD,
.next = NULL,
};
static struct dpkg_arch arch_item_all = {
.name = "all",
- .type = arch_all,
+ .type = DPKG_ARCH_ALL,
.next = &arch_item_any,
};
static struct dpkg_arch arch_item_native = {
.name = ARCHITECTURE,
- .type = arch_native,
+ .type = DPKG_ARCH_NATIVE,
.next = &arch_item_all,
};
static struct dpkg_arch *arch_head = &arch_item_native;
@@ -149,9 +149,9 @@ dpkg_arch_find(const char *name)
}
if (dpkg_arch_name_is_illegal(name))
- type = arch_illegal;
+ type = DPKG_ARCH_ILLEGAL;
else
- type = arch_unknown;
+ type = DPKG_ARCH_UNKNOWN;
arch = dpkg_arch_new(name, type);
last_arch->next = arch;
@@ -169,19 +169,19 @@ struct dpkg_arch *
dpkg_arch_get(enum dpkg_arch_type type)
{
switch (type) {
- case arch_none:
+ case DPKG_ARCH_NONE:
return &arch_item_none;
- case arch_empty:
+ case DPKG_ARCH_EMPTY:
return &arch_item_empty;
- case arch_wildcard:
+ case DPKG_ARCH_WILDCARD:
return &arch_item_any;
- case arch_all:
+ case DPKG_ARCH_ALL:
return &arch_item_all;
- case arch_native:
+ case DPKG_ARCH_NATIVE:
return &arch_item_native;
- case arch_illegal:
- case arch_foreign:
- case arch_unknown:
+ case DPKG_ARCH_ILLEGAL:
+ case DPKG_ARCH_FOREIGN:
+ case DPKG_ARCH_UNKNOWN:
internerr("architecture type %d is not unique", type);
default:
/* Ignore unknown types for forward-compatibility. */
@@ -217,9 +217,9 @@ dpkg_arch_reset_list(void)
void
varbuf_add_archqual(struct varbuf *vb, const struct dpkg_arch *arch)
{
- if (arch->type == arch_none)
+ if (arch->type == DPKG_ARCH_NONE)
return;
- if (arch->type == arch_empty)
+ if (arch->type == DPKG_ARCH_EMPTY)
return;
varbuf_add_char(vb, ':');
@@ -232,9 +232,9 @@ varbuf_add_archqual(struct varbuf *vb, const struct dpkg_arch *arch)
const char *
dpkg_arch_describe(const struct dpkg_arch *arch)
{
- if (arch->type == arch_none)
+ if (arch->type == DPKG_ARCH_NONE)
return C_("architecture", "<none>");
- if (arch->type == arch_empty)
+ if (arch->type == DPKG_ARCH_EMPTY)
return C_("architecture", "<empty>");
return arch->name;
@@ -249,8 +249,8 @@ dpkg_arch_add(const char *name)
struct dpkg_arch *arch;
arch = dpkg_arch_find(name);
- if (arch->type == arch_unknown) {
- arch->type = arch_foreign;
+ if (arch->type == DPKG_ARCH_UNKNOWN) {
+ arch->type = DPKG_ARCH_FOREIGN;
arch_list_dirty = true;
}
@@ -266,11 +266,11 @@ dpkg_arch_unmark(struct dpkg_arch *arch_remove)
struct dpkg_arch *arch;
for (arch = arch_builtin_tail->next; arch; arch = arch->next) {
- if (arch->type != arch_foreign)
+ if (arch->type != DPKG_ARCH_FOREIGN)
continue;
if (arch == arch_remove) {
- arch->type = arch_unknown;
+ arch->type = DPKG_ARCH_UNKNOWN;
arch_list_dirty = true;
return;
}
@@ -320,7 +320,8 @@ dpkg_arch_save_list(void)
atomic_file_open(file);
for (arch = arch_head; arch; arch = arch->next) {
- if (arch->type != arch_foreign && arch->type != arch_native)
+ if (arch->type != DPKG_ARCH_FOREIGN &&
+ arch->type != DPKG_ARCH_NATIVE)
continue;
if (fprintf(file->fp, "%s\n", arch->name) < 0)
diff --git a/lib/dpkg/arch.h b/lib/dpkg/arch.h
index 21d2fa5a6..499c5607d 100644
--- a/lib/dpkg/arch.h
+++ b/lib/dpkg/arch.h
@@ -4,7 +4,7 @@
*
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
- * Copyright © 2011-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,14 +35,14 @@ DPKG_BEGIN_DECLS
*/
enum dpkg_arch_type {
- arch_none,
- arch_empty,
- arch_illegal,
- arch_wildcard,
- arch_all,
- arch_native,
- arch_foreign,
- arch_unknown,
+ DPKG_ARCH_NONE,
+ DPKG_ARCH_EMPTY,
+ DPKG_ARCH_ILLEGAL,
+ DPKG_ARCH_WILDCARD,
+ DPKG_ARCH_ALL,
+ DPKG_ARCH_NATIVE,
+ DPKG_ARCH_FOREIGN,
+ DPKG_ARCH_UNKNOWN,
};
struct dpkg_arch {
diff --git a/lib/dpkg/depcon.c b/lib/dpkg/depcon.c
index 812303e74..2d181d6f5 100644
--- a/lib/dpkg/depcon.c
+++ b/lib/dpkg/depcon.c
@@ -3,6 +3,7 @@
* depcon.c - dependency and conflict checking
*
* Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
+ * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
* Copyright © 2009 Canonical Ltd.
*
* This is free software; you can redistribute it and/or modify
@@ -61,7 +62,7 @@ deparchsatisfied(struct pkgbin *it, const struct dpkg_arch *it_arch,
return true;
dep_arch = against->arch;
- if (dep_arch->type == arch_wildcard &&
+ if (dep_arch->type == DPKG_ARCH_WILDCARD &&
(it->multiarch == multiarch_allowed ||
against->up->type == dep_conflicts ||
against->up->type == dep_replaces ||
@@ -69,10 +70,10 @@ deparchsatisfied(struct pkgbin *it, const struct dpkg_arch *it_arch,
return true;
pkg_arch = it_arch;
- if (dep_arch->type == arch_none || dep_arch->type == arch_all)
- dep_arch = dpkg_arch_get(arch_native);
- if (pkg_arch->type == arch_none || pkg_arch->type == arch_all)
- pkg_arch = dpkg_arch_get(arch_native);
+ if (dep_arch->type == DPKG_ARCH_NONE || dep_arch->type == DPKG_ARCH_ALL)
+ dep_arch = dpkg_arch_get(DPKG_ARCH_NATIVE);
+ if (pkg_arch->type == DPKG_ARCH_NONE || pkg_arch->type == DPKG_ARCH_ALL)
+ pkg_arch = dpkg_arch_get(DPKG_ARCH_NATIVE);
return (dep_arch == pkg_arch);
}
diff --git a/lib/dpkg/dump.c b/lib/dpkg/dump.c
index 0ea7d3427..d64f01c1e 100644
--- a/lib/dpkg/dump.c
+++ b/lib/dpkg/dump.c
@@ -212,9 +212,9 @@ w_architecture(struct varbuf *vb,
{
if (!pkgbin->arch)
return;
- if (pkgbin->arch->type == arch_none)
+ if (pkgbin->arch->type == DPKG_ARCH_NONE)
return;
- if (pkgbin->arch->type == arch_empty)
+ if (pkgbin->arch->type == DPKG_ARCH_EMPTY)
return;
if (flags & fw_printheader)
diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index 992daa111..9ad0fe85c 100644
--- a/lib/dpkg/fields.c
+++ b/lib/dpkg/fields.c
@@ -4,7 +4,7 @@
*
* Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
* Copyright © 2001 Wichert Akkerman
- * Copyright © 2006-2013 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006-2014 Guillem Jover <guillem@debian.org>
* Copyright © 2009 Canonical Ltd.
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
@@ -185,7 +185,7 @@ f_architecture(struct pkginfo *pkg, struct pkgbin *pkgbin,
const char *value, const struct fieldinfo *fip)
{
pkgbin->arch = dpkg_arch_find(value);
- if (pkgbin->arch->type == arch_illegal)
+ if (pkgbin->arch->type == DPKG_ARCH_ILLEGAL)
parse_warn(ps, _("'%s' is not a valid architecture name: %s"),
value, dpkg_arch_name_is_illegal(value));
}
@@ -451,7 +451,7 @@ f_dependency(struct pkginfo *pkg, struct pkgbin *pkgbin,
dop->arch_is_implicit = false;
dop->arch = dpkg_arch_find(arch.buf);
- if (dop->arch->type == arch_illegal)
+ if (dop->arch->type == DPKG_ARCH_ILLEGAL)
emsg = dpkg_arch_name_is_illegal(arch.buf);
if (emsg)
parse_error(ps, _("'%s' field, reference to '%.255s': "
@@ -461,7 +461,7 @@ f_dependency(struct pkginfo *pkg, struct pkgbin *pkgbin,
fip->integer == dep_replaces) {
/* Conflics/Breaks/Replaces get an implicit "any" arch qualifier. */
dop->arch_is_implicit = true;
- dop->arch = dpkg_arch_get(arch_wildcard);
+ dop->arch = dpkg_arch_get(DPKG_ARCH_WILDCARD);
} else {
/* Otherwise use the pkgbin architecture, which will be assigned to
* later on by parse.c, once we can guarantee we have parsed it from
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 62cc591f2..72b7c6cf8 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -198,20 +198,22 @@ pkg_parse_verify(struct parsedb_state *ps,
/* We always want usable architecture information (as long as the package
* is in such a state that it make sense), so that it can be used safely
* on string comparisons and the like. */
- if (pkgbin->arch->type == arch_none)
+ if (pkgbin->arch->type == DPKG_ARCH_NONE)
parse_warn(ps, _("missing %s"), "architecture");
- else if (pkgbin->arch->type == arch_empty)
+ else if (pkgbin->arch->type == DPKG_ARCH_EMPTY)
parse_warn(ps, _("empty value for %s"), "architecture");
}
/* Mark missing architectures as empty, to distinguish these from
* unused slots in the db. */
- if (pkgbin->arch->type == arch_none)
- pkgbin->arch = dpkg_arch_get(arch_empty);
+ if (pkgbin->arch->type == DPKG_ARCH_NONE)
+ pkgbin->arch = dpkg_arch_get(DPKG_ARCH_EMPTY);
- if (pkgbin->arch->type == arch_empty && pkgbin->multiarch == multiarch_same)
+ if (pkgbin->arch->type == DPKG_ARCH_EMPTY &&
+ pkgbin->multiarch == multiarch_same)
parse_error(ps, _("package has field '%s' but is missing architecture"),
"Multi-Arch: same");
- if (pkgbin->arch->type == arch_all && pkgbin->multiarch == multiarch_same)
+ if (pkgbin->arch->type == DPKG_ARCH_ALL &&
+ pkgbin->multiarch == multiarch_same)
parse_error(ps, _("package has field '%s' but is architecture all"),
"Multi-Arch: same");
@@ -291,7 +293,7 @@ pkg_parse_verify(struct parsedb_state *ps,
pkg->status == stat_notinstalled &&
pkg->eflag == eflag_ok &&
pkg->want == want_install &&
- pkgbin->arch->type == arch_empty)
+ pkgbin->arch->type == DPKG_ARCH_EMPTY)
pkg->want = want_unknown;
}
diff --git a/lib/dpkg/pkg-db.c b/lib/dpkg/pkg-db.c
index 4adef7d59..724e93024 100644
--- a/lib/dpkg/pkg-db.c
+++ b/lib/dpkg/pkg-db.c
@@ -3,7 +3,7 @@
* pkg-db.c - low level package database routines (hash tables, etc.)
*
* Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2008-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
*
@@ -129,7 +129,7 @@ pkg_db_get_singleton(struct pkgset *set)
for (pkg = &set->pkg; pkg; pkg = pkg->arch_next) {
const struct dpkg_arch *arch = pkg->available.arch;
- if (arch->type == arch_native || arch->type == arch_all)
+ if (arch->type == DPKG_ARCH_NATIVE || arch->type == DPKG_ARCH_ALL)
return pkg;
}
/* Or failing that, the first entry. */
@@ -186,12 +186,12 @@ pkg_db_get_pkg(struct pkgset *set, const struct dpkg_arch *arch)
struct pkginfo *pkg, **pkgp;
assert(arch);
- assert(arch->type != arch_none);
+ assert(arch->type != DPKG_ARCH_NONE);
pkg = &set->pkg;
/* If there's a single unused slot, let's use that. */
- if (pkg->installed.arch->type == arch_none && pkg->arch_next == NULL) {
+ if (pkg->installed.arch->type == DPKG_ARCH_NONE && pkg->arch_next == NULL) {
pkg->installed.arch = arch;
pkg->available.arch = arch;
return pkg;
diff --git a/lib/dpkg/pkg-show.c b/lib/dpkg/pkg-show.c
index 1b1170a62..bae8dad05 100644
--- a/lib/dpkg/pkg-show.c
+++ b/lib/dpkg/pkg-show.c
@@ -37,9 +37,9 @@ pkgbin_name_needs_arch(const struct pkgbin *pkgbin,
case pnaw_never:
break;
case pnaw_foreign:
- if (pkgbin->arch->type == arch_native ||
- pkgbin->arch->type == arch_all ||
- pkgbin->arch->type == arch_none)
+ if (pkgbin->arch->type == DPKG_ARCH_NATIVE ||
+ pkgbin->arch->type == DPKG_ARCH_ALL ||
+ pkgbin->arch->type == DPKG_ARCH_NONE)
break;
return true;
case pnaw_nonambig:
diff --git a/lib/dpkg/pkg-spec.c b/lib/dpkg/pkg-spec.c
index 5d8666ce9..d5cc036ea 100644
--- a/lib/dpkg/pkg-spec.c
+++ b/lib/dpkg/pkg-spec.c
@@ -4,7 +4,7 @@
*
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
- * Copyright © 2011-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,13 +69,14 @@ pkg_spec_is_illegal(struct pkg_spec *ps)
(emsg = pkg_name_is_illegal(ps->name))) {
snprintf(msg, sizeof(msg),
_("illegal package name in specifier '%s%s%s': %s"),
- ps->name, (ps->arch->type != arch_none) ? ":" : "",
+ ps->name,
+ (ps->arch->type != DPKG_ARCH_NONE) ? ":" : "",
ps->arch->name, emsg);
return msg;
}
- if ((!ps->arch_is_pattern && ps->arch->type == arch_illegal) ||
- ps->arch->type == arch_empty) {
+ if ((!ps->arch_is_pattern && ps->arch->type == DPKG_ARCH_ILLEGAL) ||
+ ps->arch->type == DPKG_ARCH_EMPTY) {
emsg = dpkg_arch_name_is_illegal(ps->arch->name);
snprintf(msg, sizeof(msg),
_("illegal architecture name in specifier '%s:%s': %s"),
@@ -91,7 +92,7 @@ pkg_spec_is_illegal(struct pkg_spec *ps)
set = pkg_db_find_set(ps->name);
/* Single instancing only applies with no architecture. */
- if (ps->arch->type == arch_none &&
+ if (ps->arch->type == DPKG_ARCH_NONE &&
pkgset_installed_instances(set) > 1) {
snprintf(msg, sizeof(msg),
_("ambiguous package name '%s' with more "
@@ -159,7 +160,7 @@ pkg_spec_match_arch(struct pkg_spec *ps, struct pkginfo *pkg,
{
if (ps->arch_is_pattern)
return (fnmatch(ps->arch->name, arch->name, 0) == 0);
- else if (ps->arch->type != arch_none) /* !arch_is_pattern */
+ else if (ps->arch->type != DPKG_ARCH_NONE) /* !arch_is_pattern */
return (ps->arch == arch);
/* No arch specified. */
@@ -185,7 +186,7 @@ pkg_spec_match_pkg(struct pkg_spec *ps, struct pkginfo *pkg,
static struct pkginfo *
pkg_spec_get_pkg(struct pkg_spec *ps)
{
- if (ps->arch->type == arch_none)
+ if (ps->arch->type == DPKG_ARCH_NONE)
return pkg_db_find_singleton(ps->name);
else
return pkg_db_find_pkg(ps->name, ps->arch);
diff --git a/lib/dpkg/pkg.c b/lib/dpkg/pkg.c
index a0becd2c1..45103ecad 100644
--- a/lib/dpkg/pkg.c
+++ b/lib/dpkg/pkg.c
@@ -3,7 +3,7 @@
* pkg.c - primitives for pkg handling
*
* Copyright © 1995, 1996 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2009-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2009-2014 Guillem Jover <guillem@debian.org>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -131,9 +131,9 @@ pkg_blank(struct pkginfo *pkg)
/* The architectures are reset here (instead of in pkgbin_blank),
* because they are part of the package specification, and needed
* for selections. */
- pkg->installed.arch = dpkg_arch_get(arch_none);
+ pkg->installed.arch = dpkg_arch_get(DPKG_ARCH_NONE);
pkg->installed.multiarch = multiarch_no;
- pkg->available.arch = dpkg_arch_get(arch_none);
+ pkg->available.arch = dpkg_arch_get(DPKG_ARCH_NONE);
pkg->available.multiarch = multiarch_no;
}
diff --git a/lib/dpkg/test/t-arch.c b/lib/dpkg/test/t-arch.c
index f9501abfb..6078be444 100644
--- a/lib/dpkg/test/t-arch.c
+++ b/lib/dpkg/test/t-arch.c
@@ -4,7 +4,7 @@
*
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
- * Copyright © 2011-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -82,25 +82,25 @@ test_dpkg_arch_find(void)
/* Test existence and initial values of default architectures. */
arch = dpkg_arch_find("all");
- test_pass(arch->type == arch_all);
- test_pass(dpkg_arch_get(arch_all) == arch);
+ test_pass(arch->type == DPKG_ARCH_ALL);
+ test_pass(dpkg_arch_get(DPKG_ARCH_ALL) == arch);
arch = dpkg_arch_find(ARCHITECTURE);
- test_pass(arch->type == arch_native);
- test_pass(dpkg_arch_get(arch_native) == arch);
+ test_pass(arch->type == DPKG_ARCH_NATIVE);
+ test_pass(dpkg_arch_get(DPKG_ARCH_NATIVE) == arch);
arch = dpkg_arch_find("any");
- test_pass(arch->type == arch_wildcard);
- test_pass(dpkg_arch_get(arch_wildcard) == arch);
+ test_pass(arch->type == DPKG_ARCH_WILDCARD);
+ test_pass(dpkg_arch_get(DPKG_ARCH_WILDCARD) == arch);
/* Test missing architecture. */
arch = dpkg_arch_find(NULL);
- test_pass(arch->type == arch_none);
- test_pass(dpkg_arch_get(arch_none) == arch);
+ test_pass(arch->type == DPKG_ARCH_NONE);
+ test_pass(dpkg_arch_get(DPKG_ARCH_NONE) == arch);
test_str(arch->name, ==, "");
/* Test empty architectures. */
arch = dpkg_arch_find("");
- test_pass(arch->type == arch_empty);
- test_pass(dpkg_arch_get(arch_empty) == arch);
+ test_pass(arch->type == DPKG_ARCH_EMPTY);
+ test_pass(dpkg_arch_get(DPKG_ARCH_EMPTY) == arch);
test_str(arch->name, ==, "");
/* Test for an unknown type. */
@@ -108,12 +108,12 @@ test_dpkg_arch_find(void)
/* New valid architectures are marked unknown. */
arch = dpkg_arch_find("foobar");
- test_pass(arch->type == arch_unknown);
+ test_pass(arch->type == DPKG_ARCH_UNKNOWN);
test_str(arch->name, ==, "foobar");
/* New illegal architectures are marked illegal. */
arch = dpkg_arch_find("a:b");
- test_pass(arch->type == arch_illegal);
+ test_pass(arch->type == DPKG_ARCH_ILLEGAL);
test_str(arch->name, ==, "a:b");
}
@@ -134,32 +134,32 @@ test_dpkg_arch_modify(void)
/* Insert a new unknown arch. */
arch = dpkg_arch_find("foo");
- test_pass(arch->type == arch_unknown);
+ test_pass(arch->type == DPKG_ARCH_UNKNOWN);
test_str(arch->name, ==, "foo");
/* Check that existing unknown arch gets tagged. */
arch = dpkg_arch_add("foo");
- test_pass(arch->type == arch_foreign);
+ test_pass(arch->type == DPKG_ARCH_FOREIGN);
test_str(arch->name, ==, "foo");
/* Check that new unknown arch gets tagged. */
arch = dpkg_arch_add("quux");
- test_pass(arch->type == arch_foreign);
+ test_pass(arch->type == DPKG_ARCH_FOREIGN);
test_str(arch->name, ==, "quux");
/* Unmark foreign architectures. */
arch = dpkg_arch_find("foo");
dpkg_arch_unmark(arch);
- test_pass(arch->type == arch_unknown);
+ test_pass(arch->type == DPKG_ARCH_UNKNOWN);
arch = dpkg_arch_find("bar");
dpkg_arch_unmark(arch);
- test_pass(arch->type == arch_unknown);
+ test_pass(arch->type == DPKG_ARCH_UNKNOWN);
arch = dpkg_arch_find("quux");
dpkg_arch_unmark(arch);
- test_pass(arch->type == arch_unknown);
+ test_pass(arch->type == DPKG_ARCH_UNKNOWN);
}
static void
@@ -167,22 +167,22 @@ test_dpkg_arch_varbuf_archqual(void)
{
struct varbuf vb = VARBUF_INIT;
- varbuf_add_archqual(&vb, dpkg_arch_get(arch_none));
+ varbuf_add_archqual(&vb, dpkg_arch_get(DPKG_ARCH_NONE));
varbuf_end_str(&vb);
test_str(vb.buf, ==, "");
varbuf_reset(&vb);
- varbuf_add_archqual(&vb, dpkg_arch_get(arch_empty));
+ varbuf_add_archqual(&vb, dpkg_arch_get(DPKG_ARCH_EMPTY));
varbuf_end_str(&vb);
test_str(vb.buf, ==, "");
varbuf_reset(&vb);
- varbuf_add_archqual(&vb, dpkg_arch_get(arch_all));
+ varbuf_add_archqual(&vb, dpkg_arch_get(DPKG_ARCH_ALL));
varbuf_end_str(&vb);
test_str(vb.buf, ==, ":all");
varbuf_reset(&vb);
- varbuf_add_archqual(&vb, dpkg_arch_get(arch_wildcard));
+ varbuf_add_archqual(&vb, dpkg_arch_get(DPKG_ARCH_WILDCARD));
varbuf_end_str(&vb);
test_str(vb.buf, ==, ":any");
varbuf_reset(&vb);
@@ -193,19 +193,19 @@ test_dpkg_arch_describe(void)
{
struct dpkg_arch *arch;
- arch = dpkg_arch_get(arch_none);
+ arch = dpkg_arch_get(DPKG_ARCH_NONE);
test_str(dpkg_arch_describe(arch), ==, "<none>");
- arch = dpkg_arch_get(arch_empty);
+ arch = dpkg_arch_get(DPKG_ARCH_EMPTY);
test_str(dpkg_arch_describe(arch), ==, "<empty>");
- arch = dpkg_arch_get(arch_all);
+ arch = dpkg_arch_get(DPKG_ARCH_ALL);
test_str(dpkg_arch_describe(arch), ==, "all");
- arch = dpkg_arch_get(arch_wildcard);
+ arch = dpkg_arch_get(DPKG_ARCH_WILDCARD);
test_str(dpkg_arch_describe(arch), ==, "any");
- arch = dpkg_arch_get(arch_native);
+ arch = dpkg_arch_get(DPKG_ARCH_NATIVE);
test_str(dpkg_arch_describe(arch), ==, ARCHITECTURE);
}
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 0acb2e14b..f4a268c89 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -3,7 +3,7 @@
*
* Copyright © 1995 Ian Jackson
* Copyright © 2000, 2001 Wichert Akkerman
- * Copyright © 2006-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006-2014 Guillem Jover <guillem@debian.org>
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
*
@@ -528,7 +528,7 @@ diversion_is_shared(struct pkgset *set, struct filenamenode *namenode)
archname = getenv("DPKG_MAINTSCRIPT_ARCH");
arch = dpkg_arch_find(archname);
- if (arch->type == arch_none || arch->type == arch_empty)
+ if (arch->type == DPKG_ARCH_NONE || arch->type == DPKG_ARCH_EMPTY)
return false;
for (pkg = &set->pkg; pkg; pkg = pkg->arch_next)
diff --git a/src/enquiry.c b/src/enquiry.c
index d8369c56a..b157bafb7 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -143,15 +143,15 @@ static const struct audit_problem audit_problems[] = {
"database, they need to be reinstalled:\n")
}, {
.check = audit_arch,
- .value.number = arch_none,
+ .value.number = DPKG_ARCH_NONE,
.explanation = N_("The following packages do not have an architecture:\n")
}, {
.check = audit_arch,
- .value.number = arch_illegal,
+ .value.number = DPKG_ARCH_ILLEGAL,
.explanation = N_("The following packages have an illegal architecture:\n")
}, {
.check = audit_arch,
- .value.number = arch_unknown,
+ .value.number = DPKG_ARCH_UNKNOWN,
.explanation = N_(
"The following packages have an unknown foreign architecture, which will\n"
"cause dependency issues on front-ends. This can be fixed by registering\n"
@@ -552,7 +552,7 @@ printarch(const char *const *argv)
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- printf("%s\n", dpkg_arch_get(arch_native)->name);
+ printf("%s\n", dpkg_arch_get(DPKG_ARCH_NATIVE)->name);
m_output(stdout, _("<standard output>"));
@@ -578,7 +578,7 @@ print_foreign_arches(const char *const *argv)
dpkg_arch_load_list();
for (arch = dpkg_arch_get_list(); arch; arch = arch->next) {
- if (arch->type != arch_foreign)
+ if (arch->type != DPKG_ARCH_FOREIGN)
continue;
printf("%s\n", arch->name);
diff --git a/src/main.c b/src/main.c
index 82dd64d9f..48ede3598 100644
--- a/src/main.c
+++ b/src/main.c
@@ -505,10 +505,10 @@ arch_add(const char *const *argv)
arch = dpkg_arch_add(archname);
switch (arch->type) {
- case arch_native:
- case arch_foreign:
+ case DPKG_ARCH_NATIVE:
+ case DPKG_ARCH_FOREIGN:
break;
- case arch_illegal:
+ case DPKG_ARCH_ILLEGAL:
ohshit(_("architecture '%s' is illegal: %s"), archname,
dpkg_arch_name_is_illegal(archname));
default:
@@ -534,7 +534,7 @@ arch_remove(const char *const *argv)
modstatdb_open(msdbrw_readonly);
arch = dpkg_arch_find(archname);
- if (arch->type != arch_foreign) {
+ if (arch->type != DPKG_ARCH_FOREIGN) {
warning(_("cannot remove non-foreign architecture '%s'"), arch->name);
return 0;
}
diff --git a/src/unpack.c b/src/unpack.c
index eb9d5fd1a..07f0d0d24 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -3,7 +3,7 @@
* unpack.c - the huge function process_archive
*
* Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2006-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006-2014 Guillem Jover <guillem@debian.org>
* Copyright © 2011 Linaro Limited
* Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
*
@@ -506,12 +506,13 @@ void process_archive(const char *filename) {
return;
}
- if (pkg->available.arch->type != arch_all &&
- pkg->available.arch->type != arch_native &&
- pkg->available.arch->type != arch_foreign)
+ if (pkg->available.arch->type != DPKG_ARCH_ALL &&
+ pkg->available.arch->type != DPKG_ARCH_NATIVE &&
+ pkg->available.arch->type != DPKG_ARCH_FOREIGN)
forcibleerr(fc_architecture,
_("package architecture (%s) does not match system (%s)"),
- pkg->available.arch->name, dpkg_arch_get(arch_native)->name);
+ pkg->available.arch->name,
+ dpkg_arch_get(DPKG_ARCH_NATIVE)->name);
clear_deconfigure_queue();
clear_istobes();