summaryrefslogtreecommitdiff
path: root/src/pacman/sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/sync.c')
-rw-r--r--src/pacman/sync.c69
1 files changed, 39 insertions, 30 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 8d0c529a..63397aa3 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -85,7 +85,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) {
/* We have a directory that doesn't match any syncdb.
* Ask the user if he wants to remove it. */
if(!found) {
- if(!yesno(1, _("Do you want to remove %s?"), path)) {
+ if(!yesno(_("Do you want to remove %s?"), path)) {
continue;
}
@@ -105,7 +105,7 @@ static int sync_cleandb_all(void) {
char newdbpath[PATH_MAX];
printf(_("Database directory: %s\n"), dbpath);
- if(!yesno(1, _("Do you want to remove unused repositories?"))) {
+ if(!yesno(_("Do you want to remove unused repositories?"))) {
return(0);
}
/* The sync dbs were previously put in dbpath/, but are now in dbpath/sync/,
@@ -135,12 +135,12 @@ static int sync_cleancache(int level)
printf(_("Cache directory: %s\n"), cachedir);
switch(config->cleanmethod) {
case PM_CLEAN_KEEPINST:
- if(!yesno(1, _("Do you want to remove uninstalled packages from cache?"))) {
+ if(!yesno(_("Do you want to remove uninstalled packages from cache?"))) {
return(0);
}
break;
case PM_CLEAN_KEEPCUR:
- if(!yesno(1, _("Do you want to remove outdated packages from cache?"))) {
+ if(!yesno(_("Do you want to remove outdated packages from cache?"))) {
return(0);
}
break;
@@ -215,7 +215,7 @@ static int sync_cleancache(int level)
} else {
/* full cleanup */
printf(_("Cache directory: %s\n"), cachedir);
- if(!yesno(0, _("Do you want to remove ALL packages from cache?"))) {
+ if(!noyes(_("Do you want to remove ALL packages from cache?"))) {
return(0);
}
printf(_("removing all packages from cache... "));
@@ -286,7 +286,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
ret = alpm_db_search(db, targets);
freelist = 1;
} else {
- ret = alpm_db_getpkgcache(db);
+ ret = alpm_db_get_pkgcache(db);
freelist = 0;
}
if(ret == NULL) {
@@ -371,7 +371,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
for(i = syncs; i; i = alpm_list_next(i)) {
pmdb_t *db = alpm_list_getdata(i);
- for(j = alpm_db_getgrpcache(db); j; j = alpm_list_next(j)) {
+ for(j = alpm_db_get_grpcache(db); j; j = alpm_list_next(j)) {
pmgrp_t *grp = alpm_list_getdata(j);
const char *grpname = alpm_grp_get_name(grp);
@@ -425,7 +425,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
return(1);
}
- for(k = alpm_db_getpkgcache(db); k; k = alpm_list_next(k)) {
+ for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) {
pmpkg_t *pkg = alpm_list_getdata(k);
if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) {
@@ -446,7 +446,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
for(j = syncs; j; j = alpm_list_next(j)) {
pmdb_t *db = alpm_list_getdata(j);
- for(k = alpm_db_getpkgcache(db); k; k = alpm_list_next(k)) {
+ for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) {
pmpkg_t *pkg = alpm_list_getdata(k);
if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) {
@@ -467,7 +467,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
for(i = syncs; i; i = alpm_list_next(i)) {
pmdb_t *db = alpm_list_getdata(i);
- for(j = alpm_db_getpkgcache(db); j; j = alpm_list_next(j)) {
+ for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
dump_pkg_sync(alpm_list_getdata(j), alpm_db_get_name(db));
}
}
@@ -510,7 +510,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
for(i = ls; i; i = alpm_list_next(i)) {
pmdb_t *db = alpm_list_getdata(i);
- for(j = alpm_db_getpkgcache(db); j; j = alpm_list_next(j)) {
+ for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
pmpkg_t *pkg = alpm_list_getdata(j);
if (!config->quiet) {
printf("%s %s %s\n", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
@@ -604,14 +604,14 @@ static int sync_trans(alpm_list_t *targets)
(char*)alpm_pkg_get_name(k->data));
}
list_display(" ", pkgnames);
- if(yesno(1, _(":: Install whole content?"))) {
+ if(yesno(_(":: Install whole content?"))) {
for(k = pkgnames; k; k = alpm_list_next(k)) {
targets = alpm_list_add(targets, strdup(alpm_list_getdata(k)));
}
} else {
for(k = pkgnames; k; k = alpm_list_next(k)) {
char *pkgname = alpm_list_getdata(k);
- if(yesno(1, _(":: Install %s from group %s?"), pkgname, targ)) {
+ if(yesno(_(":: Install %s from group %s?"), pkgname, targ)) {
targets = alpm_list_add(targets, strdup(pkgname));
}
}
@@ -666,23 +666,32 @@ static int sync_trans(alpm_list_t *targets)
goto cleanup;
}
- if(!(alpm_trans_get_flags() & PM_TRANS_FLAG_PRINTURIS)) {
- int confirm;
+ /* Step 3: actually perform the operation */
+ if(config->op_s_printuris) {
+ /* print uris */
+ alpm_list_t *i;
+ for(i = packages; i; i = alpm_list_next(i)) {
+ pmpkg_t *pkg = alpm_sync_get_pkg((pmsyncpkg_t *)alpm_list_getdata(i));
+ pmdb_t *db = alpm_pkg_get_db(pkg);
+ printf("%s/%s\n", alpm_db_get_url(db), alpm_pkg_get_filename(pkg));
+ }
+ /* we are done */
+ goto cleanup;
+ }
- display_synctargets(packages);
- printf("\n");
+ display_synctargets(packages);
+ printf("\n");
- if(config->op_s_downloadonly) {
- confirm = yesno(1, _("Proceed with download?"));
- } else {
- confirm = yesno(1, _("Proceed with installation?"));
- }
- if(!confirm) {
- goto cleanup;
- }
- }/* else 'print uris' requested. We're done at this point */
+ int confirm;
+ if(config->op_s_downloadonly) {
+ confirm = yesno(_("Proceed with download?"));
+ } else {
+ confirm = yesno(_("Proceed with installation?"));
+ }
+ if(!confirm) {
+ goto cleanup;
+ }
- /* Step 3: actually perform the installation */
if(alpm_trans_commit(&data) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
alpm_strerrorlast());
@@ -739,7 +748,7 @@ int pacman_sync(alpm_list_t *targets)
alpm_list_t *sync_dbs = NULL;
/* Display only errors with -Sp and -Sw operations */
- if(config->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS)) {
+ if((config->flags & PM_TRANS_FLAG_DOWNLOADONLY) || config->op_s_printuris) {
config->logmask &= ~PM_LOG_WARNING;
}
@@ -811,13 +820,13 @@ int pacman_sync(alpm_list_t *targets)
}
alpm_list_t *targs = alpm_list_strdup(targets);
- if(!(config->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS))) {
+ if(!(config->flags & PM_TRANS_FLAG_DOWNLOADONLY) && !config->op_s_printuris) {
/* check for newer versions of packages to be upgraded first */
alpm_list_t *packages = syncfirst();
if(packages) {
printf(_(":: The following packages should be upgraded first :\n"));
list_display(" ", packages);
- if(yesno(1, _(":: Do you want to cancel the current operation\n"
+ if(yesno(_(":: Do you want to cancel the current operation\n"
":: and upgrade these packages now?"))) {
FREELIST(targs);
targs = packages;