const char *compression_suffix = NULL;
CompressionType used_compression = GZ_COMPRESSION;
+ CompressionType groupfile_compression = GZ_COMPRESSION;
if (cmd_options->xz_compression) {
- used_compression = XZ_COMPRESSION;
+ groupfile_compression = XZ_COMPRESSION;
}
compression_suffix = get_suffix(used_compression);
struct repomdResult *repomd_res = xml_repomd(out_dir, cmd_options->unique_md_filenames,
pri_xml_name, fil_xml_name, oth_xml_name,
NULL, NULL, NULL, groupfile_name, NULL,
- &(cmd_options->checksum_type));
+ &(cmd_options->checksum_type),
+ groupfile_compression);
gchar *repomd_path = g_strconcat(out_repo, "repomd.xml", NULL);
FILE *frepomd = fopen(repomd_path, "w");
struct repomdResult *repomd_res = xml_repomd(cmd_options->out_dir, 1, pri_xml_name,
fil_xml_name, oth_xml_name, NULL, NULL,
- NULL, groupfile, ui_xml_name, NULL);
+ NULL, groupfile, ui_xml_name, NULL,
+ cmd_options->compression_type);
if (repomd_res) {
if (repomd_res->repomd_xml) {
gchar *repomd_path = g_strconcat(cmd_options->out_repo, "repomd.xml", NULL);
void process_groupfile(const char *base_path, struct repomdData *groupfile,
- struct repomdData *cgroupfile, ChecksumType *checksum_type)
+ struct repomdData *cgroupfile, ChecksumType *checksum_type,
+ CompressionType groupfile_compression)
{
if (!groupfile || !(groupfile->location_href) || !strlen(groupfile->location_href) || !cgroupfile) {
return;
// Paths
- gchar *clocation_href = g_strconcat(groupfile->location_href, ".gz", NULL);
+ const char *suffix = get_suffix(groupfile_compression);
+
+ gchar *clocation_href = g_strconcat(groupfile->location_href, suffix, NULL);
cgroupfile->location_href = g_string_chunk_insert(cgroupfile->chunk, clocation_href);
g_free(clocation_href);
CW_FILE *cw_compressed;
cw_plain = cw_open(path, CW_MODE_READ, NO_COMPRESSION);
- cw_compressed = cw_open(cpath, CW_MODE_WRITE, GZ_COMPRESSION);
+ cw_compressed = cw_open(cpath, CW_MODE_WRITE, groupfile_compression);
while ((readed = cw_read(cw_plain, buf, BUFFER_SIZE)) > 0) {
if (cw_write(cw_compressed, buf, (unsigned int) readed) == CW_ERR) {
struct repomdData *pri_sqlite, struct repomdData *fil_sqlite,
struct repomdData *oth_sqlite, struct repomdData *groupfile,
struct repomdData *cgroupfile, struct repomdData *update_info,
- ChecksumType *checksum_type)
+ ChecksumType *checksum_type, CompressionType groupfile_compression)
{
if (!path) {
return NULL;
fill_missing_data(path, oth_sqlite, checksum_type);
fill_missing_data(path, update_info, checksum_type);
- process_groupfile(path, groupfile, cgroupfile, checksum_type);
+ process_groupfile(path, groupfile, cgroupfile, checksum_type, groupfile_compression);
// Include checksum in the metadata filename
const char *fil_xml, const char *oth_xml,
const char *pri_sqlite, const char *fil_sqlite,
const char *oth_sqlite, const char *groupfile,
- const char *update_info, ChecksumType *checksum_type)
+ const char *update_info, ChecksumType *checksum_type,
+ CompressionType groupfile_compression)
{
if (!path) {
return NULL;
pri_xml_rd, fil_xml_rd, oth_xml_rd,
pri_sqlite_rd, fil_sqlite_rd, oth_sqlite_rd,
groupfile_rd, cgroupfile_rd, update_info_rd,
- checksum_type);
+ checksum_type, groupfile_compression);
free_repomddata(pri_xml_rd);
free_repomddata(fil_xml_rd);
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
+#include "compression_wrapper.h"
#include "package.h"
/** \defgroup repomd Repomd API.
const char *fil_xml, const char *oth_xml,
const char *pri_sqlite, const char *fil_sqlite,
const char *oth_sqlite, const char *groupfile,
- const char *update_info, ChecksumType *checksum_type);
+ const char *update_info, ChecksumType *checksum_type,
+ CompressionType groupfile_compression);
#endif /* __C_CREATEREPOLIB_REPOMD_H__ */