Blame 0001-Default-keep-all-metadata-to-TRUE-and-add-discard-ad.patch

Lukáš Hrázký 4e70f6
From 6062c13a0884915a896aa2cec491560908483404 Mon Sep 17 00:00:00 2001
Lukáš Hrázký 4e70f6
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
78cae4
Date: Thu, 23 Sep 2021 08:30:47 +0200
Lukáš Hrázký 4e70f6
Subject: [PATCH] Default --keep-all-metadata to TRUE and add
Lukáš Hrázký 4e70f6
 --discard-additional-metadata
78cae4
78cae4
= changelog =
78cae4
msg: Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata
78cae4
type: enhancement
78cae4
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1992209
78cae4
---
78cae4
 doc/createrepo_c.8 |  7 +++++--
78cae4
 src/cmd_parser.c   | 15 ++++++++++++---
78cae4
 src/cmd_parser.h   |  1 +
78cae4
 3 files changed, 18 insertions(+), 5 deletions(-)
78cae4
78cae4
diff --git a/doc/createrepo_c.8 b/doc/createrepo_c.8
78cae4
index c9017c5..1a3e101 100644
78cae4
--- a/doc/createrepo_c.8
78cae4
+++ b/doc/createrepo_c.8
78cae4
@@ -1,6 +1,6 @@
78cae4
 .\" Man page generated from reStructuredText.
78cae4
 .
78cae4
-.TH CREATEREPO_C 8 "2020-07-02" "" ""
78cae4
+.TH CREATEREPO_C 8 "2021-09-23" "" ""
78cae4
 .SH NAME
78cae4
 createrepo_c \- Create rpm-md format (xml-rpm-metadata) repository
78cae4
 .
78cae4
@@ -173,7 +173,10 @@ Generate zchunk files as well as the standard repodata.
78cae4
 Directory containing compression dictionaries for use by zchunk
78cae4
 .SS \-\-keep\-all\-metadata
78cae4
 .sp
78cae4
-Keep all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update.
78cae4
+Keep all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update (default).
78cae4
+.SS \-\-discard\-additional\-metadata
78cae4
+.sp
78cae4
+Discard all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update.
78cae4
 .SS \-\-compatibility
78cae4
 .sp
78cae4
 Enforce maximal compatibility with classical createrepo (Affects only: \-\-retain\-old\-md).
78cae4
diff --git a/src/cmd_parser.c b/src/cmd_parser.c
78cae4
index bbefa08..639d7e9 100644
78cae4
--- a/src/cmd_parser.c
78cae4
+++ b/src/cmd_parser.c
78cae4
@@ -65,6 +65,8 @@ struct CmdOptions _cmd_options = {
78cae4
         .zck_compression            = FALSE,
78cae4
         .zck_dict_dir               = NULL,
78cae4
         .recycle_pkglist            = FALSE,
78cae4
+
78cae4
+        .keep_all_metadata          = TRUE,
78cae4
     };
78cae4
 
78cae4
 
78cae4
@@ -168,6 +170,9 @@ static GOptionEntry cmd_entries[] =
78cae4
 #endif
78cae4
     { "keep-all-metadata", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.keep_all_metadata),
78cae4
       "Keep all additional metadata (not primary, filelists and other xml or sqlite files, "
78cae4
+      "nor their compressed variants) from source repository during update (default).", NULL },
78cae4
+    { "discard-additional-metadata", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.discard_additional_metadata),
78cae4
+      "Discard all additional metadata (not primary, filelists and other xml or sqlite files, "
78cae4
       "nor their compressed variants) from source repository during update.", NULL },
78cae4
     { "compatibility", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.compatibility),
78cae4
       "Enforce maximal compatibility with classical createrepo (Affects only: --retain-old-md).", NULL },
78cae4
@@ -510,9 +515,13 @@ check_arguments(struct CmdOptions *options,
78cae4
         x++;
78cae4
     }
78cae4
 
78cae4
-    // Check keep-all-metadata
78cae4
-    if (options->keep_all_metadata && !options->update) {
78cae4
-        g_warning("--keep-all-metadata has no effect (--update is not used)");
78cae4
+    if (options->discard_additional_metadata) {
78cae4
+        options->keep_all_metadata = FALSE;
78cae4
+    }
78cae4
+
78cae4
+    // Check discard-additional-metadata
78cae4
+    if (options->discard_additional_metadata && !options->update) {
78cae4
+        g_warning("--discard-additional-metadata has no effect (--update is not used)");
78cae4
     }
78cae4
 
78cae4
     // Process --distro tags
78cae4
diff --git a/src/cmd_parser.h b/src/cmd_parser.h
78cae4
index 32bcf99..03cfcf0 100644
78cae4
--- a/src/cmd_parser.h
78cae4
+++ b/src/cmd_parser.h
78cae4
@@ -77,6 +77,7 @@ struct CmdOptions {
78cae4
     char *zck_dict_dir;         /*!< directory with zchunk dictionaries */
78cae4
     gboolean keep_all_metadata; /*!< keep groupfile and updateinfo from source
78cae4
                                      repo during update */
78cae4
+    gboolean discard_additional_metadata; /*!< Inverse option to keep_all_metadata */
78cae4
     gboolean ignore_lock;       /*!< Ignore existing .repodata/ - remove it,
78cae4
                                      create the new one (empty) to serve as
78cae4
                                      a lock and use a .repodata.date.pid for
Lukáš Hrázký 4e70f6
-- 
Lukáš Hrázký 4e70f6
2.34.3
78cae4