Explorar el Código

u-a: Print master and slave link names

Change --query output to print the master and slave link names. This
implies switching the Link field to print the alternative link instead
of the alternative name which was passed already as an argument. Add a
new Name field to print the alternative name.

Although, strictly speaking, this is an interface change, the previous
Link field value was wrong and not really useful, because it's already
known by the caller. A check of the whole archive does not reveal any
user of that field, so it seems pretty safe to do this change.

This also modifies the --config output when thre's a single alternative
to print the alternative link.

Closes: #679010
Guillem Jover hace 14 años
padre
commit
27e75257ed
Se han modificado 2 ficheros con 11 adiciones y 3 borrados
  1. 2 0
      debian/changelog
  2. 9 3
      utils/update-alternatives.c

+ 2 - 0
debian/changelog

@@ -34,6 +34,8 @@ dpkg (1.16.5) UNRELEASED; urgency=low
     large member sizes. Closes: #678933
   * Add new dpkg-query --control-list and --control-show commands, which
     replace the now deprecated --control-path.
+  * Print master and slave alternarive link names in update-alternatives
+    --query and always print alternative link in --config. Closes: #679010
 
   [ Updated dpkg translations ]
   * Swedish (Peter Krefting).

+ 9 - 3
utils/update-alternatives.c

@@ -1450,7 +1450,13 @@ alternative_display_query(struct alternative *a)
 	struct slave_link *sl;
 	char *current;
 
-	pr("Link: %s", a->master_name);
+	pr("Name: %s", a->master_name);
+	pr("Link: %s", a->master_link);
+	if (alternative_slaves_count(a) > 0) {
+		pr("Slaves:");
+		for (sl = a->slaves; sl; sl = sl->next)
+			pr(" %s %s", sl->name, sl->link);
+	}
 	pr("Status: %s", alternative_status_string(a->status));
 	best = alternative_get_best(a);
 	if (best)
@@ -2673,8 +2679,8 @@ main(int argc, char **argv)
 		} else if (alternative_choices_count(a) == 1 &&
 		           a->status == ALT_ST_AUTO &&
 		           current_choice != NULL) {
-			pr(_("There is only one alternative in link group %s: %s"),
-			   a->master_name, current_choice);
+			pr(_("There is only one alternative in link group %s (providing %s): %s"),
+			   a->master_name, a->master_link, current_choice);
 			pr(_("Nothing to configure."));
 		} else {
 			new_choice = alternative_select_choice(a);