all: few behavioural regression fixes

Wildcard matching with no names should match all packages only for
info and search applet. "apk del" would otherwise try to delete
everything, etc.

Fix also interactive mode to ask questions only if we are actually
changing something.
cute-signatures
Timo Teräs 2013-06-19 20:55:01 +03:00
parent e4c65886dd
commit 6da083fc24
6 changed files with 13 additions and 5 deletions

View File

@ -42,6 +42,7 @@ struct apk_provider;
#define APK_DEP_CONFLICTS 0x04
#define APK_FOREACH_INSTALLED 0x10
#define APK_FOREACH_MARKED 0x20
#define APK_FOREACH_NULL_MATCHES_ALL 0x40
#define APK_FOREACH_GENID_MASK 0xffffff00
struct apk_sign_ctx {

View File

@ -259,7 +259,7 @@ int apk_solver_commit_changeset(struct apk_database *db,
"disk space will be freed." :
"additional disk space will be used.");
}
if (changeset->changes->num > 0 &&
if (changeset->num_total_changes > 0 &&
(apk_flags & APK_INTERACTIVE)) {
printf("Do you want to continue [Y/n]? ");
fflush(stdout);

View File

@ -2741,6 +2741,8 @@ void apk_name_foreach_matching(struct apk_database *db, struct apk_string_array
};
if (filter == NULL || filter->num == 0) {
if (!(match & APK_FOREACH_NULL_MATCHES_ALL))
return;
apk_string_array_init(&mctx.filter);
goto all;
}

View File

@ -399,7 +399,9 @@ static int info_main(void *ctx, struct apk_database *db, struct apk_string_array
if (args->num > 0) {
/* Print info on given names */
apk_name_foreach_matching(db, args, apk_foreach_genid(), print_name_info, ctx);
apk_name_foreach_matching(
db, args, APK_FOREACH_NULL_MATCHES_ALL | apk_foreach_genid(),
print_name_info, ctx);
} else {
/* Print all installed packages */
list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list)

View File

@ -157,7 +157,9 @@ static int search_main(void *pctx, struct apk_database *db, struct apk_string_ar
*pmatch = tmp;
}
}
apk_name_foreach_matching(db, args, apk_foreach_genid(), print_result, ctx);
apk_name_foreach_matching(
db, args, APK_FOREACH_NULL_MATCHES_ALL | apk_foreach_genid(),
print_result, ctx);
return 0;
}

View File

@ -174,8 +174,9 @@ static int ver_main(void *pctx, struct apk_database *db, struct apk_string_array
if (apk_verbosity > 0)
printf("%-42sAvailable:\n", "Installed:");
apk_name_foreach_matching(db, args, apk_foreach_genid(),
ver_print_package_status, ctx);
apk_name_foreach_matching(
db, args, APK_FOREACH_NULL_MATCHES_ALL | apk_foreach_genid(),
ver_print_package_status, ctx);
return 0;
}