Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2013-10-16 12:23:11 +1000
committerAllan McRae <allan@archlinux.org>2013-10-31 16:20:02 +1000
commit23923200c3e34563c8124a1b098bc0866f4e92e5 (patch)
treeef9d697b9e0cd1e0d2bd1365cb5f844a8eea02d1 /lib/libalpm
parentd4ba5bdda6595db83babbac1c59fac129fcaff24 (diff)
Expose alpm_pkg_should_ignore
This function is useful for frontends to annotate package upgrades that will be ignored. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.h9
-rw-r--r--lib/libalpm/deps.c4
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/package.h1
-rw-r--r--lib/libalpm/sync.c14
5 files changed, 19 insertions, 11 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 29b9f378..2c8c1e61 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -793,6 +793,15 @@ alpm_list_t *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg);
*/
alpm_list_t *alpm_pkg_compute_optionalfor(alpm_pkg_t *pkg);
+/** 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 IgnoreGroup.
+ * @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(alpm_handle_t *handle, alpm_pkg_t *pkg);
+
/** @name Package Property Accessors
* Any pointer returned by these functions points to internal structures
* allocated by libalpm. They should not be freed nor modified in any
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 745eac17..cf7605ee 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -664,7 +664,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
pkg = _alpm_db_get_pkgfromcache(db, dep->name);
if(pkg && _alpm_depcmp_literal(pkg, dep)
&& !alpm_pkg_find(excluding, pkg->name)) {
- if(_alpm_pkg_should_ignore(handle, pkg)) {
+ if(alpm_pkg_should_ignore(handle, pkg)) {
int install = 0;
if(prompt) {
QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG, pkg,
@@ -693,7 +693,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
* possibly be the same string */
if(pkg->name_hash != dep->name_hash && _alpm_depcmp(pkg, dep)
&& !alpm_pkg_find(excluding, pkg->name)) {
- if(_alpm_pkg_should_ignore(handle, pkg)) {
+ if(alpm_pkg_should_ignore(handle, pkg)) {
int install = 0;
if(prompt) {
QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG,
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index cfdbb3f8..1294f8ef 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -753,7 +753,7 @@ alpm_pkg_t SYMEXPORT *alpm_pkg_find(alpm_list_t *haystack, const char *needle)
*
* @return 1 if the package should be ignored, 0 otherwise
*/
-int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg)
+int SYMEXPORT alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg)
{
alpm_list_t *groups = NULL;
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index b7c33581..07b043cf 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -148,7 +148,6 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
int _alpm_pkg_cmp(const void *p1, const void *p2);
int _alpm_pkg_compare_versions(alpm_pkg_t *local_pkg, alpm_pkg_t *pkg);
-int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
#endif /* _ALPM_PACKAGE_H */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index a4b1bb89..066f1f22 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -93,8 +93,8 @@ static int check_literal(alpm_handle_t *handle, alpm_pkg_t *lpkg,
_alpm_log(handle, ALPM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n",
lpkg->name, lpkg->version, spkg->version);
/* check IgnorePkg/IgnoreGroup */
- if(_alpm_pkg_should_ignore(handle, spkg)
- || _alpm_pkg_should_ignore(handle, lpkg)) {
+ if(alpm_pkg_should_ignore(handle, spkg)
+ || alpm_pkg_should_ignore(handle, lpkg)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"),
lpkg->name, lpkg->version, spkg->version);
} else {
@@ -105,8 +105,8 @@ static int check_literal(alpm_handle_t *handle, alpm_pkg_t *lpkg,
} else if(cmp < 0) {
if(enable_downgrade) {
/* check IgnorePkg/IgnoreGroup */
- if(_alpm_pkg_should_ignore(handle, spkg)
- || _alpm_pkg_should_ignore(handle, lpkg)) {
+ if(alpm_pkg_should_ignore(handle, spkg)
+ || alpm_pkg_should_ignore(handle, lpkg)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"),
lpkg->name, lpkg->version, spkg->version);
} else {
@@ -148,8 +148,8 @@ static alpm_list_t *check_replacers(alpm_handle_t *handle, alpm_pkg_t *lpkg,
int doreplace = 0;
alpm_pkg_t *tpkg;
/* check IgnorePkg/IgnoreGroup */
- if(_alpm_pkg_should_ignore(handle, spkg)
- || _alpm_pkg_should_ignore(handle, lpkg)) {
+ if(alpm_pkg_should_ignore(handle, spkg)
+ || alpm_pkg_should_ignore(handle, lpkg)) {
_alpm_log(handle, ALPM_LOG_WARNING,
_("ignoring package replacement (%s-%s => %s-%s)\n"),
lpkg->name, lpkg->version, spkg->name, spkg->version);
@@ -270,7 +270,7 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
if(alpm_pkg_find(ignorelist, pkg->name)) {
continue;
}
- if(_alpm_pkg_should_ignore(db->handle, pkg)) {
+ if(alpm_pkg_should_ignore(db->handle, pkg)) {
ignorelist = alpm_list_add(ignorelist, pkg);
int install = 0;
QUESTION(db->handle, ALPM_QUESTION_INSTALL_IGNOREPKG, pkg,