Blame SOURCES/0048-semodule-rename-rebuild-if-modules-changed-to-refres.patch

4b0001
From c0ca652dce6b1d5d11e697cc3a4695d87944f9ad Mon Sep 17 00:00:00 2001
4b0001
From: Ondrej Mosnacek <omosnace@redhat.com>
4b0001
Date: Wed, 8 Jun 2022 19:09:54 +0200
4b0001
Subject: [PATCH] semodule: rename --rebuild-if-modules-changed to --refresh
4b0001
4b0001
After the last commit this option's name and description no longer
4b0001
matches the semantic, so give it a new one and update the descriptions.
4b0001
The old name is still recognized and aliased to the new one for
4b0001
backwards compatibility.
4b0001
4b0001
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
4b0001
Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
4b0001
---
4b0001
 policycoreutils/semodule/semodule.8 | 12 ++++++------
4b0001
 policycoreutils/semodule/semodule.c | 13 ++++++++++---
4b0001
 2 files changed, 16 insertions(+), 9 deletions(-)
4b0001
4b0001
diff --git a/policycoreutils/semodule/semodule.8 b/policycoreutils/semodule/semodule.8
4b0001
index d1735d21..c56e580f 100644
4b0001
--- a/policycoreutils/semodule/semodule.8
4b0001
+++ b/policycoreutils/semodule/semodule.8
4b0001
@@ -23,12 +23,12 @@ force a reload of policy
4b0001
 .B \-B, \-\-build
4b0001
 force a rebuild of policy (also reloads unless \-n is used)
4b0001
 .TP
4b0001
-.B \-\-rebuild-if-modules-changed
4b0001
-Force a rebuild of the policy if any changes to module content are detected
4b0001
-(by comparing with checksum from the last transaction).  One can use this
4b0001
-instead of \-B to ensure that any changes to the module store done by an
4b0001
-external tool (e.g. a package manager) are applied, while automatically
4b0001
-skipping the rebuild if there are no new changes.
4b0001
+.B \-\-refresh
4b0001
+Like \-\-build, but reuses existing linked policy if no changes to module
4b0001
+files are detected (by comparing with checksum from the last transaction).
4b0001
+One can use this instead of \-B to ensure that any changes to the module
4b0001
+store done by an external tool (e.g. a package manager) are applied, while
4b0001
+automatically skipping the module re-linking if there are no module changes.
4b0001
 .TP
4b0001
 .B \-D, \-\-disable_dontaudit
4b0001
 Temporarily remove dontaudits from policy.  Reverts whenever policy is rebuilt
4b0001
diff --git a/policycoreutils/semodule/semodule.c b/policycoreutils/semodule/semodule.c
4b0001
index 22a42a75..324ec9fb 100644
4b0001
--- a/policycoreutils/semodule/semodule.c
4b0001
+++ b/policycoreutils/semodule/semodule.c
4b0001
@@ -149,9 +149,12 @@ static void usage(char *progname)
4b0001
 	printf("  -c, --cil extract module as cil. This only affects module extraction.\n");
4b0001
 	printf("  -H, --hll extract module as hll. This only affects module extraction.\n");
4b0001
 	printf("  -m, --checksum   print module checksum (SHA256).\n");
4b0001
-	printf("      --rebuild-if-modules-changed\n"
4b0001
-	       "                   force policy rebuild if module content changed since\n"
4b0001
-	       "                   last rebuild (based on checksum)\n");
4b0001
+	printf("      --refresh    like --build, but reuses existing linked policy if no\n"
4b0001
+	       "                   changes to module files are detected (via checksum)\n");
4b0001
+	printf("Deprecated options:\n");
4b0001
+	printf("  -b,--base	   same as --install\n");
4b0001
+	printf("  --rebuild-if-modules-changed\n"
4b0001
+	       "                   same as --refresh\n");
4b0001
 }
4b0001
 
4b0001
 /* Sets the global mode variable to new_mode, but only if no other
4b0001
@@ -184,6 +187,7 @@ static void parse_command_line(int argc, char **argv)
4b0001
 {
4b0001
 	static struct option opts[] = {
4b0001
 		{"rebuild-if-modules-changed", 0, NULL, '\0'},
4b0001
+		{"refresh", 0, NULL, '\0'},
4b0001
 		{"store", required_argument, NULL, 's'},
4b0001
 		{"base", required_argument, NULL, 'b'},
4b0001
 		{"help", 0, NULL, 'h'},
4b0001
@@ -224,6 +228,9 @@ static void parse_command_line(int argc, char **argv)
4b0001
 		case '\0':
4b0001
 			switch(longind) {
4b0001
 			case 0: /* --rebuild-if-modules-changed */
4b0001
+				fprintf(stderr, "The --rebuild-if-modules-changed option is deprecated. Use --refresh instead.\n");
4b0001
+				/* fallthrough */
4b0001
+			case 1: /* --refresh */
4b0001
 				check_ext_changes = 1;
4b0001
 				break;
4b0001
 			default:
4b0001
-- 
4b0001
2.35.3
4b0001