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

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