summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-09 22:18:47 +0200
committerDan McGee <dan@archlinux.org>2011-06-14 15:38:51 +0200
commit0074cadb3bfdf5d89065e69eb93788ebcc9a6b58 (patch)
tree655fa20633729478be72bb9692101d7fe0e175a0
parentc206b3a6d503e57691664b94e68ba85760bd0b6c (diff)
downloadpacman-0074cadb3bfdf5d89065e69eb93788ebcc9a6b58.tar.gz
pacman-0074cadb3bfdf5d89065e69eb93788ebcc9a6b58.tar.xz
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>
-rw-r--r--lib/libalpm/deps.c4
-rw-r--r--lib/libalpm/package.c7
-rw-r--r--lib/libalpm/package.h2
-rw-r--r--lib/libalpm/sync.c14
4 files changed, 14 insertions, 13 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index db4130c3..2877640f 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -565,7 +565,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
for(i = dbs; i; i = i->next) {
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->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;
if(prompt) {
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;
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
!_alpm_pkg_find(excluding, pkg->name)) {
- if(_alpm_pkg_should_ignore(pkg)) {
+ if(_alpm_pkg_should_ignore(handle, pkg)) {
int install = 0;
if(prompt) {
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 969458ac..61194e91 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -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
* in a group ignored via IgnoreGrp.
*
+ * @param handle the context handle
* @param pkg the package to test
*
* @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;
/* 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;
}
/* 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);
if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) {
return 1;
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index b5d8f738..bc5b2671 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -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_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
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 */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 643d65e8..bd92992a 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -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",
lpkg->name, lpkg->version, spkg->version);
/* check IgnorePkg/IgnoreGroup */
- if(_alpm_pkg_should_ignore(spkg)
- || _alpm_pkg_should_ignore(lpkg)) {
+ if(_alpm_pkg_should_ignore(handle, spkg)
+ || _alpm_pkg_should_ignore(handle, lpkg)) {
_alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"),
lpkg->name, lpkg->version, spkg->version);
} else {
@@ -130,8 +130,8 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade)
} else if(cmp < 0) {
if(enable_downgrade) {
/* check IgnorePkg/IgnoreGroup */
- if(_alpm_pkg_should_ignore(spkg)
- || _alpm_pkg_should_ignore(lpkg)) {
+ if(_alpm_pkg_should_ignore(handle, spkg)
+ || _alpm_pkg_should_ignore(handle, lpkg)) {
_alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"),
lpkg->name, lpkg->version, spkg->version);
} 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)) {
found = 1;
/* check IgnorePkg/IgnoreGroup */
- if(_alpm_pkg_should_ignore(spkg)
- || _alpm_pkg_should_ignore(lpkg)) {
+ if(_alpm_pkg_should_ignore(handle, spkg)
+ || _alpm_pkg_should_ignore(handle, lpkg)) {
_alpm_log(handle, PM_LOG_WARNING, _("ignoring package replacement (%s-%s => %s-%s)\n"),
lpkg->name, lpkg->version, spkg->name, spkg->version);
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))) {
continue;
}
- if(_alpm_pkg_should_ignore(pkg)) {
+ if(_alpm_pkg_should_ignore(db->handle, pkg)) {
ignorelist = alpm_list_add(ignorelist, pkg);
int install = 0;
QUESTION(db->handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,