From 78cae4be7bf4d00a8ea14624edb287f8bc1e6cef Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Feb 16 2022 11:58:40 +0000 Subject: Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata Resolves: rhbz#2055032 --- diff --git a/0001-Default---keep-all-metadata-to-TRUE-and-add---discard-additional-metadata.patch b/0001-Default---keep-all-metadata-to-TRUE-and-add---discard-additional-metadata.patch new file mode 100644 index 0000000..b45969c --- /dev/null +++ b/0001-Default---keep-all-metadata-to-TRUE-and-add---discard-additional-metadata.patch @@ -0,0 +1,94 @@ +From b5f425fec738c1de344f4f917d3614e9efb98e2b Mon Sep 17 00:00:00 2001 +From: Aleš Matěj +Date: Thu, 23 Sep 2021 08:30:47 +0200 +Subject: [PATCH] Default --keep-all-metadata to TRUE and add --discard-additional-metadata + += changelog = +msg: Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata +type: enhancement +resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1992209 +--- + doc/createrepo_c.8 | 7 +++++-- + src/cmd_parser.c | 15 ++++++++++++--- + src/cmd_parser.h | 1 + + 3 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/doc/createrepo_c.8 b/doc/createrepo_c.8 +index c9017c5..1a3e101 100644 +--- a/doc/createrepo_c.8 ++++ b/doc/createrepo_c.8 +@@ -1,6 +1,6 @@ + .\" Man page generated from reStructuredText. + . +-.TH CREATEREPO_C 8 "2020-07-02" "" "" ++.TH CREATEREPO_C 8 "2021-09-23" "" "" + .SH NAME + createrepo_c \- Create rpm-md format (xml-rpm-metadata) repository + . +@@ -173,7 +173,10 @@ Generate zchunk files as well as the standard repodata. + Directory containing compression dictionaries for use by zchunk + .SS \-\-keep\-all\-metadata + .sp +-Keep all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update. ++Keep all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update (default). ++.SS \-\-discard\-additional\-metadata ++.sp ++Discard all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update. + .SS \-\-compatibility + .sp + Enforce maximal compatibility with classical createrepo (Affects only: \-\-retain\-old\-md). +diff --git a/src/cmd_parser.c b/src/cmd_parser.c +index bbefa08..639d7e9 100644 +--- a/src/cmd_parser.c ++++ b/src/cmd_parser.c +@@ -65,6 +65,8 @@ struct CmdOptions _cmd_options = { + .zck_compression = FALSE, + .zck_dict_dir = NULL, + .recycle_pkglist = FALSE, ++ ++ .keep_all_metadata = TRUE, + }; + + +@@ -168,6 +170,9 @@ static GOptionEntry cmd_entries[] = + #endif + { "keep-all-metadata", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.keep_all_metadata), + "Keep all additional metadata (not primary, filelists and other xml or sqlite files, " ++ "nor their compressed variants) from source repository during update (default).", NULL }, ++ { "discard-additional-metadata", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.discard_additional_metadata), ++ "Discard all additional metadata (not primary, filelists and other xml or sqlite files, " + "nor their compressed variants) from source repository during update.", NULL }, + { "compatibility", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.compatibility), + "Enforce maximal compatibility with classical createrepo (Affects only: --retain-old-md).", NULL }, +@@ -510,9 +515,13 @@ check_arguments(struct CmdOptions *options, + x++; + } + +- // Check keep-all-metadata +- if (options->keep_all_metadata && !options->update) { +- g_warning("--keep-all-metadata has no effect (--update is not used)"); ++ if (options->discard_additional_metadata) { ++ options->keep_all_metadata = FALSE; ++ } ++ ++ // Check discard-additional-metadata ++ if (options->discard_additional_metadata && !options->update) { ++ g_warning("--discard-additional-metadata has no effect (--update is not used)"); + } + + // Process --distro tags +diff --git a/src/cmd_parser.h b/src/cmd_parser.h +index 32bcf99..03cfcf0 100644 +--- a/src/cmd_parser.h ++++ b/src/cmd_parser.h +@@ -77,6 +77,7 @@ struct CmdOptions { + char *zck_dict_dir; /*!< directory with zchunk dictionaries */ + gboolean keep_all_metadata; /*!< keep groupfile and updateinfo from source + repo during update */ ++ gboolean discard_additional_metadata; /*!< Inverse option to keep_all_metadata */ + gboolean ignore_lock; /*!< Ignore existing .repodata/ - remove it, + create the new one (empty) to serve as + a lock and use a .repodata.date.pid for +-- +libgit2 1.1.0 + diff --git a/createrepo_c.spec b/createrepo_c.spec index 2d6fdcd..7aa15ea 100644 --- a/createrepo_c.spec +++ b/createrepo_c.spec @@ -25,10 +25,11 @@ Summary: Creates a common metadata repository Name: createrepo_c Version: 0.17.7 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: https://github.com/rpm-software-management/createrepo_c Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Patch1: 0001-Default---keep-all-metadata-to-TRUE-and-add---discard-additional-metadata.patch BuildRequires: cmake BuildRequires: gcc @@ -175,6 +176,9 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo %{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info %changelog +* Wed Feb 16 2022 Pavla Kratochvilova - 0.17.7-2 +- Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata (RhBug:2055032) + * Mon Oct 25 2021 Pavla Kratochvilova - 0.17.7-1 - Update to 0.17.7 - Remove insecure hashes SHA-1 and MD5 from the default build (RhBug:1935486)