diff --git a/po/POTFILES.in b/po/POTFILES.in index 4d4227d1..cf6e9506 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,7 +1,6 @@ # List of source files with translatable strings # pacman frontend source files -src/pacman/add.c src/pacman/callback.c src/pacman/conf.c src/pacman/deptest.c @@ -11,6 +10,7 @@ src/pacman/query.c src/pacman/remove.c src/pacman/sync.c src/pacman/util.c +src/pacman/upgrade.c # scripts with gettext translations scripts/makepkg.sh.in diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am index 0395432e..fbb50a29 100644 --- a/src/pacman/Makefile.am +++ b/src/pacman/Makefile.am @@ -22,7 +22,6 @@ INCLUDES = -I$(top_srcdir)/lib/libalpm AM_CFLAGS = -pedantic -D_GNU_SOURCE pacman_SOURCES = \ - add.c \ conf.h conf.c \ deptest.c \ package.h package.c \ @@ -31,6 +30,7 @@ pacman_SOURCES = \ remove.c \ sync.c \ callback.h callback.c \ + upgrade.c \ util.h util.c pacman_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la diff --git a/src/pacman/conf.h b/src/pacman/conf.h index beabf469..d53db08f 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -27,7 +27,6 @@ typedef struct __config_t { unsigned short verbose; unsigned short version; unsigned short help; - unsigned short upgrade; unsigned short noconfirm; unsigned short noprogressbar; unsigned short logmask; diff --git a/src/pacman/pacman.h b/src/pacman/pacman.h index 9d23a89c..97d0301e 100644 --- a/src/pacman/pacman.h +++ b/src/pacman/pacman.h @@ -21,15 +21,14 @@ #include -/* add.c, this should merge with upgrade.c */ -int pacman_add(alpm_list_t *targets); -int pacman_upgrade(alpm_list_t *targets); -/* sync.c */ -int pacman_sync(alpm_list_t *targets); /* query.c */ int pacman_query(alpm_list_t *targets); /* remove.c */ int pacman_remove(alpm_list_t *targets); +/* sync.c */ +int pacman_sync(alpm_list_t *targets); +/* upgrade.c */ +int pacman_upgrade(alpm_list_t *targets); /* deptest.c */ int pacman_deptest(alpm_list_t *targets); diff --git a/src/pacman/add.c b/src/pacman/upgrade.c similarity index 87% rename from src/pacman/add.c rename to src/pacman/upgrade.c index fd40f005..e5626516 100644 --- a/src/pacman/add.c +++ b/src/pacman/upgrade.c @@ -1,5 +1,5 @@ /* - * add.c + * upgrade.c * * Copyright (c) 2002-2007 by Judd Vinet * @@ -33,7 +33,7 @@ #include "util.h" /* Free the current transaction and print an error if unsuccessful */ -static int add_cleanup(void) +static int upgrade_cleanup(void) { int ret = alpm_trans_release(); if(ret != 0) { @@ -53,24 +53,9 @@ static int add_cleanup(void) * @return 0 on success, 1 on failure */ int pacman_upgrade(alpm_list_t *targets) -{ - /* this is basically just a remove-then-add process. pacman_add() will */ - /* handle it */ - config->upgrade = 1; - return(pacman_add(targets)); -} - -/** - * @brief Add a specified list of packages which cannot already be installed. - * - * @param targets a list of packages (as strings) to add - * - * @return 0 on success, 1 on failure - */ -int pacman_add(alpm_list_t *targets) { alpm_list_t *i, *data = NULL; - pmtranstype_t transtype = PM_TRANS_TYPE_ADD; + pmtranstype_t transtype = PM_TRANS_TYPE_UPGRADE; int retval = 0; if(targets == NULL) { @@ -93,11 +78,6 @@ int pacman_add(alpm_list_t *targets) } /* Step 1: create a new transaction */ - if(config->upgrade == 1) { - /* if upgrade flag was set, change this to an upgrade transaction */ - transtype = PM_TRANS_TYPE_UPGRADE; - } - if(alpm_trans_init(transtype, config->flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) { /* TODO: error messages should be in the front end, not the back */ @@ -117,7 +97,7 @@ int pacman_add(alpm_list_t *targets) if(alpm_trans_addtarget(targ) == -1) { fprintf(stderr, _("error: '%s': %s\n"), targ, alpm_strerrorlast()); - add_cleanup(); + upgrade_cleanup(); return(1); } } @@ -171,7 +151,7 @@ int pacman_add(alpm_list_t *targets) default: break; } - add_cleanup(); + upgrade_cleanup(); FREELIST(data); return(1); } @@ -180,11 +160,11 @@ int pacman_add(alpm_list_t *targets) /* Step 3: perform the installation */ if(alpm_trans_commit(NULL) == -1) { fprintf(stderr, _("error: failed to commit transaction (%s)\n"), alpm_strerrorlast()); - add_cleanup(); + upgrade_cleanup(); return(1); } - retval = add_cleanup(); + retval = upgrade_cleanup(); return(retval); }