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

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