Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/deps.c43
-rw-r--r--lib/libalpm/deps.h1
3 files changed, 37 insertions, 9 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 48a99d29..19ea4ffd 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -273,7 +273,7 @@ typedef enum _pmtransflag_t {
PM_TRANS_FLAG_NODEPS = 1,
PM_TRANS_FLAG_FORCE = (1 << 1),
PM_TRANS_FLAG_NOSAVE = (1 << 2),
- /* (1 << 3) flag can go here */
+ PM_TRANS_FLAG_NODEPVERSION = (1 << 3),
PM_TRANS_FLAG_CASCADE = (1 << 4),
PM_TRANS_FLAG_RECURSE = (1 << 5),
PM_TRANS_FLAG_DBONLY = (1 << 6),
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 609200f3..b667b0e8 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -195,7 +195,7 @@ pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
for(i = pkgs; i; i = alpm_list_next(i)) {
pmpkg_t *pkg = i->data;
- if(_alpm_depcmp(pkg, dep)) {
+ if(_alpm_depcmp_tolerant(pkg, dep)) {
return(pkg);
}
}
@@ -319,10 +319,18 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod,
return(equal);
}
-int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
+/* nodepversion: skip version checking */
+static int _depcmp(pmpkg_t *pkg, pmdepend_t *dep, int nodepversion)
{
alpm_list_t *i;
int satisfy = 0;
+ int depmod;
+
+ if(nodepversion) {
+ depmod = PM_DEP_MOD_ANY;
+ } else {
+ depmod = dep->mod;
+ }
/* check (pkg->name, pkg->version) */
if(pkg->name_hash && dep->name_hash
@@ -330,7 +338,7 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
/* skip more expensive checks */
} else {
satisfy = (strcmp(pkg->name, dep->name) == 0
- && dep_vercmp(pkg->version, dep->mod, dep->version));
+ && dep_vercmp(pkg->version, depmod, dep->version));
if(satisfy) {
return(satisfy);
}
@@ -342,7 +350,7 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
const char *provver = strchr(provision, '=');
if(provver == NULL) { /* no provision version */
- satisfy = (dep->mod == PM_DEP_MOD_ANY
+ satisfy = (depmod == PM_DEP_MOD_ANY
&& strcmp(provision, dep->name) == 0);
} else {
/* This is a bit tricker than the old code for performance reasons. To
@@ -354,13 +362,32 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
provver += 1;
satisfy = (strlen(dep->name) == namelen
&& strncmp(provision, dep->name, namelen) == 0
- && dep_vercmp(provver, dep->mod, dep->version));
+ && dep_vercmp(provver, depmod, dep->version));
}
}
return(satisfy);
}
+/* tolerant : respects NODEPVERSION flag */
+int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep)
+{
+ int nodepversion = 0;
+ int flags = alpm_trans_get_flags();
+
+ if (flags != -1) {
+ nodepversion = flags & PM_TRANS_FLAG_NODEPVERSION;
+ }
+
+ return(_depcmp(pkg, dep, nodepversion));
+}
+
+/* strict : ignores NODEPVERSION flag */
+int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
+{
+ return(_depcmp(pkg, dep, 0));
+}
+
pmdepend_t *_alpm_splitdep(const char *depstring)
{
pmdepend_t *depend;
@@ -540,7 +567,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
/* 1. literals */
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(pkg && _alpm_depcmp_tolerant(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
if(_alpm_pkg_should_ignore(pkg)) {
int install = 0;
if (prompt) {
@@ -561,7 +588,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
for(i = dbs; i; i = i->next) {
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
pmpkg_t *pkg = j->data;
- if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
+ if(_alpm_depcmp_tolerant(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
!_alpm_pkg_find(excluding, pkg->name)) {
if(_alpm_pkg_should_ignore(pkg)) {
int install = 0;
@@ -715,7 +742,7 @@ int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2)
{
alpm_list_t *i;
for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) {
- if(_alpm_depcmp(pkg2, i->data)) {
+ if(_alpm_depcmp_tolerant(pkg2, i->data)) {
return(1);
}
}
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index bd5e9a4c..86070ab4 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -57,6 +57,7 @@ int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2);
pmdepend_t *_alpm_splitdep(const char *depstring);
pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep);
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
+int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep);
#endif /* _ALPM_DEPS_H */