Blame SOURCES/0002-Default---keep-all-metadata-to-TRUE-and-add---discard-additional-metadata.patch

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