summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-19 20:55:01 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-19 20:56:18 +0300
commit6da083fc24e4f1ef0363957074148d1bc11cef83 (patch)
tree7c6e6e08c7f1506dbdcc3404ac6f03e2bd498a76 /src
parente4c65886dd1758657ccf58e14523c2da57f2c98a (diff)
downloadapk-tools-6da083fc24e4f1ef0363957074148d1bc11cef83.tar.gz
apk-tools-6da083fc24e4f1ef0363957074148d1bc11cef83.tar.bz2
apk-tools-6da083fc24e4f1ef0363957074148d1bc11cef83.tar.xz
apk-tools-6da083fc24e4f1ef0363957074148d1bc11cef83.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/apk_package.h1
-rw-r--r--src/commit.c2
-rw-r--r--src/database.c2
-rw-r--r--src/info.c4
-rw-r--r--src/search.c4
-rw-r--r--src/ver.c5
6 files changed, 13 insertions, 5 deletions
diff --git a/src/apk_package.h b/src/apk_package.h
index db3965b..2d8a431 100644
--- a/src/apk_package.h
+++ b/src/apk_package.h
@@ -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 {
diff --git a/src/commit.c b/src/commit.c
index af9e34c..fc4fafd 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -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);
diff --git a/src/database.c b/src/database.c
index 72e568d..2360bda 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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;
}
diff --git a/src/info.c b/src/info.c
index 15dad1e..9eb9e78 100644
--- a/src/info.c
+++ b/src/info.c
@@ -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)
diff --git a/src/search.c b/src/search.c
index 3c323db..2b7b5e1 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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;
}
diff --git a/src/ver.c b/src/ver.c
index 5f340c4..94220a9 100644
--- a/src/ver.c
+++ b/src/ver.c
@@ -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;
}