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

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