fixed detection for duplicate entries in list of deps/conflicts
This commit is contained in:
parent
4e8220fae7
commit
c7bcaeb7e8
3 changed files with 25 additions and 9 deletions
|
@ -75,7 +75,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs db: adding %s as a conflict for %s",
|
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs db: adding %s as a conflict for %s",
|
||||||
dp->name, tp->name);
|
dp->name, tp->name);
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
|
@ -94,7 +94,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs db: adding %s as a conflict for %s",
|
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs db: adding %s as a conflict for %s",
|
||||||
dp->name, tp->name);
|
dp->name, tp->name);
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
|
@ -120,7 +120,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, otp->name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, otp->name, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs targs: adding %s as a conflict for %s",
|
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs targs: adding %s as a conflict for %s",
|
||||||
otp->name, tp->name);
|
otp->name, tp->name);
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
|
@ -138,7 +138,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, otp->name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, otp->name, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs targs: adding %s as a conflict for %s",
|
_alpm_log(PM_LOG_DEBUG, "checkconflict: targs vs targs: adding %s as a conflict for %s",
|
||||||
otp->name, tp->name);
|
otp->name, tp->name);
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
|
@ -165,7 +165,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkconflict: db vs targs: adding %s as a conflict for %s",
|
_alpm_log(PM_LOG_DEBUG, "checkconflict: db vs targs: adding %s as a conflict for %s",
|
||||||
info->name, tp->name);
|
info->name, tp->name);
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
|
@ -185,7 +185,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkconflict: db vs targs: adding %s as a conflict for %s",
|
_alpm_log(PM_LOG_DEBUG, "checkconflict: db vs targs: adding %s as a conflict for %s",
|
||||||
info->name, tp->name);
|
info->name, tp->name);
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
|
|
|
@ -37,6 +37,21 @@
|
||||||
|
|
||||||
extern pmhandle_t *handle;
|
extern pmhandle_t *handle;
|
||||||
|
|
||||||
|
int dep_isin(pmdepmissing_t *needle, PMList *haystack)
|
||||||
|
{
|
||||||
|
PMList *i;
|
||||||
|
|
||||||
|
for(i = haystack; i; i = i->next) {
|
||||||
|
pmdepmissing_t *miss = i->data;
|
||||||
|
if(!memcmp(needle, miss, sizeof(pmdepmissing_t))
|
||||||
|
&& !memcmp(&needle->depend, &miss->depend, sizeof(pmdepend_t))) {
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
static pmdepmissing_t *depmissing_new(const char *target, unsigned char type, unsigned char depmod,
|
static pmdepmissing_t *depmissing_new(const char *target, unsigned char type, unsigned char depmod,
|
||||||
const char *depname, const char *depversion)
|
const char *depname, const char *depversion)
|
||||||
{
|
{
|
||||||
|
@ -225,7 +240,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
|
||||||
STRNCPY(miss->target, p->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, p->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN);
|
STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
} else {
|
} else {
|
||||||
FREE(miss);
|
FREE(miss);
|
||||||
|
@ -339,7 +354,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN);
|
STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
} else {
|
} else {
|
||||||
FREE(miss);
|
FREE(miss);
|
||||||
|
@ -363,7 +378,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
|
||||||
miss->depend.version[0] = '\0';
|
miss->depend.version[0] = '\0';
|
||||||
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
|
||||||
STRNCPY(miss->depend.name, (char *)j->data, PKG_NAME_LEN);
|
STRNCPY(miss->depend.name, (char *)j->data, PKG_NAME_LEN);
|
||||||
if(!pm_list_is_in(miss, baddeps)) {
|
if(!dep_isin(miss, baddeps)) {
|
||||||
baddeps = pm_list_add(baddeps, miss);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
} else {
|
} else {
|
||||||
FREE(miss);
|
FREE(miss);
|
||||||
|
|
|
@ -36,6 +36,7 @@ typedef struct __pmdepmissing_t {
|
||||||
pmdepend_t depend;
|
pmdepend_t depend;
|
||||||
} pmdepmissing_t;
|
} pmdepmissing_t;
|
||||||
|
|
||||||
|
int dep_isin(pmdepmissing_t *needle, PMList *haystack);
|
||||||
PMList *sortbydeps(PMList *targets, int mode);
|
PMList *sortbydeps(PMList *targets, int mode);
|
||||||
PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
|
PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
|
||||||
int splitdep(char *depstr, pmdepend_t *depend);
|
int splitdep(char *depstr, pmdepend_t *depend);
|
||||||
|
|
Loading…
Add table
Reference in a new issue