Add ALPM_PKG_REASON_UNKNOWN type
Return ALPM_PKG_REASON_UNKNOWN when parsing of %REASON% in the local database fails. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
6e6d3f18e3
commit
0649a66ee5
3 changed files with 5 additions and 3 deletions
|
@ -2293,7 +2293,9 @@ typedef enum _alpm_pkgreason_t {
|
||||||
/** Explicitly requested by the user. */
|
/** Explicitly requested by the user. */
|
||||||
ALPM_PKG_REASON_EXPLICIT = 0,
|
ALPM_PKG_REASON_EXPLICIT = 0,
|
||||||
/** Installed as a dependency for another package. */
|
/** Installed as a dependency for another package. */
|
||||||
ALPM_PKG_REASON_DEPEND = 1
|
ALPM_PKG_REASON_DEPEND = 1,
|
||||||
|
/** Failed parsing of local database */
|
||||||
|
ALPM_PKG_REASON_UNKNOWN = 2
|
||||||
} alpm_pkgreason_t;
|
} alpm_pkgreason_t;
|
||||||
|
|
||||||
/** Location a package object was loaded from. */
|
/** Location a package object was loaded from. */
|
||||||
|
|
|
@ -661,7 +661,7 @@ static alpm_pkgreason_t _read_pkgreason(alpm_handle_t *handle, const char *pkgna
|
||||||
return ALPM_PKG_REASON_DEPEND;
|
return ALPM_PKG_REASON_DEPEND;
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("unknown install reason for package %s: %s\n"), pkgname, line);
|
_alpm_log(handle, ALPM_LOG_ERROR, _("unknown install reason for package %s: %s\n"), pkgname, line);
|
||||||
return ALPM_PKG_REASON_EXPLICIT;
|
return ALPM_PKG_REASON_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ static void _alpm_select_depends(alpm_list_t **from, alpm_list_t **to,
|
||||||
for(i = *from; i; i = next) {
|
for(i = *from; i; i = next) {
|
||||||
alpm_pkg_t *deppkg = i->data;
|
alpm_pkg_t *deppkg = i->data;
|
||||||
next = i->next;
|
next = i->next;
|
||||||
if((explicit || alpm_pkg_get_reason(deppkg) != ALPM_PKG_REASON_EXPLICIT)
|
if((explicit || alpm_pkg_get_reason(deppkg) == ALPM_PKG_REASON_DEPEND)
|
||||||
&& _alpm_pkg_depends_on(pkg, deppkg)) {
|
&& _alpm_pkg_depends_on(pkg, deppkg)) {
|
||||||
*to = alpm_list_add(*to, deppkg);
|
*to = alpm_list_add(*to, deppkg);
|
||||||
*from = alpm_list_remove_item(*from, i);
|
*from = alpm_list_remove_item(*from, i);
|
||||||
|
|
Loading…
Add table
Reference in a new issue