File policycoreutils-version-numbers.patch of Package policycoreutils.6935

Index: policycoreutils-2.5/semodule/semodule.c
===================================================================
--- policycoreutils-2.5.orig/semodule/semodule.c	2016-02-23 17:31:41.000000000 +0100
+++ policycoreutils-2.5/semodule/semodule.c	2017-06-19 15:36:42.575435564 +0200
@@ -127,7 +127,7 @@ static void usage(char *progname)
 	printf("  -B, --build		    build and reload policy\n");
 	printf("  -i,--install=MODULE_PKG   install a new module\n");
 	printf("  -r,--remove=MODULE_NAME   remove existing module\n");
-	printf("  -l,--list-modules=[KIND]  display list of installed modules\n");
+	printf("  -l[KIND],--list-modules[=KIND]  display list of installed modules\n");
 	printf("     KIND:  standard  list highest priority, enabled modules\n");
 	printf("            full      list all modules\n");
 	printf("  -X,--priority=PRIORITY    set priority for following operations (1-999)\n");
@@ -209,7 +209,7 @@ static void parse_command_line(int argc,
 	no_reload = 0;
 	priority = 400;
 	while ((i =
-		getopt_long(argc, argv, "s:b:hi:l::vqr:u:RnNBDCPX:e:d:p:S:E:cH", opts,
+		getopt_long(argc, argv, "s:b:hi:l::vr:u:RnNBDCPX:e:d:p:S:E:cH", opts,
 			    NULL)) != -1) {
 		switch (i) {
 		case 'b':
@@ -560,6 +560,7 @@ cleanup_extract:
 					}
 
 					const char *name = NULL;
+					const char *version = NULL;
 
 					for (j = 0; j < modinfos_len; j++) {
 						m = semanage_module_list_nth(modinfos, j);
@@ -567,10 +568,12 @@ cleanup_extract:
 						result = semanage_module_info_get_name(sh, m, &name);
 						if (result != 0) goto cleanup_list;
 
-						printf("%s\n", name);
+						result = semanage_module_info_get_version(sh, m, &version);
+						if (result != 0) goto cleanup_list;
+
+						printf("%s\t%s\n", name, version);
 					}
-				}
-				else if (strcmp(mode_arg, "full") == 0) {
+				} else if (strcmp(mode_arg, "full") == 0) {
 					/* get the modules */
 					result = semanage_module_list_all(sh,
 									  &modinfos,
openSUSE Build Service is sponsored by