Skip to content

Commit

Permalink
Use a gzip compression by default when --compatibility is specified
Browse files Browse the repository at this point in the history
Unless the user explicitly asks for a different compression algo.
  • Loading branch information
dralley authored and kontura committed Jan 4, 2024
1 parent 6519820 commit 60f245b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/createrepo_c.8
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Keep all additional metadata (not primary, filelists and other xml or sqlite fil
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).
Enforce maximal compatibility with classical createrepo (Changes \-\-retain\-old\-md behavior, uses Gzip for compression).
.SS \-\-retain\-old\-md\-by\-age AGE
.sp
During \-\-update, remove all files in repodata/ which are older then the specified period of time. (e.g. \(aq2h\(aq, \(aq30d\(aq, ...). Available units (m \- minutes, h \- hours, d \- days)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static GOptionEntry cmd_entries[] =
"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 },
"Enforce maximal compatibility with classical createrepo (Changes --retain-old-md behavior, uses Gzip for compression).", NULL },
{ "retain-old-md-by-age", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.retain_old_md_by_age),
"During --update, remove all files in repodata/ which are older "
"then the specified period of time. (e.g. '2h', '30d', ...). "
Expand Down
5 changes: 5 additions & 0 deletions src/createrepo_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,11 @@ main(int argc, char **argv)
cr_CompressionType sqlite_compression = CR_CW_BZ2_COMPRESSION;
cr_CompressionType compression = CR_CW_ZSTD_COMPRESSION;

if (cmd_options->compatibility) {
xml_compression = CR_CW_GZ_COMPRESSION;
compression = CR_CW_GZ_COMPRESSION;
}

if (cmd_options->compression_type != CR_CW_UNKNOWN_COMPRESSION) {
sqlite_compression = cmd_options->compression_type;
compression = cmd_options->compression_type;
Expand Down

0 comments on commit 60f245b

Please sign in to comment.