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

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