[pacman-dev] [PATCH] Set package origin to db_local when adding installed package to local database.

Max Mertens max.mail at dameweb.de
Mon Mar 17 12:53:04 EDT 2014


This allows alpm frontends to change the install reason of just installed packages,
because alpm_pkg_set_reason checks pkg->origin and pkg->origin_data.db.

Signed-off-by: Max Mertens <max.mail at dameweb.de>
---
 lib/libalpm/db.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index b9cbed7..91cfd52 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -571,6 +571,11 @@ int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg)
 		return -1;
 	}
 
+	if(db == newpkg->handle->db_local) {
+		newpkg->origin = ALPM_PKG_FROM_LOCALDB;
+		newpkg->origin_data.db = newpkg->handle->db_local;
+	}
+
 	_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
 						newpkg->name, db->treename);
 	db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
-- 
1.9.0



More information about the pacman-dev mailing list