diff options
author | Xavier Chantry <chantry.xavier@gmail.com> | 2010-10-17 19:45:31 +0200 |
---|---|---|
committer | Xavier Chantry <chantry.xavier@gmail.com> | 2011-01-29 19:40:08 +0100 |
commit | e263cf7231c5d6ec41a15cd6230dbd794b58287a (patch) | |
tree | 1a543942b5a575af1193fd86b3b20ef7e999dac0 /lib/libalpm/add.c | |
parent | 05f2abfba9d9e9055c5a2d0d7ae92d24f0dd1a2f (diff) | |
download | pacman-e263cf7231c5d6ec41a15cd6230dbd794b58287a.tar.xz |
alpm: drop old target interfaces
It's likely that these interfaces will break sooner or later, now that
pacman no longer uses them.
So better force the two people who use them to migrate their code to the
new add_pkg/remove_pkg interface, which is very easy anyway.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r-- | lib/libalpm/add.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index a1216d9b..2cfa23b4 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -112,67 +112,6 @@ int SYMEXPORT alpm_add_pkg(pmpkg_t *pkg) return(0); } - -/** Add a file target to the transaction. - * @param target the name of the file target to add - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int SYMEXPORT alpm_add_target(const char *target) -{ - pmpkg_t *pkg = NULL; - const char *pkgname, *pkgver; - alpm_list_t *i; - pmtrans_t *trans; - - ALPM_LOG_FUNC; - - /* Sanity checks */ - ASSERT(target != NULL && strlen(target) != 0, 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)); - ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); - - _alpm_log(PM_LOG_DEBUG, "loading target '%s'\n", target); - - if(alpm_pkg_load(target, 1, &pkg) != 0) { - goto error; - } - pkgname = alpm_pkg_get_name(pkg); - pkgver = alpm_pkg_get_version(pkg); - - /* check if an older version of said package is already in transaction - * packages. if so, replace it in the list */ - for(i = trans->add; i; i = i->next) { - pmpkg_t *transpkg = i->data; - if(strcmp(transpkg->name, pkgname) == 0) { - if(alpm_pkg_vercmp(transpkg->version, pkgver) < 0) { - _alpm_log(PM_LOG_WARNING, - _("replacing older version %s-%s by %s in target list\n"), - transpkg->name, transpkg->version, pkgver); - _alpm_pkg_free(i->data); - i->data = pkg; - } else { - _alpm_log(PM_LOG_WARNING, - _("skipping %s-%s because newer version %s is in target list\n"), - pkgname, pkgver, transpkg->version); - _alpm_pkg_free(pkg); - } - return(0); - } - } - - /* add the package to the transaction */ - trans->add = alpm_list_add(trans->add, pkg); - - return(0); - -error: - _alpm_pkg_free(pkg); - return(-1); -} - static int perform_extraction(struct archive *archive, struct archive_entry *entry, const char *filename, const char *origname) { |