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

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