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>
This commit is contained in:
parent
3ec45486ff
commit
797c190f93
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue