summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/db.c2
-rw-r--r--lib/libalpm/deps.c2
-rw-r--r--lib/libalpm/package.c32
-rw-r--r--lib/libalpm/package.h1
-rw-r--r--lib/libalpm/sync.c7
-rw-r--r--src/pacman/callback.c4
6 files changed, 39 insertions, 9 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index c06db3b1..307b9ef8 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -462,7 +462,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
if(strcmp(k->data, alpm_pkg_get_name(lpkg)) == 0) {
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
(char *)k->data, alpm_pkg_get_name(spkg));
- if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(lpkg))) {
+ if(_alpm_pkg_should_ignore(lpkg)) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index d8cb0d67..cefffe50 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -730,7 +730,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
* something we're not supposed to.
*/
int usedep = 1;
- if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(sync))) {
+ if(_alpm_pkg_should_ignore(sync)) {
pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
_alpm_pkg_free(dummypkg);
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 1e59938f..7c2870c2 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -755,7 +755,7 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
/* compare versions and see if we need to upgrade */
cmp = _alpm_versioncmp(alpm_pkg_get_version(pkg), alpm_pkg_get_version(local_pkg));
- if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) {
+ if(_alpm_pkg_should_ignore(pkg)) {
/* package should be ignored (IgnorePkg) */
if(cmp > 0) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)\n"),
@@ -1117,4 +1117,34 @@ int _alpm_pkg_istoonew(pmpkg_t *pkg)
time(&t);
return((pkg->date + handle->upgradedelay) > t);
}
+
+/** Test if a package should be ignored.
+ *
+ * Checks if the package is ignored via IgnorePkg, or if the package is
+ * in a group ignored via IgnoreGrp.
+ *
+ * @param pkg the package to test
+ *
+ * @return 1 if the package should be ignored, 0 otherwise
+ */
+int _alpm_pkg_should_ignore(pmpkg_t *pkg)
+{
+ alpm_list_t *groups = NULL;
+
+ /* first see if the package is ignored */
+ 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 = 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);
+ }
+ }
+
+ return(0);
+}
+
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index daaeb360..ab93fd86 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -99,6 +99,7 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full);
pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
int _alpm_pkg_istoonew(pmpkg_t *pkg);
void _alpm_pkg_update_requiredby(pmpkg_t *pkg);
+int _alpm_pkg_should_ignore(pmpkg_t *pkg);
#endif /* _ALPM_PACKAGE_H */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 7791e74c..10a72a7b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -118,8 +118,7 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
replacement, spkg->name);
/* ignore if EITHER the local or replacement package are to be ignored */
- if(alpm_list_find_str(handle->ignorepkg, spkg->name)
- || alpm_list_find_str(handle->ignorepkg, lpkg->name)) {
+ if(_alpm_pkg_should_ignore(spkg) || _alpm_pkg_should_ignore(lpkg)) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
@@ -217,7 +216,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
if(!_alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg))) {
/* If package is in the ignorepkg list, ask before we add it to
* the transaction */
- if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(local))) {
+ if(_alpm_pkg_should_ignore(local)) {
int resp = 0;
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
if(!resp) {
@@ -322,7 +321,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
if(alpm_pkg_compare_versions(local, spkg) == 0) {
/* spkg is NOT an upgrade, get confirmation before adding */
int resp = 0;
- if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(local))) {
+ if(_alpm_pkg_should_ignore(local)) {
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
if(!resp) {
return(0);
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index e935c870..90191aaf 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -274,12 +274,12 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
if(data2) {
/* TODO we take this route based on data2 being not null? WTF */
- snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg. Install anyway? [Y/n] "),
+ snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg/IgnoreGroup. Install anyway? [Y/n] "),
alpm_pkg_get_name(data1),
alpm_pkg_get_name(data2));
*response = yesno(str);
} else {
- snprintf(str, LOG_STR_LEN, _(":: %s is in IgnorePkg. Install anyway? [Y/n] "),
+ snprintf(str, LOG_STR_LEN, _(":: %s is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] "),
alpm_pkg_get_name(data1));
*response = yesno(str);
}