index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2012-02-01 23:45:52 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-02-06 05:49:52 -0600 |
commit | b488f229d2ec4f2e4b9e746d68422460ca664715 (patch) | |
tree | 31604f41d7c3780d3b76ac4bb87c10e676a16c54 /lib/libalpm/be_local.c | |
parent | f12effc6ff4605ea81b3b765ff1655107aad29d8 (diff) |
-rw-r--r-- | lib/libalpm/be_local.c | 24 |
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 137da1a8..9a8c0ec7 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -948,6 +948,30 @@ int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info) return ret; } +int SYMEXPORT alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason) +{ + ASSERT(pkg != NULL, return -1); + ASSERT(pkg->origin == PKG_FROM_LOCALDB, + RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg->origin_data.db == pkg->handle->db_local, + RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1)); + + _alpm_log(pkg->handle, ALPM_LOG_DEBUG, + "setting install reason %u for %s\n", reason, pkg->name); + if(alpm_pkg_get_reason(pkg) == reason) { + /* we are done */ + return 0; + } + /* set reason (in pkgcache) */ + pkg->reason = reason; + /* write DESC */ + if(_alpm_local_db_write(pkg->handle->db_local, pkg, INFRQ_DESC)) { + RET_ERR(pkg->handle, ALPM_ERR_DB_WRITE, -1); + } + + return 0; +} + struct db_operations local_db_ops = { .validate = local_db_validate, .populate = local_db_populate, |