summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/add.c61
-rw-r--r--lib/libalpm/alpm.h5
-rw-r--r--lib/libalpm/remove.c43
-rw-r--r--lib/libalpm/sync.c173
4 files changed, 0 insertions, 282 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)
{
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 169882c4..48a99d29 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -422,11 +422,6 @@ int alpm_sync_sysupgrade(int enable_downgrade);
int alpm_add_pkg(pmpkg_t *pkg);
int alpm_remove_pkg(pmpkg_t *pkg);
-DEPRECATED int alpm_sync_target(const char *target);
-DEPRECATED int alpm_sync_dbtarget(const char *db, const char *target);
-DEPRECATED int alpm_add_target(const char *target);
-DEPRECATED int alpm_remove_target(const char *target);
-
/*
* Dependencies and conflicts
*/
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index b2ed220a..5def92a6 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -72,49 +72,6 @@ int SYMEXPORT alpm_remove_pkg(pmpkg_t *pkg)
return(0);
}
-int SYMEXPORT alpm_remove_target(const char *target)
-{
- pmpkg_t *info;
- pmtrans_t *trans;
- pmdb_t *db_local;
- alpm_list_t *p;
-
- 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;
- db_local = handle->db_local;
- ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
- ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
- ASSERT(db_local != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
-
-
- if(_alpm_pkg_find(trans->remove, target)) {
- RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
- }
-
- if((info = _alpm_db_get_pkgfromcache(db_local, target)) != NULL) {
- _alpm_log(PM_LOG_DEBUG, "adding %s in the target list\n", info->name);
- trans->remove = alpm_list_add(trans->remove, _alpm_pkg_dup(info));
- return(0);
- }
-
- _alpm_log(PM_LOG_DEBUG, "could not find %s in database\n", target);
- pmgrp_t *grp = alpm_db_readgrp(db_local, target);
- if(grp == NULL) {
- RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
- }
- for(p = alpm_grp_get_pkgs(grp); p; p = alpm_list_next(p)) {
- pmpkg_t *pkg = alpm_list_getdata(p);
- _alpm_log(PM_LOG_DEBUG, "adding %s in the target list\n", pkg->name);
- trans->remove = alpm_list_add(trans->remove, _alpm_pkg_dup(pkg));
- }
-
- return(0);
-}
-
static void remove_prepare_cascade(pmtrans_t *trans, pmdb_t *db,
alpm_list_t *lp)
{
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 63cd4b7c..9f5bec3b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -202,179 +202,6 @@ int SYMEXPORT alpm_sync_sysupgrade(int enable_downgrade)
return(0);
}
-static int sync_pkg(pmpkg_t *spkg, alpm_list_t *pkg_list)
-{
- pmtrans_t *trans;
- pmdb_t *db_local;
- pmpkg_t *local;
-
- ALPM_LOG_FUNC;
-
- trans = handle->trans;
- db_local = handle->db_local;
-
- if(_alpm_pkg_find(pkg_list, alpm_pkg_get_name(spkg))) {
- RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
- }
-
- local = _alpm_db_get_pkgfromcache(db_local, alpm_pkg_get_name(spkg));
- if(local) {
- int cmp = _alpm_pkg_compare_versions(spkg, local);
- if(cmp == 0) {
- if(trans->flags & PM_TRANS_FLAG_NEEDED) {
- /* with the NEEDED flag, packages up to date are not reinstalled */
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
- alpm_pkg_get_name(local), alpm_pkg_get_version(local));
- return(0);
- } else {
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
- alpm_pkg_get_name(local), alpm_pkg_get_version(local));
-
- }
- } else if(cmp < 0) {
- /* local version is newer */
- _alpm_log(PM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"),
- alpm_pkg_get_name(local), alpm_pkg_get_version(local),
- alpm_pkg_get_version(spkg));
- }
- }
-
- /* add the package to the transaction */
- spkg->reason = PM_PKG_REASON_EXPLICIT;
- _alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n",
- alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
- trans->add = alpm_list_add(trans->add, spkg);
-
- return(0);
-}
-
-static int sync_group(alpm_list_t *dbs_sync, const char *target)
-{
- alpm_list_t *i, *j;
- alpm_list_t *known_pkgs = NULL;
- pmgrp_t *grp;
- int found = 0;
-
- ALPM_LOG_FUNC;
-
- _alpm_log(PM_LOG_DEBUG, "%s package not found, searching for group...\n", target);
- for(i = dbs_sync; i; i = i->next) {
- pmdb_t *db = i->data;
- grp = alpm_db_readgrp(db, target);
- if(grp) {
- found = 1;
- for(j = alpm_grp_get_pkgs(grp); j; j = j->next) {
- pmpkg_t *pkg = j->data;
-
- /* check if group member is ignored */
- if(_alpm_pkg_should_ignore(pkg)) {
- int install = 0;
- QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
- NULL, NULL, &install);
- if(install == 0) {
- _alpm_log(PM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg));
- continue;
- }
- }
-
- if(sync_pkg(pkg, known_pkgs) == -1) {
- if(pm_errno == PM_ERR_TRANS_DUP_TARGET || pm_errno == PM_ERR_PKG_IGNORED) {
- /* just skip duplicate or ignored targets */
- continue;
- } else {
- alpm_list_free(known_pkgs);
- return(-1);
- }
- }
- known_pkgs = alpm_list_add(known_pkgs, pkg);
- }
- }
- }
- alpm_list_free(known_pkgs);
-
- if(!found) {
- /* pass through any 'found but ignored' errors */
- if(pm_errno != PM_ERR_PKG_IGNORED) {
- pm_errno = PM_ERR_PKG_NOT_FOUND;
- }
- return(-1);
- }
-
- return(0);
-}
-
-static int sync_target(alpm_list_t *dbs_sync, const char *target)
-{
- pmpkg_t *spkg;
- pmdepend_t *dep; /* provisions and dependencies are also allowed */
-
- 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));
-
- dep = _alpm_splitdep(target);
- spkg = _alpm_resolvedep(dep, dbs_sync, NULL, 1);
- _alpm_dep_free(dep);
-
- if(spkg != NULL) {
- return(sync_pkg(spkg, handle->trans->add));
- }
-
- return(sync_group(dbs_sync, target));
-}
-
-/** Add a sync target to the transaction.
- * @param target the name of the sync target to add
- * @return 0 on success, -1 on error (pm_errno is set accordingly)
- */
-int SYMEXPORT alpm_sync_dbtarget(const char *dbname, const char *target)
-{
- alpm_list_t *i;
- alpm_list_t *dbs_sync;
-
- ALPM_LOG_FUNC;
-
- /* Sanity checks */
- ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
- dbs_sync = handle->dbs_sync;
-
- /* we are looking for a package in a specific database */
- alpm_list_t *dbs = NULL;
- _alpm_log(PM_LOG_DEBUG, "searching for target '%s' in repo '%s'\n", target, dbname);
- for(i = dbs_sync; i; i = i->next) {
- pmdb_t *db = i->data;
- if(strcmp(db->treename, dbname) == 0) {
- dbs = alpm_list_add(NULL, db);
- break;
- }
- }
- if(dbs == NULL) {
- RET_ERR(PM_ERR_PKG_REPO_NOT_FOUND, -1);
- }
- int ret = sync_target(dbs, target);
- alpm_list_free(dbs);
- return(ret);
-}
-
-/** Add a sync target to the transaction.
- * @param target the name of the sync target to add
- * @return 0 on success, -1 on error (pm_errno is set accordingly)
- */
-int SYMEXPORT alpm_sync_target(const char *target)
-{
- alpm_list_t *dbs_sync;
-
- ALPM_LOG_FUNC;
-
- /* Sanity checks */
- ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
- dbs_sync = handle->dbs_sync;
-
- return(sync_target(dbs_sync,target));
-}
-
/** Find group members across a list of databases.
* If a member exists in several databases, only the first database is used.
* IgnorePkg is also handled.