[Reproducible-commits] [dpkg] 14/61: u-a: Reimplement --set-selections as a 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 9e93806ab9d6f719ad24fc2567f5810ba69315d2
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Aug 8 02:40:27 2015 +0200

    u-a: Reimplement --set-selections as a built-in command
    
    Do not execute itself with --set or --auto for each alternative to
    set a selection for, just handle them in-process.
---
 debian/changelog            |  2 ++
 utils/update-alternatives.c | 22 ++++++++++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5369812..f53bbd8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ dpkg (1.18.3) UNRELEASED; urgency=low
     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.
+  * Reimplement «update-alternatives --set-selections» as a fully built-in
+    command instead of executing itself with --set or --auto 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 9722edd..84b5acd 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2382,23 +2382,25 @@ alternative_set_selection(struct alternative_map *all, const char *name,
 	debug("set_selection(%s, %s, %s)", name, status, choice);
 	a = alternative_map_find(all, name);
 	if (a) {
-		char *cmd;
+		const char *new_choice = NULL;
 
 		if (strcmp(status, "auto") == 0) {
-			xasprintf(&cmd, "%s --auto %s", PROGNAME, name);
-			pr(_("Call %s."), cmd);
-			free(cmd);
-			subcall(prog_path, "--auto", name, NULL);
+			new_choice = alternative_set_auto(a);
 		} else if (alternative_has_choice(a, choice)) {
-			xasprintf(&cmd, "%s --set %s %s", PROGNAME,
-			          name, choice);
-			pr(_("Call %s."), cmd);
-			free(cmd);
-			subcall(prog_path, "--set", name, choice, NULL);
+			new_choice = alternative_set_manual(a, choice);
 		} else {
 			pr(_("Alternative %s unchanged because choice "
 			     "%s is not available."), name, choice);
 		}
+
+		if (new_choice) {
+			const char *current_choice;
+
+			current_choice = alternative_get_current(a);
+			alternative_select_mode(a, current_choice);
+
+			alternative_update(a, current_choice, new_choice);
+		}
 	} else {
 		pr(_("Skip unknown alternative %s."), name);
 	}

-- 
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