Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorNathan Jones <nathanj@insightbb.com>2007-11-09 20:13:29 -0500
committerDan McGee <dan@archlinux.org>2007-11-11 09:44:30 -0600
commit3312de65e642a7b6f2d853ce870910bddddf559d (patch)
tree0234d6c24de2a6ead032938c4cddec17e2a131eb /lib/libalpm
parent5c58b3d500d0971747af9a0c978ff6cfac668882 (diff)
Implement IgnoreGroup.
This option acts as if IgnorePkg was set on each package in the group. This closes FS#1592. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-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
5 files changed, 37 insertions, 7 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);