summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-12-02 21:14:14 +0100
committerDan McGee <dan@archlinux.org>2008-03-08 21:13:34 +0100
commit797c190f93d24ff1e352549f320a0612cd04382b (patch)
tree4d65a987204fd9c11f93be7ba8dd8b1b6a492ac6 /src
parent3ec45486ff1373f9f65af229af315219fc1f0f7e (diff)
downloadpacman-797c190f93d24ff1e352549f320a0612cd04382b.tar.gz
pacman-797c190f93d24ff1e352549f320a0612cd04382b.tar.xz
Remove frontend add code that is no longer necessary
Change the pacman_upgrade stub function to do what pacman_add used to do so we can eliminate pacman_add. Move the code to the more-descriptive name of upgrade.c. Note that we have made no changes to the backend libalpm, where an ADD type transaction could still be supported. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/Makefile.am2
-rw-r--r--src/pacman/conf.h1
-rw-r--r--src/pacman/pacman.h9
-rw-r--r--src/pacman/upgrade.c (renamed from src/pacman/add.c)34
4 files changed, 12 insertions, 34 deletions
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 <alpm_list.h>
-/* 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
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 <jvinet@zeroflux.org>
*
@@ -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) {
@@ -54,23 +54,8 @@ static int add_cleanup(void)
*/
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);
}