summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/add.c5
-rw-r--r--lib/libalpm/remove.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 84bf4c3a..778bb888 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -782,6 +782,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_ERROR, _("could not add entry '%s' in cache"), info->name);
}
+ /* XXX: This is copy-pasta from remove.c - refactor */
/* update dependency packages' REQUIREDBY fields */
if(info->depends) {
_alpm_log(PM_LOG_FLOW2, _("updating dependency packages 'requiredby' fields"));
@@ -810,6 +811,10 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
continue;
}
}
+
+ /* Ensure package has the right info */
+ _alpm_db_read(db, INFRQ_DEPENDS, depinfo);
+
_alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), info->name, depinfo->name);
depinfo->requiredby = _alpm_list_add(depinfo->requiredby, strdup(info->name));
if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) {
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 84c5da2f..7d827e8f 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -325,6 +325,8 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
continue;
}
}
+ /* Ensure package has the appropriate data */
+ _alpm_db_read(db, INFRQ_DEPENDS, depinfo);
/* splice out this entry from requiredby */
depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, &vdata);
data = vdata;