summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 20:29:05 +0200
committerDan McGee <dan@archlinux.org>2011-06-09 21:24:45 +0200
commit24000b83c9a9ba2f25a46914d2919293dc865a2e (patch)
treeb3e2a30c19e52ea22a13508ba23a9eab6f9ba60b /src
parent17a6ac567502975d3a98a34ed58d79c05eb7b8d1 (diff)
downloadpacman-24000b83c9a9ba2f25a46914d2919293dc865a2e.tar.gz
pacman-24000b83c9a9ba2f25a46914d2919293dc865a2e.tar.xz
Require handle argument to all alpm_trans_*() methods
Begin enforcing the need to pass a handle. This allows us to remove one more extern handle declaration from the backend. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c4
-rw-r--r--src/pacman/remove.c8
-rw-r--r--src/pacman/sync.c10
-rw-r--r--src/pacman/upgrade.c12
-rw-r--r--src/pacman/util.c6
5 files changed, 20 insertions, 20 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index c186ebed..afc79f6f 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -307,12 +307,12 @@ static void handler(int signum)
} else if(signum == SIGINT) {
const char *msg = "\nInterrupt signal received\n";
xwrite(err, msg, strlen(msg));
- if(alpm_trans_interrupt() == 0) {
+ if(alpm_trans_interrupt(config->handle) == 0) {
/* a transaction is being interrupted, don't exit pacman yet. */
return;
}
/* no commiting transaction, we can release it now and then exit pacman */
- alpm_trans_release();
+ alpm_trans_release(config->handle);
/* output a newline to be sure we clear any line we may be on */
xwrite(out, "\n", 1);
}
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 46c595f9..b96687ae 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -99,7 +99,7 @@ int pacman_remove(alpm_list_t *targets)
}
/* Step 2: prepare the transaction based on its type, targets and flags */
- if(alpm_trans_prepare(&data) == -1) {
+ if(alpm_trans_prepare(config->handle, &data) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
alpm_strerrorlast());
switch(pm_errno) {
@@ -129,7 +129,7 @@ int pacman_remove(alpm_list_t *targets)
/* Search for holdpkg in target list */
int holdpkg = 0;
- for(i = alpm_trans_get_remove(); i; i = alpm_list_next(i)) {
+ for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) {
pmpkg_t *pkg = alpm_list_getdata(i);
if(alpm_list_find_str(config->holdpkg, alpm_pkg_get_name(pkg))) {
pm_printf(PM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"),
@@ -143,7 +143,7 @@ int pacman_remove(alpm_list_t *targets)
}
/* Step 3: actually perform the removal */
- alpm_list_t *pkglist = alpm_trans_get_remove();
+ alpm_list_t *pkglist = alpm_trans_get_remove(config->handle);
if(pkglist == NULL) {
printf(_(" there is nothing to do\n"));
goto cleanup; /* we are done */
@@ -162,7 +162,7 @@ int pacman_remove(alpm_list_t *targets)
goto cleanup;
}
- if(alpm_trans_commit(NULL) == -1) {
+ if(alpm_trans_commit(config->handle, NULL) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
alpm_strerrorlast());
retval = 1;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 3876d92c..6f8508ec 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -768,7 +768,7 @@ static int sync_trans(alpm_list_t *targets)
}
/* Step 2: "compute" the transaction based on targets and flags */
- if(alpm_trans_prepare(&data) == -1) {
+ if(alpm_trans_prepare(config->handle, &data) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
alpm_strerrorlast());
switch(pm_errno) {
@@ -810,7 +810,7 @@ static int sync_trans(alpm_list_t *targets)
goto cleanup;
}
- packages = alpm_trans_get_add();
+ packages = alpm_trans_get_add(config->handle);
if(packages == NULL) {
/* nothing to do: just exit without complaining */
printf(_(" there is nothing to do\n"));
@@ -823,8 +823,8 @@ static int sync_trans(alpm_list_t *targets)
goto cleanup;
}
- display_targets(alpm_trans_get_remove(), 0);
- display_targets(alpm_trans_get_add(), 1);
+ display_targets(alpm_trans_get_remove(config->handle), 0);
+ display_targets(alpm_trans_get_add(config->handle), 1);
printf("\n");
int confirm;
@@ -837,7 +837,7 @@ static int sync_trans(alpm_list_t *targets)
goto cleanup;
}
- if(alpm_trans_commit(&data) == -1) {
+ if(alpm_trans_commit(config->handle, &data) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
alpm_strerrorlast());
switch(pm_errno) {
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 21d9411e..ddb8a2e8 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -93,7 +93,7 @@ int pacman_upgrade(alpm_list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags */
/* TODO: No, compute nothing. This is stupid. */
- if(alpm_trans_prepare(&data) == -1) {
+ if(alpm_trans_prepare(config->handle, &data) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
alpm_strerrorlast());
switch(pm_errno) {
@@ -142,20 +142,20 @@ int pacman_upgrade(alpm_list_t *targets)
/* Step 3: perform the installation */
if(config->print) {
- print_packages(alpm_trans_get_add());
+ print_packages(alpm_trans_get_add(config->handle));
trans_release();
return 0;
}
/* print targets and ask user confirmation */
- alpm_list_t *packages = alpm_trans_get_add();
+ alpm_list_t *packages = alpm_trans_get_add(config->handle);
if(packages == NULL) { /* we are done */
printf(_(" there is nothing to do\n"));
trans_release();
return retval;
}
- display_targets(alpm_trans_get_remove(), 0);
- display_targets(alpm_trans_get_add(), 1);
+ display_targets(alpm_trans_get_remove(config->handle), 0);
+ display_targets(alpm_trans_get_add(config->handle), 1);
printf("\n");
int confirm = yesno(_("Proceed with installation?"));
if(!confirm) {
@@ -163,7 +163,7 @@ int pacman_upgrade(alpm_list_t *targets)
return retval;
}
- if(alpm_trans_commit(&data) == -1) {
+ if(alpm_trans_commit(config->handle, &data) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
alpm_strerrorlast());
switch(pm_errno) {
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 8d174e94..043b9d6f 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -53,9 +53,9 @@ int trans_init(pmtransflag_t flags)
{
int ret;
if(config->print) {
- ret = alpm_trans_init(flags, NULL, NULL, NULL);
+ ret = alpm_trans_init(config->handle, flags, NULL, NULL, NULL);
} else {
- ret = alpm_trans_init(flags, cb_trans_evt, cb_trans_conv,
+ ret = alpm_trans_init(config->handle, flags, cb_trans_evt, cb_trans_conv,
cb_trans_progress);
}
@@ -78,7 +78,7 @@ int trans_init(pmtransflag_t flags)
int trans_release(void)
{
- if(alpm_trans_release() == -1) {
+ if(alpm_trans_release(config->handle) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to release transaction (%s)\n"),
alpm_strerrorlast());
return -1;