[Reproducible-commits] [dpkg] 13/61: u-a: Reimplement --all as a fully built-in command
Jérémy Bobbio
lunar at moszumanska.debian.org
Mon Sep 21 09:56:05 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit c9c7a4e39babc7467c42d1c9808c83c05ed2e9bc
Author: Guillem Jover <guillem at debian.org>
Date: Sat Aug 8 01:57:37 2015 +0200
u-a: Reimplement --all as a fully built-in command
Do not execute itself with --config for each alternative to configure,
just handle them all in-process.
---
debian/changelog | 2 ++
utils/update-alternatives.c | 39 +++++++++++++++++++++++++--------------
2 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 30c0f72..5369812 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ dpkg (1.18.3) UNRELEASED; urgency=low
* Print the master and slave links in «update-alternatives --display».
* Print the current best alternative in the head instead of the trail
in «update-alternatives --display», with a two space indentation.
+ * Reimplement «update-alternatives --all» as a fully built-in command
+ instead of executing itself with --config per subtask.
* Perl modules:
- Only warn on invalid week days instead of aborting in
Dpkg::Changelog::Entry::Debian. Regression introduced in dpkg 1.18.2.
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index d95fb47..9722edd 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1678,20 +1678,6 @@ alternative_config(struct alternative *a, const char *current_choice)
}
static void
-alternative_config_all(void)
-{
- struct dirent **table;
- int i, count;
-
- count = altdb_get_namelist(&table);
- for (i = 0; i < count; i++) {
- subcall(prog_path, "--config", table[i]->d_name, NULL);
- printf("\n");
- }
- altdb_free_namelist(table, count);
-}
-
-static void
alternative_add_commit_op(struct alternative *a, enum opcode opcode,
const char *arg_a, const char *arg_b)
{
@@ -2343,6 +2329,30 @@ alternative_update(struct alternative *a,
}
static void
+alternative_config_all(void)
+{
+ struct alternative_map *alt_map_obj;
+ struct alternative_map *am;
+
+ alt_map_obj = alternative_map_new(NULL, NULL);
+ alternative_map_load_names(alt_map_obj);
+
+ for (am = alt_map_obj; am && am->item; am = am->next) {
+ const char *current_choice;
+ const char *new_choice;
+
+ current_choice = alternative_get_current(am->item);
+ alternative_select_mode(am->item, current_choice);
+
+ new_choice = alternative_config(am->item, current_choice);
+
+ alternative_update(am->item, current_choice, new_choice);
+ }
+
+ alternative_map_free(alt_map_obj);
+}
+
+static void
alternative_get_selections(void)
{
struct alternative_map *alt_map_obj;
@@ -2790,6 +2800,7 @@ main(int argc, char **argv)
/* Handle actions. */
if (strcmp(action, "all") == 0) {
+ log_msg("run with %s", get_argv_string(argc, argv));
alternative_config_all();
exit(0);
} else if (strcmp(action, "get-selections") == 0) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list