mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
Add handle argument to _alpm_pkg_should_ignore()
This allows callers to retrieve it from wherever is convenient, which may or may not be on the package object itself. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
c206b3a6d5
commit
0074cadb3b
@ -565,7 +565,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
|
|||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
||||||
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if(prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||||
@ -587,7 +587,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
|
|||||||
pmpkg_t *pkg = j->data;
|
pmpkg_t *pkg = j->data;
|
||||||
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
||||||
!_alpm_pkg_find(excluding, pkg->name)) {
|
!_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if(prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
|
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
|
||||||
|
@ -534,21 +534,22 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
|
|||||||
* Checks if the package is ignored via IgnorePkg, or if the package is
|
* Checks if the package is ignored via IgnorePkg, or if the package is
|
||||||
* in a group ignored via IgnoreGrp.
|
* in a group ignored via IgnoreGrp.
|
||||||
*
|
*
|
||||||
|
* @param handle the context handle
|
||||||
* @param pkg the package to test
|
* @param pkg the package to test
|
||||||
*
|
*
|
||||||
* @return 1 if the package should be ignored, 0 otherwise
|
* @return 1 if the package should be ignored, 0 otherwise
|
||||||
*/
|
*/
|
||||||
int _alpm_pkg_should_ignore(pmpkg_t *pkg)
|
int _alpm_pkg_should_ignore(pmhandle_t *handle, pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
alpm_list_t *groups = NULL;
|
alpm_list_t *groups = NULL;
|
||||||
|
|
||||||
/* first see if the package is ignored */
|
/* first see if the package is ignored */
|
||||||
if(alpm_list_find_str(pkg->handle->ignorepkg, alpm_pkg_get_name(pkg))) {
|
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* next see if the package is in a group that is ignored */
|
/* next see if the package is in a group that is ignored */
|
||||||
for(groups = pkg->handle->ignoregrp; groups; groups = alpm_list_next(groups)) {
|
for(groups = handle->ignoregrp; groups; groups = alpm_list_next(groups)) {
|
||||||
char *grp = (char *)alpm_list_getdata(groups);
|
char *grp = (char *)alpm_list_getdata(groups);
|
||||||
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
|
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -149,7 +149,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
|
|||||||
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
||||||
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
|
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
|
||||||
pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle);
|
pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle);
|
||||||
int _alpm_pkg_should_ignore(pmpkg_t *pkg);
|
int _alpm_pkg_should_ignore(pmhandle_t *handle, pmpkg_t *pkg);
|
||||||
|
|
||||||
#endif /* _ALPM_PACKAGE_H */
|
#endif /* _ALPM_PACKAGE_H */
|
||||||
|
|
||||||
|
@ -118,8 +118,8 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade)
|
|||||||
_alpm_log(handle, PM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n",
|
_alpm_log(handle, PM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n",
|
||||||
lpkg->name, lpkg->version, spkg->version);
|
lpkg->name, lpkg->version, spkg->version);
|
||||||
/* check IgnorePkg/IgnoreGroup */
|
/* check IgnorePkg/IgnoreGroup */
|
||||||
if(_alpm_pkg_should_ignore(spkg)
|
if(_alpm_pkg_should_ignore(handle, spkg)
|
||||||
|| _alpm_pkg_should_ignore(lpkg)) {
|
|| _alpm_pkg_should_ignore(handle, lpkg)) {
|
||||||
_alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"),
|
_alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"),
|
||||||
lpkg->name, lpkg->version, spkg->version);
|
lpkg->name, lpkg->version, spkg->version);
|
||||||
} else {
|
} else {
|
||||||
@ -130,8 +130,8 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade)
|
|||||||
} else if(cmp < 0) {
|
} else if(cmp < 0) {
|
||||||
if(enable_downgrade) {
|
if(enable_downgrade) {
|
||||||
/* check IgnorePkg/IgnoreGroup */
|
/* check IgnorePkg/IgnoreGroup */
|
||||||
if(_alpm_pkg_should_ignore(spkg)
|
if(_alpm_pkg_should_ignore(handle, spkg)
|
||||||
|| _alpm_pkg_should_ignore(lpkg)) {
|
|| _alpm_pkg_should_ignore(handle, lpkg)) {
|
||||||
_alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"),
|
_alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"),
|
||||||
lpkg->name, lpkg->version, spkg->version);
|
lpkg->name, lpkg->version, spkg->version);
|
||||||
} else {
|
} else {
|
||||||
@ -154,8 +154,8 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade)
|
|||||||
if(alpm_list_find_str(alpm_pkg_get_replaces(spkg), lpkg->name)) {
|
if(alpm_list_find_str(alpm_pkg_get_replaces(spkg), lpkg->name)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
/* check IgnorePkg/IgnoreGroup */
|
/* check IgnorePkg/IgnoreGroup */
|
||||||
if(_alpm_pkg_should_ignore(spkg)
|
if(_alpm_pkg_should_ignore(handle, spkg)
|
||||||
|| _alpm_pkg_should_ignore(lpkg)) {
|
|| _alpm_pkg_should_ignore(handle, lpkg)) {
|
||||||
_alpm_log(handle, PM_LOG_WARNING, _("ignoring package replacement (%s-%s => %s-%s)\n"),
|
_alpm_log(handle, PM_LOG_WARNING, _("ignoring package replacement (%s-%s => %s-%s)\n"),
|
||||||
lpkg->name, lpkg->version, spkg->name, spkg->version);
|
lpkg->name, lpkg->version, spkg->name, spkg->version);
|
||||||
continue;
|
continue;
|
||||||
@ -230,7 +230,7 @@ alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs,
|
|||||||
if(_alpm_pkg_find(ignorelist, alpm_pkg_get_name(pkg))) {
|
if(_alpm_pkg_find(ignorelist, alpm_pkg_get_name(pkg))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(db->handle, pkg)) {
|
||||||
ignorelist = alpm_list_add(ignorelist, pkg);
|
ignorelist = alpm_list_add(ignorelist, pkg);
|
||||||
int install = 0;
|
int install = 0;
|
||||||
QUESTION(db->handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
QUESTION(db->handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||||
|
Loading…
Reference in New Issue
Block a user