mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-12 04:15:06 -05:00
alpm: new alpm_remove_pkg interface
For consistency with alpm_add_pkg. The new recommended interface is alpm_add_pkg / alpm_remove_pkg, all others interfaces are deprecated. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
This commit is contained in:
parent
f2fcf7eeb1
commit
953e0d48d7
@ -425,6 +425,7 @@ int alpm_add_target(const char *target);
|
|||||||
int alpm_remove_target(const char *target);
|
int alpm_remove_target(const char *target);
|
||||||
|
|
||||||
int alpm_add_pkg(pmpkg_t *pkg);
|
int alpm_add_pkg(pmpkg_t *pkg);
|
||||||
|
int alpm_remove_pkg(pmpkg_t *pkg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dependencies and conflicts
|
* Dependencies and conflicts
|
||||||
|
@ -46,6 +46,32 @@
|
|||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
|
int SYMEXPORT alpm_remove_pkg(pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
pmtrans_t *trans;
|
||||||
|
const char *pkgname;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||||
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
trans = handle->trans;
|
||||||
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||||
|
ASSERT(trans->state == STATE_INITIALIZED,
|
||||||
|
RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
|
||||||
|
|
||||||
|
pkgname = alpm_pkg_get_name(pkg);
|
||||||
|
|
||||||
|
if(_alpm_pkg_find(trans->remove, pkgname)) {
|
||||||
|
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "adding %s in the target list\n", pkgname);
|
||||||
|
trans->remove = alpm_list_add(trans->remove, _alpm_pkg_dup(pkg));
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_remove_target(const char *target)
|
int SYMEXPORT alpm_remove_target(const char *target)
|
||||||
{
|
{
|
||||||
pmpkg_t *info;
|
pmpkg_t *info;
|
||||||
|
Loading…
Reference in New Issue
Block a user