Compare commits
No commits in common. "c8" and "c9-beta" have entirely different histories.
@ -1 +1 @@
|
|||||||
5f3e45a79255654c7315c8667197fd562fd2ff5c SOURCES/createrepo_c-0.17.7.tar.gz
|
3e76ff79089aebf9a503bdb82d59dc148c218d0f SOURCES/createrepo_c-0.20.1.tar.gz
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
SOURCES/createrepo_c-0.17.7.tar.gz
|
SOURCES/createrepo_c-0.20.1.tar.gz
|
||||||
|
|||||||
@ -1,384 +0,0 @@
|
|||||||
From 6bcfaac228236ac3c609d014cbd23c3bd645bf18 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aleš Matěj <amatej@redhat.com>
|
|
||||||
Date: Thu, 9 Sep 2021 08:31:03 +0200
|
|
||||||
Subject: [PATCH] Preserve changed API for cr_compress_file_with_stat (RhBug:1973588)
|
|
||||||
|
|
||||||
In order to be compatible in rhel8 we want to preserve the old API and
|
|
||||||
behavior.
|
|
||||||
|
|
||||||
Keep the fixed version as cr_compress_file_with_stat_v2 only for rhel8
|
|
||||||
|
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=1973588
|
|
||||||
|
|
||||||
With fixed memory leak of `tmp_err`, reported here:
|
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=2005781
|
|
||||||
---
|
|
||||||
src/misc.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
||||||
src/misc.h | 42 ++++++++++++++++++++++++++++++++++++++++--
|
|
||||||
src/modifyrepo_shared.c | 4 ++--
|
|
||||||
src/python/misc-py.c | 2 +-
|
|
||||||
src/threads.c | 14 +++++++-------
|
|
||||||
tests/test_misc.c | 34 +++++++++++++++++-----------------
|
|
||||||
6 files changed, 205 insertions(+), 30 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/misc.c b/src/misc.c
|
|
||||||
index 4bd9f4c..c4b2cb3 100644
|
|
||||||
--- a/src/misc.c
|
|
||||||
+++ b/src/misc.c
|
|
||||||
@@ -446,7 +446,7 @@ cr_copy_file(const char *src, const char *in_dst, GError **err)
|
|
||||||
|
|
||||||
int
|
|
||||||
cr_compress_file_with_stat(const char *src,
|
|
||||||
- const char *in_dst,
|
|
||||||
+ char **in_dst,
|
|
||||||
cr_CompressionType compression,
|
|
||||||
cr_ContentStat *stat,
|
|
||||||
const char *zck_dict_dir,
|
|
||||||
@@ -458,6 +458,143 @@ cr_compress_file_with_stat(const char *src,
|
|
||||||
char buf[BUFFER_SIZE];
|
|
||||||
CR_FILE *orig = NULL;
|
|
||||||
CR_FILE *new = NULL;
|
|
||||||
+ gchar *dst = (gchar *) *in_dst;
|
|
||||||
+ GError *tmp_err = NULL;
|
|
||||||
+
|
|
||||||
+ assert(src);
|
|
||||||
+ assert(!err || *err == NULL);
|
|
||||||
+
|
|
||||||
+ const char *c_suffix = cr_compression_suffix(compression);
|
|
||||||
+
|
|
||||||
+ // Src must be a file NOT a directory
|
|
||||||
+ if (!g_file_test(src, G_FILE_TEST_IS_REGULAR)) {
|
|
||||||
+ g_debug("%s: Source (%s) must be a regular file!", __func__, src);
|
|
||||||
+ g_set_error(err, ERR_DOMAIN, CRE_NOFILE,
|
|
||||||
+ "Not a regular file: %s", src);
|
|
||||||
+ return CRE_NOFILE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!dst) {
|
|
||||||
+ // If destination is NULL, use src + compression suffix
|
|
||||||
+ *in_dst = g_strconcat(src,
|
|
||||||
+ c_suffix,
|
|
||||||
+ NULL);
|
|
||||||
+ } else if (g_str_has_suffix(dst, "/")) {
|
|
||||||
+ // If destination is dir use filename from src + compression suffix
|
|
||||||
+ *in_dst = g_strconcat(dst,
|
|
||||||
+ cr_get_filename(src),
|
|
||||||
+ c_suffix,
|
|
||||||
+ NULL);
|
|
||||||
+ } else if (c_suffix && !g_str_has_suffix(dst, c_suffix)) {
|
|
||||||
+ cr_CompressionType old_type = cr_detect_compression(src, &tmp_err);
|
|
||||||
+ if (tmp_err) {
|
|
||||||
+ g_debug("%s: Unable to detect compression type of %s", __func__, src);
|
|
||||||
+ g_clear_error(&tmp_err);
|
|
||||||
+ } else if (old_type != CR_CW_NO_COMPRESSION) {
|
|
||||||
+ _cleanup_free_ gchar *tmp_file = g_strndup(dst, strlen(dst) - strlen(cr_compression_suffix(old_type)));
|
|
||||||
+ *in_dst = g_strconcat(tmp_file,
|
|
||||||
+ c_suffix,
|
|
||||||
+ NULL);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (dst != *in_dst && dst)
|
|
||||||
+ g_free(dst);
|
|
||||||
+ dst = (gchar *) *in_dst;
|
|
||||||
+
|
|
||||||
+ int mode = CR_CW_AUTO_DETECT_COMPRESSION;
|
|
||||||
+
|
|
||||||
+ orig = cr_open(src,
|
|
||||||
+ CR_CW_MODE_READ,
|
|
||||||
+ mode,
|
|
||||||
+ &tmp_err);
|
|
||||||
+ if (!orig) {
|
|
||||||
+ ret = tmp_err->code;
|
|
||||||
+ g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", src);
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ _cleanup_free_ gchar *dict = NULL;
|
|
||||||
+ size_t dict_size = 0;
|
|
||||||
+ if (compression == CR_CW_ZCK_COMPRESSION && zck_dict_dir) {
|
|
||||||
+ /* Find zdict */
|
|
||||||
+ _cleanup_free_ gchar *file_basename = NULL;
|
|
||||||
+ if (dst) {
|
|
||||||
+ _cleanup_free_ gchar *dict_base = NULL;
|
|
||||||
+ if (g_str_has_suffix(dst, ".zck"))
|
|
||||||
+ dict_base = g_strndup(dst, strlen(dst)-4);
|
|
||||||
+ else
|
|
||||||
+ dict_base = g_strdup(dst);
|
|
||||||
+ file_basename = g_path_get_basename(dict_base);
|
|
||||||
+ } else {
|
|
||||||
+ file_basename = g_path_get_basename(src);
|
|
||||||
+ }
|
|
||||||
+ _cleanup_free_ gchar *dict_file = cr_get_dict_file(zck_dict_dir, file_basename);
|
|
||||||
+
|
|
||||||
+ /* Read dictionary from file */
|
|
||||||
+ if (dict_file && !g_file_get_contents(dict_file, &dict,
|
|
||||||
+ &dict_size, &tmp_err)) {
|
|
||||||
+ g_set_error(err, ERR_DOMAIN, CRE_IO,
|
|
||||||
+ "Error reading zchunk dict %s: %s",
|
|
||||||
+ dict_file, tmp_err->message);
|
|
||||||
+ g_clear_error(&tmp_err);
|
|
||||||
+ ret = CRE_IO;
|
|
||||||
+ goto compress_file_cleanup;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ new = cr_sopen(dst, CR_CW_MODE_WRITE, compression, stat, &tmp_err);
|
|
||||||
+ if (tmp_err) {
|
|
||||||
+ g_debug("%s: Cannot open destination file %s", __func__, dst);
|
|
||||||
+ g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", dst);
|
|
||||||
+ ret = CRE_IO;
|
|
||||||
+ goto compress_file_cleanup;
|
|
||||||
+ }
|
|
||||||
+ if (compression == CR_CW_ZCK_COMPRESSION) {
|
|
||||||
+ if (dict && cr_set_dict(new, dict, dict_size, &tmp_err) != CRE_OK) {
|
|
||||||
+ ret = tmp_err->code;
|
|
||||||
+ g_propagate_prefixed_error(err, tmp_err, "Unable to set zdict for %s: ", dst);
|
|
||||||
+ goto compress_file_cleanup;
|
|
||||||
+ }
|
|
||||||
+ if (zck_auto_chunk && cr_set_autochunk(new, TRUE, &tmp_err) != CRE_OK) {
|
|
||||||
+ ret = tmp_err->code;
|
|
||||||
+ g_propagate_prefixed_error(err, tmp_err, "Unable to set auto-chunking for %s: ", dst);
|
|
||||||
+ goto compress_file_cleanup;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ while ((readed = cr_read(orig, buf, BUFFER_SIZE, &tmp_err)) > 0) {
|
|
||||||
+ cr_write(new, buf, readed, &tmp_err);
|
|
||||||
+ if (tmp_err) {
|
|
||||||
+ ret = tmp_err->code;
|
|
||||||
+ g_propagate_prefixed_error(err, tmp_err, "Unable to write to %s: ", dst);
|
|
||||||
+ goto compress_file_cleanup;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+compress_file_cleanup:
|
|
||||||
+
|
|
||||||
+ if (orig)
|
|
||||||
+ cr_close(orig, NULL);
|
|
||||||
+
|
|
||||||
+ if (new)
|
|
||||||
+ cr_close(new, NULL);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+cr_compress_file_with_stat_v2(const char *src,
|
|
||||||
+ const char *in_dst,
|
|
||||||
+ cr_CompressionType compression,
|
|
||||||
+ cr_ContentStat *stat,
|
|
||||||
+ const char *zck_dict_dir,
|
|
||||||
+ gboolean zck_auto_chunk,
|
|
||||||
+ GError **err)
|
|
||||||
+{
|
|
||||||
+ int ret = CRE_OK;
|
|
||||||
+ int readed;
|
|
||||||
+ char buf[BUFFER_SIZE];
|
|
||||||
+ CR_FILE *orig = NULL;
|
|
||||||
+ CR_FILE *new = NULL;
|
|
||||||
gchar *dst = (gchar *) in_dst;
|
|
||||||
GError *tmp_err = NULL;
|
|
||||||
|
|
||||||
diff --git a/src/misc.h b/src/misc.h
|
|
||||||
index 60f1a0f..528ccc3 100644
|
|
||||||
--- a/src/misc.h
|
|
||||||
+++ b/src/misc.h
|
|
||||||
@@ -184,9 +184,24 @@ gboolean cr_copy_file(const char *src,
|
|
||||||
cr_compress_file_with_stat(SRC, DST, COMTYPE, NULL, ZCK_DICT_DIR, \
|
|
||||||
ZCK_AUTO_CHUNK, ERR)
|
|
||||||
|
|
||||||
+/** Compress file. This function is temporary and present
|
|
||||||
+ * only in rhel 8, it will be removed in future versions.
|
|
||||||
+ * @param SRC source filename
|
|
||||||
+ * @param DST destination (If dst is dir, filename of src +
|
|
||||||
+ * compression suffix is used.
|
|
||||||
+ * If dst is NULL, src + compression suffix is used)
|
|
||||||
+ * @param COMTYPE type of compression
|
|
||||||
+ * @param ZCK_DICT_DIR Location of zchunk zdicts (if zchunk is enabled)
|
|
||||||
+ * @param ZCK_AUTO_CHUNK Whether zchunk file should be auto-chunked
|
|
||||||
+ * @param ERR GError **
|
|
||||||
+ * @return cr_Error return code
|
|
||||||
+ */
|
|
||||||
+#define cr_compress_file_v2(SRC, DST, COMTYPE, ZCK_DICT_DIR, ZCK_AUTO_CHUNK, ERR) \
|
|
||||||
+ cr_compress_file_with_stat_v2(SRC, DST, COMTYPE, NULL, ZCK_DICT_DIR, \
|
|
||||||
+ ZCK_AUTO_CHUNK, ERR)
|
|
||||||
/** Compress file.
|
|
||||||
* @param src source filename
|
|
||||||
- * @param dst destination (If dst is dir, filename of src +
|
|
||||||
+ * @param dst pointer to destination (If dst is dir, filename of src +
|
|
||||||
* compression suffix is used.
|
|
||||||
* If dst is NULL, src + compression suffix is used)
|
|
||||||
* @param comtype type of compression
|
|
||||||
@@ -197,13 +212,36 @@ gboolean cr_copy_file(const char *src,
|
|
||||||
* @return cr_Error return code
|
|
||||||
*/
|
|
||||||
int cr_compress_file_with_stat(const char *src,
|
|
||||||
- const char *dst,
|
|
||||||
+ char **dst,
|
|
||||||
cr_CompressionType comtype,
|
|
||||||
cr_ContentStat *stat,
|
|
||||||
const char *zck_dict_dir,
|
|
||||||
gboolean zck_auto_chunk,
|
|
||||||
GError **err);
|
|
||||||
|
|
||||||
+/** Compress file with stat versions 2. This function is temporary and present
|
|
||||||
+ * only in rhel 8, it will be removed in future versions.
|
|
||||||
+ * It is a compatibility function that preserves the API and behavior of
|
|
||||||
+ * cr_compress_file_with_stat from createrepo_c-0.12.0.
|
|
||||||
+ * @param src source filename
|
|
||||||
+ * @param dst destination (If dst is dir, filename of src +
|
|
||||||
+ * compression suffix is used.
|
|
||||||
+ * If dst is NULL, src + compression suffix is used)
|
|
||||||
+ * @param comtype type of compression
|
|
||||||
+ * @param stat pointer to cr_ContentStat or NULL
|
|
||||||
+ * @param zck_dict_dir Location of zchunk zdicts (if zchunk is enabled)
|
|
||||||
+ * @param zck_auto_chunk Whether zchunk file should be auto-chunked
|
|
||||||
+ * @param err GError **
|
|
||||||
+ * @return cr_Error return code
|
|
||||||
+ */
|
|
||||||
+int cr_compress_file_with_stat_v2(const char *src,
|
|
||||||
+ const char *dst,
|
|
||||||
+ cr_CompressionType comtype,
|
|
||||||
+ cr_ContentStat *stat,
|
|
||||||
+ const char *zck_dict_dir,
|
|
||||||
+ gboolean zck_auto_chunk,
|
|
||||||
+ GError **err);
|
|
||||||
+
|
|
||||||
/** Decompress file.
|
|
||||||
* @param SRC source filename
|
|
||||||
* @param DST destination (If dst is dir, filename of src without
|
|
||||||
diff --git a/src/modifyrepo_shared.c b/src/modifyrepo_shared.c
|
|
||||||
index 4e59660..8cf246d 100644
|
|
||||||
--- a/src/modifyrepo_shared.c
|
|
||||||
+++ b/src/modifyrepo_shared.c
|
|
||||||
@@ -120,8 +120,8 @@ cr_write_file(gchar *repopath, cr_ModifyRepoTask *task,
|
|
||||||
g_debug("%s: Copy & compress operation %s -> %s",
|
|
||||||
__func__, src_fn, dst_fn);
|
|
||||||
|
|
||||||
- if (cr_compress_file(src_fn, dst_fn, compress_type,
|
|
||||||
- task->zck_dict_dir, TRUE, err) != CRE_OK) {
|
|
||||||
+ if (cr_compress_file_v2(src_fn, dst_fn, compress_type,
|
|
||||||
+ task->zck_dict_dir, TRUE, err) != CRE_OK) {
|
|
||||||
g_debug("%s: Copy & compress operation failed", __func__);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
diff --git a/src/python/misc-py.c b/src/python/misc-py.c
|
|
||||||
index 6a7871e..cc28448 100644
|
|
||||||
--- a/src/python/misc-py.c
|
|
||||||
+++ b/src/python/misc-py.c
|
|
||||||
@@ -49,7 +49,7 @@ py_compress_file_with_stat(G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- cr_compress_file_with_stat(src, dst, type, contentstat, NULL, FALSE, &tmp_err);
|
|
||||||
+ cr_compress_file_with_stat_v2(src, dst, type, contentstat, NULL, FALSE, &tmp_err);
|
|
||||||
if (tmp_err) {
|
|
||||||
nice_exception(&tmp_err, NULL);
|
|
||||||
return NULL;
|
|
||||||
diff --git a/src/threads.c b/src/threads.c
|
|
||||||
index f0c3f93..b529d55 100644
|
|
||||||
--- a/src/threads.c
|
|
||||||
+++ b/src/threads.c
|
|
||||||
@@ -101,13 +101,13 @@ cr_compressing_thread(gpointer data, G_GNUC_UNUSED gpointer user_data)
|
|
||||||
cr_compression_suffix(task->type),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
- cr_compress_file_with_stat(task->src,
|
|
||||||
- task->dst,
|
|
||||||
- task->type,
|
|
||||||
- task->stat,
|
|
||||||
- task->zck_dict_dir,
|
|
||||||
- task->zck_auto_chunk,
|
|
||||||
- &tmp_err);
|
|
||||||
+ cr_compress_file_with_stat_v2(task->src,
|
|
||||||
+ task->dst,
|
|
||||||
+ task->type,
|
|
||||||
+ task->stat,
|
|
||||||
+ task->zck_dict_dir,
|
|
||||||
+ task->zck_auto_chunk,
|
|
||||||
+ &tmp_err);
|
|
||||||
|
|
||||||
if (tmp_err) {
|
|
||||||
// Error encountered
|
|
||||||
diff --git a/tests/test_misc.c b/tests/test_misc.c
|
|
||||||
index 6614809..1acccb7 100644
|
|
||||||
--- a/tests/test_misc.c
|
|
||||||
+++ b/tests/test_misc.c
|
|
||||||
@@ -548,8 +548,8 @@ compressfile_test_text_file(Copyfiletest *copyfiletest,
|
|
||||||
GError *tmp_err = NULL;
|
|
||||||
|
|
||||||
g_assert(!g_file_test(copyfiletest->dst_file, G_FILE_TEST_EXISTS));
|
|
||||||
- ret = cr_compress_file(TEST_TEXT_FILE, copyfiletest->dst_file,
|
|
||||||
- CR_CW_GZ_COMPRESSION, NULL, FALSE, &tmp_err);
|
|
||||||
+ ret = cr_compress_file_v2(TEST_TEXT_FILE, copyfiletest->dst_file,
|
|
||||||
+ CR_CW_GZ_COMPRESSION, NULL, FALSE, &tmp_err);
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
g_assert_cmpint(ret, ==, CRE_OK);
|
|
||||||
g_assert(g_file_test(copyfiletest->dst_file, G_FILE_TEST_IS_REGULAR));
|
|
||||||
@@ -574,9 +574,9 @@ compressfile_with_stat_test_text_file(Copyfiletest *copyfiletest,
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
|
|
||||||
g_assert(!g_file_test(copyfiletest->dst_file, G_FILE_TEST_EXISTS));
|
|
||||||
- ret = cr_compress_file_with_stat(TEST_TEXT_FILE, copyfiletest->dst_file,
|
|
||||||
- CR_CW_GZ_COMPRESSION, stat, NULL, FALSE,
|
|
||||||
- &tmp_err);
|
|
||||||
+ ret = cr_compress_file_with_stat_v2(TEST_TEXT_FILE, copyfiletest->dst_file,
|
|
||||||
+ CR_CW_GZ_COMPRESSION, stat, NULL, FALSE,
|
|
||||||
+ &tmp_err);
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
g_assert_cmpint(ret, ==, CRE_OK);
|
|
||||||
g_assert(g_file_test(copyfiletest->dst_file, G_FILE_TEST_IS_REGULAR));
|
|
||||||
@@ -603,9 +603,9 @@ compressfile_with_stat_test_gz_file_gz_output(Copyfiletest *copyfiletest,
|
|
||||||
char * dst_full_name = g_strconcat(copyfiletest->dst_file, ".gz", NULL);
|
|
||||||
|
|
||||||
g_assert(!g_file_test(dst_full_name, G_FILE_TEST_EXISTS));
|
|
||||||
- ret = cr_compress_file_with_stat(TEST_TEXT_FILE_GZ, dst_full_name,
|
|
||||||
- CR_CW_GZ_COMPRESSION, stat, NULL, FALSE,
|
|
||||||
- &tmp_err);
|
|
||||||
+ ret = cr_compress_file_with_stat_v2(TEST_TEXT_FILE_GZ, dst_full_name,
|
|
||||||
+ CR_CW_GZ_COMPRESSION, stat, NULL, FALSE,
|
|
||||||
+ &tmp_err);
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
g_assert_cmpint(ret, ==, CRE_OK);
|
|
||||||
g_assert(g_file_test(dst_full_name, G_FILE_TEST_IS_REGULAR));
|
|
||||||
@@ -633,9 +633,9 @@ compressfile_test_gz_file_xz_output(Copyfiletest *copyfiletest,
|
|
||||||
char * dst_full_name = g_strconcat(copyfiletest->dst_file, ".xz", NULL);
|
|
||||||
|
|
||||||
g_assert(!g_file_test(dst_full_name, G_FILE_TEST_EXISTS));
|
|
||||||
- ret = cr_compress_file(TEST_TEXT_FILE_GZ, dst_full_name,
|
|
||||||
- CR_CW_XZ_COMPRESSION, NULL, FALSE,
|
|
||||||
- &tmp_err);
|
|
||||||
+ ret = cr_compress_file_v2(TEST_TEXT_FILE_GZ, dst_full_name,
|
|
||||||
+ CR_CW_XZ_COMPRESSION, NULL, FALSE,
|
|
||||||
+ &tmp_err);
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
g_assert_cmpint(ret, ==, CRE_OK);
|
|
||||||
g_assert(g_file_test(dst_full_name, G_FILE_TEST_IS_REGULAR));
|
|
||||||
@@ -660,9 +660,9 @@ compressfile_test_xz_file_gz_output(Copyfiletest *copyfiletest,
|
|
||||||
char * dst_full_name = g_strconcat(copyfiletest->dst_file, ".gz", NULL);
|
|
||||||
|
|
||||||
g_assert(!g_file_test(dst_full_name, G_FILE_TEST_EXISTS));
|
|
||||||
- ret = cr_compress_file(TEST_TEXT_FILE_XZ, dst_full_name,
|
|
||||||
- CR_CW_GZ_COMPRESSION, NULL, FALSE,
|
|
||||||
- &tmp_err);
|
|
||||||
+ ret = cr_compress_file_v2(TEST_TEXT_FILE_XZ, dst_full_name,
|
|
||||||
+ CR_CW_GZ_COMPRESSION, NULL, FALSE,
|
|
||||||
+ &tmp_err);
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
g_assert_cmpint(ret, ==, CRE_OK);
|
|
||||||
g_assert(g_file_test(dst_full_name, G_FILE_TEST_IS_REGULAR));
|
|
||||||
@@ -687,9 +687,9 @@ compressfile_test_sqlite_file_gz_output(Copyfiletest *copyfiletest,
|
|
||||||
char * dst_full_name = g_strconcat(copyfiletest->dst_file, ".gz", NULL);
|
|
||||||
|
|
||||||
g_assert(!g_file_test(dst_full_name, G_FILE_TEST_EXISTS));
|
|
||||||
- ret = cr_compress_file(TEST_SQLITE_FILE, dst_full_name,
|
|
||||||
- CR_CW_GZ_COMPRESSION, NULL, FALSE,
|
|
||||||
- &tmp_err);
|
|
||||||
+ ret = cr_compress_file_v2(TEST_SQLITE_FILE, dst_full_name,
|
|
||||||
+ CR_CW_GZ_COMPRESSION, NULL, FALSE,
|
|
||||||
+ &tmp_err);
|
|
||||||
g_assert(!tmp_err);
|
|
||||||
g_assert_cmpint(ret, ==, CRE_OK);
|
|
||||||
g_assert(g_file_test(dst_full_name, G_FILE_TEST_EXISTS));
|
|
||||||
--
|
|
||||||
libgit2 1.1.0
|
|
||||||
|
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
From 3b69916685cd1dc1a64a59d9e1b90921de91e2d0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Alley <dalley@redhat.com>
|
||||||
|
Date: Fri, 13 Jan 2023 00:06:12 -0500
|
||||||
|
Subject: [PATCH] Change test to compare contents instead of checksum
|
||||||
|
|
||||||
|
Different implementations of the DEFLATE algorithm can produce different
|
||||||
|
(but equally valid) gzip files. This can cause test failure if a
|
||||||
|
different implementation (e.g. hardware acceleration) is used.
|
||||||
|
---
|
||||||
|
tests/test_misc.c | 11 ++++++-----
|
||||||
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_misc.c b/tests/test_misc.c
|
||||||
|
index 6614809..f8025cb 100644
|
||||||
|
--- a/tests/test_misc.c
|
||||||
|
+++ b/tests/test_misc.c
|
||||||
|
@@ -544,19 +544,20 @@ compressfile_test_text_file(Copyfiletest *copyfiletest,
|
||||||
|
G_GNUC_UNUSED gconstpointer test_data)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
- char *checksum;
|
||||||
|
GError *tmp_err = NULL;
|
||||||
|
|
||||||
|
g_assert(!g_file_test(copyfiletest->dst_file, G_FILE_TEST_EXISTS));
|
||||||
|
+
|
||||||
|
ret = cr_compress_file(TEST_TEXT_FILE, copyfiletest->dst_file,
|
||||||
|
CR_CW_GZ_COMPRESSION, NULL, FALSE, &tmp_err);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
g_assert_cmpint(ret, ==, CRE_OK);
|
||||||
|
g_assert(g_file_test(copyfiletest->dst_file, G_FILE_TEST_IS_REGULAR));
|
||||||
|
- checksum = cr_checksum_file(copyfiletest->dst_file, CR_CHECKSUM_SHA256, NULL);
|
||||||
|
- g_assert_cmpstr(checksum, ==, "8909fde88a5747d800fd2562b0f22945f014aa7df64"
|
||||||
|
- "cf1c15c7933ae54b72ab6");
|
||||||
|
- g_free(checksum);
|
||||||
|
+
|
||||||
|
+ // assert content is readable after compression and decompression
|
||||||
|
+ char buf[30];
|
||||||
|
+ read_file(copyfiletest->dst_file, CR_CW_GZ_COMPRESSION, buf, 30);
|
||||||
|
+ g_assert(g_strrstr(buf, "Lorem ipsum dolor sit amet"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
||||||
|
|
||||||
|
From 7844b63d932f36084a927b3cc8900cc0971436f3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Alley <dalley@redhat.com>
|
||||||
|
Date: Fri, 13 Jan 2023 12:52:42 -0500
|
||||||
|
Subject: [PATCH] Remove 11 year old polyfill
|
||||||
|
|
||||||
|
---
|
||||||
|
src/compression_wrapper.c | 7 +------
|
||||||
|
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
|
||||||
|
index 15e9e38..b23c345 100644
|
||||||
|
--- a/src/compression_wrapper.c
|
||||||
|
+++ b/src/compression_wrapper.c
|
||||||
|
@@ -86,11 +86,6 @@ LZMA_CHECK_SHA256
|
||||||
|
#define XZ_DECODER_FLAGS 0
|
||||||
|
#define XZ_BUFFER_SIZE (1024*32)
|
||||||
|
|
||||||
|
-#if ZLIB_VERNUM < 0x1240
|
||||||
|
-// XXX: Zlib has gzbuffer since 1.2.4
|
||||||
|
-#define gzbuffer(a,b) 0
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
cr_ContentStat *
|
||||||
|
cr_contentstat_new(cr_ChecksumType type, GError **err)
|
||||||
|
{
|
||||||
|
@@ -1549,7 +1544,7 @@ cr_printf(GError **err, CR_FILE *cr_file, const char *format, ...)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-ssize_t
|
||||||
|
+ssize_t
|
||||||
|
cr_get_zchunk_with_index(CR_FILE *cr_file, ssize_t zchunk_index, char **copy_buf, GError **err)
|
||||||
|
{
|
||||||
|
assert(cr_file);
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
||||||
|
|
||||||
|
From ad34359fbcaefb6fd5053a56b0472572ea2270b5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Alley <dalley@redhat.com>
|
||||||
|
Date: Fri, 13 Jan 2023 13:05:16 -0500
|
||||||
|
Subject: [PATCH] Fix compile warning, off by one
|
||||||
|
|
||||||
|
closes #337
|
||||||
|
---
|
||||||
|
src/checksum.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/checksum.c b/src/checksum.c
|
||||||
|
index ef420a1..1ae2a54 100644
|
||||||
|
--- a/src/checksum.c
|
||||||
|
+++ b/src/checksum.c
|
||||||
|
@@ -49,7 +49,7 @@ cr_checksum_type(const char *name)
|
||||||
|
if (len > MAX_CHECKSUM_NAME_LEN)
|
||||||
|
return CR_CHECKSUM_UNKNOWN;
|
||||||
|
|
||||||
|
- for (size_t x = 0; x <= len; x++)
|
||||||
|
+ for (size_t x = 0; x < len; x++)
|
||||||
|
name_lower[x] = tolower(name[x]);
|
||||||
|
|
||||||
|
if (!strncmp(name_lower, "sha", 3)) {
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
||||||
492
SOURCES/0002-Add-zstd-compression-support.patch
Normal file
492
SOURCES/0002-Add-zstd-compression-support.patch
Normal file
@ -0,0 +1,492 @@
|
|||||||
|
From 126a79f7e313090c0bb09993f7bace43a7d05e7b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||||
|
Date: Tue, 17 Aug 2021 14:27:47 +0200
|
||||||
|
Subject: [PATCH 1/4] Add zstd compression support
|
||||||
|
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 9 ++
|
||||||
|
README.md | 1 +
|
||||||
|
createrepo_c.spec | 9 +-
|
||||||
|
doc/createrepo_c.8 | 2 +-
|
||||||
|
src/CMakeLists.txt | 1 +
|
||||||
|
src/cmd_parser.c | 6 +-
|
||||||
|
src/compression_wrapper.c | 192 ++++++++++++++++++++++++++++
|
||||||
|
src/compression_wrapper.h | 1 +
|
||||||
|
src/error.h | 2 +
|
||||||
|
src/python/createrepo_c/__init__.py | 3 +
|
||||||
|
src/python/createrepo_cmodule.c | 1 +
|
||||||
|
11 files changed, 223 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index b016960..40d43b6 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -21,6 +21,8 @@ if(NOT BUILD_LIBCREATEREPO_C_SHARED)
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+option(WITH_ZSTD "Build with zstd support" ON)
|
||||||
|
+
|
||||||
|
option(CREATEREPO_C_INSTALL_DEVELOPMENT "Install createrepo_c development files." ON)
|
||||||
|
option(CREATEREPO_C_INSTALL_MANPAGES "Install createrepo_c man-pages." ON)
|
||||||
|
|
||||||
|
@@ -100,6 +102,13 @@ IF (WITH_LIBMODULEMD)
|
||||||
|
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DWITH_LIBMODULEMD")
|
||||||
|
ENDIF (WITH_LIBMODULEMD)
|
||||||
|
|
||||||
|
+if (WITH_ZSTD)
|
||||||
|
+ pkg_check_modules(ZSTD REQUIRED libzstd)
|
||||||
|
+ include_directories(${ZSTD_INCLUDE_DIRS})
|
||||||
|
+ SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_ZSTD")
|
||||||
|
+ SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DWITH_ZSTD")
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
# Threaded XZ Compression
|
||||||
|
# Note: This option is disabled by default, because Createrepo_c
|
||||||
|
# parallelize a lot of tasks (including compression) by default, this
|
||||||
|
diff --git a/README.md b/README.md
|
||||||
|
index de2cd01..95b03ce 100644
|
||||||
|
--- a/README.md
|
||||||
|
+++ b/README.md
|
||||||
|
@@ -25,6 +25,7 @@ Package build requires - Pkg name in Fedora/Ubuntu:
|
||||||
|
* xz (http://tukaani.org/xz/) - xz-devel/liblzma-dev
|
||||||
|
* zchunk (https://github.com/zchunk/zchunk) - zchunk-devel/
|
||||||
|
* zlib (http://www.zlib.net/) - zlib-devel/zlib1g-dev
|
||||||
|
+* libzstd (http://facebook.github.io/zstd/) - libzstd-devel/libzstd-dev
|
||||||
|
* *Documentation:* doxygen (http://doxygen.org/) - doxygen/doxygen
|
||||||
|
* *Documentation:* sphinx (http://sphinx-doc.org/) - python3-sphinx/python3-sphinx
|
||||||
|
* **Test requires:** check (http://check.sourceforge.net/) - check-devel/check
|
||||||
|
diff --git a/createrepo_c.spec b/createrepo_c.spec
|
||||||
|
index 0105a71..afa45f6 100644
|
||||||
|
--- a/createrepo_c.spec
|
||||||
|
+++ b/createrepo_c.spec
|
||||||
|
@@ -18,8 +18,11 @@
|
||||||
|
|
||||||
|
%if 0%{?rhel} && 0%{?rhel} < 8
|
||||||
|
%bcond_with libmodulemd
|
||||||
|
+# dnf supports zstd since 8.4: https://bugzilla.redhat.com/show_bug.cgi?id=1914876
|
||||||
|
+%bcond_with zstd
|
||||||
|
%else
|
||||||
|
%bcond_without libmodulemd
|
||||||
|
+%bcond_without zstd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?rhel} && 0%{?rhel} <= 8
|
||||||
|
@@ -65,6 +68,9 @@ Requires: rpm >= 4.9.0
|
||||||
|
%if %{with drpm}
|
||||||
|
BuildRequires: drpm-devel >= 0.4.0
|
||||||
|
%endif
|
||||||
|
+%if %{with zstd}
|
||||||
|
+BuildRequires: pkgconfig(libzstd)
|
||||||
|
+%endif
|
||||||
|
|
||||||
|
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||||
|
Obsoletes: createrepo < 0.11.0
|
||||||
|
@@ -114,7 +120,8 @@ pushd build-py3
|
||||||
|
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
|
||||||
|
-DWITH_LIBMODULEMD=%{?with_libmodulemd:ON}%{!?with_libmodulemd:OFF} \
|
||||||
|
-DWITH_LEGACY_HASHES=%{?with_legacy_hashes:ON}%{!?with_legacy_hashes:OFF} \
|
||||||
|
- -DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF}
|
||||||
|
+ -DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF} \
|
||||||
|
+ -DWITH_ZSTD=%{?with_zstd:ON}%{!?with_zstd:OFF}
|
||||||
|
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
|
||||||
|
# Build C documentation
|
||||||
|
make doc-c
|
||||||
|
diff --git a/doc/createrepo_c.8 b/doc/createrepo_c.8
|
||||||
|
index 86d0dc7..bf9862b 100644
|
||||||
|
--- a/doc/createrepo_c.8
|
||||||
|
+++ b/doc/createrepo_c.8
|
||||||
|
@@ -161,7 +161,7 @@ Number of workers to spawn to read rpms.
|
||||||
|
Use xz for repodata compression.
|
||||||
|
.SS \-\-compress\-type COMPRESSION_TYPE
|
||||||
|
.sp
|
||||||
|
-Which compression type to use.
|
||||||
|
+Which compression type to use. Supported compressions are: bzip2, gzip, zck, zstd, xz.
|
||||||
|
.SS \-\-general\-compress\-type COMPRESSION_TYPE
|
||||||
|
.sp
|
||||||
|
Which compression type to use (even for primary, filelists and other xml).
|
||||||
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||||
|
index d118750..1689d5d 100644
|
||||||
|
--- a/src/CMakeLists.txt
|
||||||
|
+++ b/src/CMakeLists.txt
|
||||||
|
@@ -80,6 +80,7 @@ TARGET_LINK_LIBRARIES(libcreaterepo_c ${SQLITE3_LIBRARIES})
|
||||||
|
TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZLIB_LIBRARY})
|
||||||
|
TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZCK_LIBRARIES})
|
||||||
|
TARGET_LINK_LIBRARIES(libcreaterepo_c ${DRPM_LIBRARIES})
|
||||||
|
+TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZSTD_LIBRARIES})
|
||||||
|
|
||||||
|
SET_TARGET_PROPERTIES(libcreaterepo_c PROPERTIES
|
||||||
|
OUTPUT_NAME "createrepo_c"
|
||||||
|
diff --git a/src/cmd_parser.c b/src/cmd_parser.c
|
||||||
|
index 0e79b40..f8b027e 100644
|
||||||
|
--- a/src/cmd_parser.c
|
||||||
|
+++ b/src/cmd_parser.c
|
||||||
|
@@ -158,9 +158,9 @@ static GOptionEntry cmd_entries[] =
|
||||||
|
{ "xz", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.xz_compression),
|
||||||
|
"Use xz for repodata compression.", NULL },
|
||||||
|
{ "compress-type", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.compress_type),
|
||||||
|
- "Which compression type to use.", "COMPRESSION_TYPE" },
|
||||||
|
+ "Which compression type to use for additional metadata files (comps, updateinfo, etc). Supported compressions are: bzip2, gzip, zck, zstd, xz.", "COMPRESSION_TYPE" },
|
||||||
|
{ "general-compress-type", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.general_compress_type),
|
||||||
|
- "Which compression type to use (even for primary, filelists and other xml).",
|
||||||
|
+ "Which compression type to use (even for primary, filelists and other xml). Supported compressions are: bzip2, gzip, zck, zstd, xz.",
|
||||||
|
"COMPRESSION_TYPE" },
|
||||||
|
#ifdef WITH_ZCHUNK
|
||||||
|
{ "zck", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.zck_compression),
|
||||||
|
@@ -284,6 +284,8 @@ check_and_set_compression_type(const char *type_str,
|
||||||
|
*type = CR_CW_BZ2_COMPRESSION;
|
||||||
|
} else if (!strcmp(compress_str->str, "xz")) {
|
||||||
|
*type = CR_CW_XZ_COMPRESSION;
|
||||||
|
+ } else if (!strcmp(compress_str->str, "zstd")) {
|
||||||
|
+ *type = CR_CW_ZSTD_COMPRESSION;
|
||||||
|
} else {
|
||||||
|
g_set_error(err, ERR_DOMAIN, CRE_BADARG,
|
||||||
|
"Unknown/Unsupported compression type \"%s\"", type_str);
|
||||||
|
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
|
||||||
|
index b23c345..9100222 100644
|
||||||
|
--- a/src/compression_wrapper.c
|
||||||
|
+++ b/src/compression_wrapper.c
|
||||||
|
@@ -35,6 +35,9 @@
|
||||||
|
#endif // WITH_ZCHUNK
|
||||||
|
#include "error.h"
|
||||||
|
#include "compression_wrapper.h"
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+#include <zstd.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define ERR_DOMAIN CREATEREPO_C_ERROR
|
||||||
|
@@ -118,6 +121,17 @@ typedef struct {
|
||||||
|
unsigned char buffer[XZ_BUFFER_SIZE];
|
||||||
|
} XzFile;
|
||||||
|
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+#define CR_CW_ZSTD_COMPRESSION_LEVEL 9
|
||||||
|
+typedef struct {
|
||||||
|
+ void *buffer;
|
||||||
|
+ size_t buffer_size;
|
||||||
|
+ ZSTD_inBuffer zib;
|
||||||
|
+ ZSTD_outBuffer zob;
|
||||||
|
+ void * context; //ZSTD_{C,D}Ctx
|
||||||
|
+} ZstdFile;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
cr_CompressionType
|
||||||
|
cr_detect_compression(const char *filename, GError **err)
|
||||||
|
{
|
||||||
|
@@ -151,6 +165,9 @@ cr_detect_compression(const char *filename, GError **err)
|
||||||
|
} else if (g_str_has_suffix(filename, ".zck"))
|
||||||
|
{
|
||||||
|
return CR_CW_ZCK_COMPRESSION;
|
||||||
|
+ } else if (g_str_has_suffix(filename, ".zst"))
|
||||||
|
+ {
|
||||||
|
+ return CR_CW_ZSTD_COMPRESSION;
|
||||||
|
} else if (g_str_has_suffix(filename, ".xml") ||
|
||||||
|
g_str_has_suffix(filename, ".tar") ||
|
||||||
|
g_str_has_suffix(filename, ".yaml") ||
|
||||||
|
@@ -192,6 +209,11 @@ cr_detect_compression(const char *filename, GError **err)
|
||||||
|
type = CR_CW_GZ_COMPRESSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ else if (g_str_has_prefix(mime_type, "application/zstd"))
|
||||||
|
+ {
|
||||||
|
+ type = CR_CW_ZSTD_COMPRESSION;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
else if (g_str_has_prefix(mime_type, "application/x-bzip2") ||
|
||||||
|
g_str_has_prefix(mime_type, "application/x-bz2") ||
|
||||||
|
g_str_has_prefix(mime_type, "application/bzip2") ||
|
||||||
|
@@ -255,6 +277,8 @@ cr_compression_type(const char *name)
|
||||||
|
type = CR_CW_XZ_COMPRESSION;
|
||||||
|
if (!g_strcmp0(name_lower, "zck"))
|
||||||
|
type = CR_CW_ZCK_COMPRESSION;
|
||||||
|
+ if (!g_strcmp0(name_lower, "zstd"))
|
||||||
|
+ type = CR_CW_ZSTD_COMPRESSION;
|
||||||
|
g_free(name_lower);
|
||||||
|
|
||||||
|
return type;
|
||||||
|
@@ -272,6 +296,8 @@ cr_compression_suffix(cr_CompressionType comtype)
|
||||||
|
return ".xz";
|
||||||
|
case CR_CW_ZCK_COMPRESSION:
|
||||||
|
return ".zck";
|
||||||
|
+ case CR_CW_ZSTD_COMPRESSION:
|
||||||
|
+ return ".zst";
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -413,6 +439,56 @@ cr_sopen(const char *filename,
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): { // ------------------------------------
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ FILE *f = fopen(filename, mode_str);
|
||||||
|
+
|
||||||
|
+ if (!f) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "fopen(): %s", g_strerror(errno));
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ file->INNERFILE = f;
|
||||||
|
+
|
||||||
|
+ ZstdFile *zstd_file = g_malloc0(sizeof(ZstdFile));
|
||||||
|
+
|
||||||
|
+ if (mode == CR_CW_MODE_WRITE) {
|
||||||
|
+ if ((zstd_file->context = (void *) ZSTD_createCCtx()) == NULL) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_ZSTD, "%s",
|
||||||
|
+ "Failed to create ZSTD context.");
|
||||||
|
+ g_free(zstd_file);
|
||||||
|
+ fclose(f);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ size_t ret = ZSTD_CCtx_setParameter(zstd_file->context, ZSTD_c_compressionLevel, CR_CW_ZSTD_COMPRESSION_LEVEL);
|
||||||
|
+ if (ZSTD_isError(ret)) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_ZSTD, "%s",
|
||||||
|
+ ZSTD_getErrorName(ret));
|
||||||
|
+ g_free(zstd_file);
|
||||||
|
+ fclose(f);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ zstd_file->buffer_size = ZSTD_CStreamOutSize();
|
||||||
|
+ } else {
|
||||||
|
+ if ((zstd_file->context = (void *) ZSTD_createDCtx()) == NULL) {
|
||||||
|
+ g_free(zstd_file);
|
||||||
|
+ fclose(f);
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "%s",
|
||||||
|
+ "Failed to create ZSTD context.");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ zstd_file->buffer_size = ZSTD_DStreamInSize();
|
||||||
|
+ }
|
||||||
|
+ zstd_file->buffer = g_malloc(zstd_file->buffer_size);
|
||||||
|
+ file->FILE = (void *) zstd_file;
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+#else
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
+ break;
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): { // ------------------------------------
|
||||||
|
FILE *f = fopen(filename, mode_str);
|
||||||
|
file->INNERFILE = f;
|
||||||
|
@@ -769,6 +845,43 @@ cr_close(CR_FILE *cr_file, GError **err)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // --------------------------------------
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ ZstdFile * zstd = (ZstdFile *) cr_file->FILE;
|
||||||
|
+ if (cr_file->mode == CR_CW_MODE_READ) {
|
||||||
|
+ ZSTD_freeDCtx(zstd->context);
|
||||||
|
+ } else {
|
||||||
|
+ size_t remaining;
|
||||||
|
+ // No more new input just finish flushing compression data
|
||||||
|
+ ZSTD_inBuffer zip = { NULL, 0, 0 };
|
||||||
|
+ do {
|
||||||
|
+ zstd->zob.dst = zstd->buffer;
|
||||||
|
+ zstd->zob.size = zstd->buffer_size;
|
||||||
|
+ zstd->zob.pos = 0;
|
||||||
|
+
|
||||||
|
+ remaining = ZSTD_compressStream2(zstd->context, &zstd->zob , &zip, ZSTD_e_end);
|
||||||
|
+ if (ZSTD_isError(remaining)) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_ZSTD, "%s", ZSTD_getErrorName(remaining));
|
||||||
|
+ break;
|
||||||
|
+ } else if (zstd->zob.pos != fwrite(zstd->buffer, 1, zstd->zob.pos, cr_file->INNERFILE)) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "cr_close ZSTD fwrite failed");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ } while(remaining != 0);
|
||||||
|
+ ZSTD_freeCCtx(zstd->context);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fclose(cr_file->INNERFILE);
|
||||||
|
+ g_free(zstd->buffer);
|
||||||
|
+ g_free(cr_file->FILE);
|
||||||
|
+
|
||||||
|
+ ret = CRE_OK;
|
||||||
|
+ break;
|
||||||
|
+#else
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
+ break;
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
+
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
if (cr_file->mode == CR_CW_MODE_READ)
|
||||||
|
BZ2_bzReadClose(&rc, (BZFILE *) cr_file->FILE);
|
||||||
|
@@ -980,6 +1093,43 @@ cr_read(CR_FILE *cr_file, void *buffer, unsigned int len, GError **err)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // ---------------------------------------
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ ZstdFile * zstd = (ZstdFile *) cr_file->FILE;
|
||||||
|
+
|
||||||
|
+ ZSTD_outBuffer zob = {buffer, len, 0};
|
||||||
|
+
|
||||||
|
+ while (zob.pos < zob.size) {
|
||||||
|
+ // Re-fill compressed data buffer
|
||||||
|
+ if (zstd->zib.pos >= zstd->zib.size) {
|
||||||
|
+ zstd->zib.size = fread(zstd->buffer, 1, zstd->buffer_size, cr_file->INNERFILE);
|
||||||
|
+ if (zstd->zib.size == 0) {
|
||||||
|
+ break; //EOF
|
||||||
|
+ }
|
||||||
|
+ zstd->zib.src = zstd->buffer;
|
||||||
|
+ zstd->zib.pos = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Decompress chunk
|
||||||
|
+ int decomp_ret = ZSTD_decompressStream(zstd->context, &zob, &zstd->zib);
|
||||||
|
+ if (ZSTD_isError(decomp_ret)) {
|
||||||
|
+ ret = CR_CW_ERR;
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_ZSTD, "%s", ZSTD_getErrorName(decomp_ret));
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!(err && *err)) {
|
||||||
|
+ ret = zob.pos;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+#else
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
+ break;
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
+
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
ret = BZ2_bzRead(&bzerror, (BZFILE *) cr_file->FILE, buffer, len);
|
||||||
|
if (!ret && bzerror == BZ_SEQUENCE_ERROR)
|
||||||
|
@@ -1214,6 +1364,44 @@ cr_write(CR_FILE *cr_file, const void *buffer, unsigned int len, GError **err)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // ---------------------------------------
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ ZstdFile * zstd = (ZstdFile *) cr_file->FILE;
|
||||||
|
+ ZSTD_inBuffer zib = {buffer, len, 0};
|
||||||
|
+
|
||||||
|
+ while (zib.pos < zib.size) {
|
||||||
|
+ zstd->zob.dst = zstd->buffer;
|
||||||
|
+ zstd->zob.size = zstd->buffer_size;
|
||||||
|
+ zstd->zob.pos = 0;
|
||||||
|
+
|
||||||
|
+ // Compress chunk into buffer
|
||||||
|
+ size_t remaining = ZSTD_compressStream2(zstd->context, &zstd->zob , &zib, ZSTD_e_continue);
|
||||||
|
+ if (ZSTD_isError(remaining)) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_ZSTD, "%s", ZSTD_getErrorName(remaining));
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Write compressed buffer
|
||||||
|
+ if (zstd->zob.pos > 0) {
|
||||||
|
+ size_t nw = fwrite(zstd->buffer, 1, zstd->zob.pos, cr_file->INNERFILE);
|
||||||
|
+ if (nw != zstd->zob.pos) {
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "cr_write zstd write failed");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!(err && *err)) {
|
||||||
|
+ ret = zib.pos;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+#else
|
||||||
|
+ g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
+ break;
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
+
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
BZ2_bzWrite(&bzerror, (BZFILE *) cr_file->FILE, (void *) buffer, len);
|
||||||
|
if (bzerror == BZ_OK) {
|
||||||
|
@@ -1361,6 +1549,7 @@ cr_puts(CR_FILE *cr_file, const char *str, GError **err)
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
case (CR_CW_XZ_COMPRESSION): // ---------------------------------------
|
||||||
|
case (CR_CW_ZCK_COMPRESSION): // --------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // --------------------------------------
|
||||||
|
len = strlen(str);
|
||||||
|
ret = cr_write(cr_file, str, len, err);
|
||||||
|
if (ret != (int) len)
|
||||||
|
@@ -1398,6 +1587,7 @@ cr_end_chunk(CR_FILE *cr_file, GError **err)
|
||||||
|
case (CR_CW_GZ_COMPRESSION): // ---------------------------------------
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
case (CR_CW_XZ_COMPRESSION): // ---------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // ---------------------------------------
|
||||||
|
break;
|
||||||
|
case (CR_CW_ZCK_COMPRESSION): { // ------------------------------------
|
||||||
|
#ifdef WITH_ZCHUNK
|
||||||
|
@@ -1450,6 +1640,7 @@ cr_set_autochunk(CR_FILE *cr_file, gboolean auto_chunk, GError **err)
|
||||||
|
case (CR_CW_GZ_COMPRESSION): // ---------------------------------------
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
case (CR_CW_XZ_COMPRESSION): // ---------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // ---------------------------------------
|
||||||
|
break;
|
||||||
|
case (CR_CW_ZCK_COMPRESSION): { // ------------------------------------
|
||||||
|
#ifdef WITH_ZCHUNK
|
||||||
|
@@ -1524,6 +1715,7 @@ cr_printf(GError **err, CR_FILE *cr_file, const char *format, ...)
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
case (CR_CW_XZ_COMPRESSION): // ---------------------------------------
|
||||||
|
case (CR_CW_ZCK_COMPRESSION): // --------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): // --------------------------------------
|
||||||
|
tmp_ret = cr_write(cr_file, buf, ret, err);
|
||||||
|
if (tmp_ret != (int) ret)
|
||||||
|
ret = CR_CW_ERR;
|
||||||
|
diff --git a/src/compression_wrapper.h b/src/compression_wrapper.h
|
||||||
|
index 72e0078..32936d0 100644
|
||||||
|
--- a/src/compression_wrapper.h
|
||||||
|
+++ b/src/compression_wrapper.h
|
||||||
|
@@ -42,6 +42,7 @@ typedef enum {
|
||||||
|
CR_CW_BZ2_COMPRESSION, /*!< BZip2 compression */
|
||||||
|
CR_CW_XZ_COMPRESSION, /*!< XZ compression */
|
||||||
|
CR_CW_ZCK_COMPRESSION, /*!< ZCK compression */
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, /*!< ZSTD compression */
|
||||||
|
CR_CW_COMPRESSION_SENTINEL, /*!< Sentinel of the list */
|
||||||
|
} cr_CompressionType;
|
||||||
|
|
||||||
|
diff --git a/src/error.h b/src/error.h
|
||||||
|
index b925bc7..8738032 100644
|
||||||
|
--- a/src/error.h
|
||||||
|
+++ b/src/error.h
|
||||||
|
@@ -98,6 +98,8 @@ typedef enum {
|
||||||
|
(34) ZCK library related error */
|
||||||
|
CRE_MODULEMD, /*!<
|
||||||
|
(35) modulemd related error */
|
||||||
|
+ CRE_ZSTD, /*!<
|
||||||
|
+ (36) Zstd library related error */
|
||||||
|
CRE_SENTINEL, /*!<
|
||||||
|
(XX) Sentinel */
|
||||||
|
} cr_Error;
|
||||||
|
diff --git a/src/python/createrepo_c/__init__.py b/src/python/createrepo_c/__init__.py
|
||||||
|
index 440e559..21f6f74 100644
|
||||||
|
--- a/src/python/createrepo_c/__init__.py
|
||||||
|
+++ b/src/python/createrepo_c/__init__.py
|
||||||
|
@@ -59,6 +59,9 @@ XZ = _createrepo_c.XZ_COMPRESSION
|
||||||
|
#: Zchunk compression alias
|
||||||
|
ZCK = _createrepo_c.ZCK_COMPRESSION
|
||||||
|
|
||||||
|
+#: Zstd compression alias
|
||||||
|
+ZSTD = _createrepo_c.ZSTD_COMPRESSION
|
||||||
|
+
|
||||||
|
HT_KEY_DEFAULT = _createrepo_c.HT_KEY_DEFAULT #: Default key (hash)
|
||||||
|
HT_KEY_HASH = _createrepo_c.HT_KEY_HASH #: Package hash as a key
|
||||||
|
HT_KEY_NAME = _createrepo_c.HT_KEY_NAME #: Package name as a key
|
||||||
|
diff --git a/src/python/createrepo_cmodule.c b/src/python/createrepo_cmodule.c
|
||||||
|
index ba6cad6..64ac4ec 100644
|
||||||
|
--- a/src/python/createrepo_cmodule.c
|
||||||
|
+++ b/src/python/createrepo_cmodule.c
|
||||||
|
@@ -264,6 +264,7 @@ PyInit__createrepo_c(void)
|
||||||
|
PyModule_AddIntConstant(m, "BZ2_COMPRESSION", CR_CW_BZ2_COMPRESSION);
|
||||||
|
PyModule_AddIntConstant(m, "XZ_COMPRESSION", CR_CW_XZ_COMPRESSION);
|
||||||
|
PyModule_AddIntConstant(m, "ZCK_COMPRESSION", CR_CW_ZCK_COMPRESSION);
|
||||||
|
+ PyModule_AddIntConstant(m, "ZSTD_COMPRESSION", CR_CW_ZSTD_COMPRESSION);
|
||||||
|
|
||||||
|
/* Zchunk support */
|
||||||
|
#ifdef WITH_ZCHUNK
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
||||||
@ -1,94 +0,0 @@
|
|||||||
From b5f425fec738c1de344f4f917d3614e9efb98e2b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aleš Matěj <amatej@redhat.com>
|
|
||||||
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
|
|
||||||
|
|
||||||
358
SOURCES/0003-Add-unittests-for-zstd-compression.patch
Normal file
358
SOURCES/0003-Add-unittests-for-zstd-compression.patch
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
From 06ff7fc8adbdbbe7d4d7782e278b1a2e20d9ab8b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||||
|
Date: Tue, 17 Aug 2021 14:28:05 +0200
|
||||||
|
Subject: [PATCH 2/4] Add unittests for zstd compression
|
||||||
|
|
||||||
|
---
|
||||||
|
.../python/tests/test_compression_wrapper.py | 8 +-
|
||||||
|
tests/test_compression_wrapper.c | 161 ++++++++++++++++++
|
||||||
|
tests/testdata/compressed_files/00_plain.foo5 | Bin 0 -> 13 bytes
|
||||||
|
.../compressed_files/00_plain.txt.zst | Bin 0 -> 13 bytes
|
||||||
|
tests/testdata/compressed_files/01_plain.foo5 | Bin 0 -> 51 bytes
|
||||||
|
.../compressed_files/01_plain.txt.zst | Bin 0 -> 51 bytes
|
||||||
|
6 files changed, 168 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 tests/testdata/compressed_files/00_plain.foo5
|
||||||
|
create mode 100644 tests/testdata/compressed_files/00_plain.txt.zst
|
||||||
|
create mode 100644 tests/testdata/compressed_files/01_plain.foo5
|
||||||
|
create mode 100644 tests/testdata/compressed_files/01_plain.txt.zst
|
||||||
|
|
||||||
|
diff --git a/tests/python/tests/test_compression_wrapper.py b/tests/python/tests/test_compression_wrapper.py
|
||||||
|
index c8957a2..7719fdd 100644
|
||||||
|
--- a/tests/python/tests/test_compression_wrapper.py
|
||||||
|
+++ b/tests/python/tests/test_compression_wrapper.py
|
||||||
|
@@ -15,6 +15,7 @@ class TestCaseCompressionWrapper(unittest.TestCase):
|
||||||
|
self.assertEqual(cr.compression_suffix(cr.BZ2), ".bz2")
|
||||||
|
self.assertEqual(cr.compression_suffix(cr.XZ), ".xz")
|
||||||
|
self.assertEqual(cr.compression_suffix(cr.ZCK), ".zck")
|
||||||
|
+ self.assertEqual(cr.compression_suffix(cr.ZSTD), ".zst")
|
||||||
|
|
||||||
|
def test_detect_compression(self):
|
||||||
|
|
||||||
|
@@ -69,6 +70,11 @@ class TestCaseCompressionWrapper(unittest.TestCase):
|
||||||
|
#comtype = cr.detect_compression(path)
|
||||||
|
#self.assertEqual(comtype, cr.ZCK)
|
||||||
|
|
||||||
|
+ # Bad suffix - zstd compression
|
||||||
|
+ path = os.path.join(COMPRESSED_FILES_PATH, "01_plain.foo5")
|
||||||
|
+ comtype = cr.detect_compression(path)
|
||||||
|
+ self.assertEqual(comtype, cr.ZSTD)
|
||||||
|
+
|
||||||
|
def test_compression_type(self):
|
||||||
|
self.assertEqual(cr.compression_type(None), cr.UNKNOWN_COMPRESSION)
|
||||||
|
self.assertEqual(cr.compression_type(""), cr.UNKNOWN_COMPRESSION)
|
||||||
|
@@ -77,4 +83,4 @@ class TestCaseCompressionWrapper(unittest.TestCase):
|
||||||
|
self.assertEqual(cr.compression_type("xz"), cr.XZ)
|
||||||
|
self.assertEqual(cr.compression_type("XZ"), cr.XZ)
|
||||||
|
self.assertEqual(cr.compression_type("zck"), cr.ZCK)
|
||||||
|
-
|
||||||
|
+ self.assertEqual(cr.compression_type("zstd"), cr.ZSTD)
|
||||||
|
diff --git a/tests/test_compression_wrapper.c b/tests/test_compression_wrapper.c
|
||||||
|
index edd4fe5..6326156 100644
|
||||||
|
--- a/tests/test_compression_wrapper.c
|
||||||
|
+++ b/tests/test_compression_wrapper.c
|
||||||
|
@@ -37,10 +37,12 @@
|
||||||
|
#define FILE_COMPRESSED_0_GZ TEST_COMPRESSED_FILES_PATH"/00_plain.txt.gz"
|
||||||
|
#define FILE_COMPRESSED_0_BZ2 TEST_COMPRESSED_FILES_PATH"/00_plain.txt.bz2"
|
||||||
|
#define FILE_COMPRESSED_0_XZ TEST_COMPRESSED_FILES_PATH"/00_plain.txt.xz"
|
||||||
|
+#define FILE_COMPRESSED_0_ZSTD TEST_COMPRESSED_FILES_PATH"/00_plain.txt.zst"
|
||||||
|
#define FILE_COMPRESSED_0_PLAIN_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/00_plain.foo0"
|
||||||
|
#define FILE_COMPRESSED_0_GZ_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/00_plain.foo1"
|
||||||
|
#define FILE_COMPRESSED_0_BZ2_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/00_plain.foo2"
|
||||||
|
#define FILE_COMPRESSED_0_XZ_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/00_plain.foo3"
|
||||||
|
+#define FILE_COMPRESSED_0_ZSTD_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/00_plain.foo5"
|
||||||
|
|
||||||
|
#define FILE_COMPRESSED_1_CONTENT "foobar foobar foobar foobar test test\nfolkjsaflkjsadokf\n"
|
||||||
|
#define FILE_COMPRESSED_1_CONTENT_LEN 56
|
||||||
|
@@ -48,11 +50,13 @@
|
||||||
|
#define FILE_COMPRESSED_1_GZ TEST_COMPRESSED_FILES_PATH"/01_plain.txt.gz"
|
||||||
|
#define FILE_COMPRESSED_1_BZ2 TEST_COMPRESSED_FILES_PATH"/01_plain.txt.bz2"
|
||||||
|
#define FILE_COMPRESSED_1_XZ TEST_COMPRESSED_FILES_PATH"/01_plain.txt.xz"
|
||||||
|
+#define FILE_COMPRESSED_1_ZSTD TEST_COMPRESSED_FILES_PATH"/01_plain.txt.zst"
|
||||||
|
#define FILE_COMPRESSED_1_ZCK TEST_COMPRESSED_FILES_PATH"/01_plain.txt.zck"
|
||||||
|
#define FILE_COMPRESSED_1_PLAIN_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/01_plain.foo0"
|
||||||
|
#define FILE_COMPRESSED_1_GZ_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/01_plain.foo1"
|
||||||
|
#define FILE_COMPRESSED_1_BZ2_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/01_plain.foo2"
|
||||||
|
#define FILE_COMPRESSED_1_XZ_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/01_plain.foo3"
|
||||||
|
+#define FILE_COMPRESSED_1_ZSTD_BAD_SUFFIX TEST_COMPRESSED_FILES_PATH"/01_plain.foo5"
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -98,6 +102,11 @@ test_cr_compression_suffix(void)
|
||||||
|
|
||||||
|
suffix = cr_compression_suffix(CR_CW_XZ_COMPRESSION);
|
||||||
|
g_assert_cmpstr(suffix, ==, ".xz");
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ suffix = cr_compression_suffix(CR_CW_ZSTD_COMPRESSION);
|
||||||
|
+ g_assert_cmpstr(suffix, ==, ".zst");
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -134,6 +143,11 @@ test_cr_compression_type(void)
|
||||||
|
|
||||||
|
type = cr_compression_type("xz");
|
||||||
|
g_assert_cmpint(type, ==, CR_CW_XZ_COMPRESSION);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ type = cr_compression_type("zstd");
|
||||||
|
+ g_assert_cmpint(type, ==, CR_CW_ZSTD_COMPRESSION);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -177,6 +191,17 @@ test_cr_detect_compression(void)
|
||||||
|
ret = cr_detect_compression(FILE_COMPRESSED_1_XZ, &tmp_err);
|
||||||
|
g_assert_cmpint(ret, ==, CR_CW_XZ_COMPRESSION);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ // Zstd
|
||||||
|
+
|
||||||
|
+ ret = cr_detect_compression(FILE_COMPRESSED_0_ZSTD, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, CR_CW_ZSTD_COMPRESSION);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+ ret = cr_detect_compression(FILE_COMPRESSED_1_ZSTD, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, CR_CW_ZSTD_COMPRESSION);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -221,6 +246,17 @@ test_cr_detect_compression_bad_suffix(void)
|
||||||
|
ret = cr_detect_compression(FILE_COMPRESSED_1_XZ_BAD_SUFFIX, &tmp_err);
|
||||||
|
g_assert_cmpint(ret, ==, CR_CW_XZ_COMPRESSION);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ // Zstd
|
||||||
|
+
|
||||||
|
+ ret = cr_detect_compression(FILE_COMPRESSED_0_ZSTD_BAD_SUFFIX, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, CR_CW_ZSTD_COMPRESSION);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+ ret = cr_detect_compression(FILE_COMPRESSED_1_ZSTD_BAD_SUFFIX, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, CR_CW_ZSTD_COMPRESSION);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -235,6 +271,16 @@ test_helper_cw_input(const char *filename,
|
||||||
|
char buffer[COMPRESSED_BUFFER_LEN+1];
|
||||||
|
GError *tmp_err = NULL;
|
||||||
|
|
||||||
|
+ if (ctype != CR_CW_AUTO_DETECT_COMPRESSION) {
|
||||||
|
+ cr_CompressionType detected_type = cr_detect_compression(filename, &tmp_err);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+ if (ctype != detected_type) {
|
||||||
|
+ printf("detected_type: %i does not match passed type: %i for filename: %s\n",
|
||||||
|
+ detected_type, ctype, filename);
|
||||||
|
+ g_assert(0);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
file = cr_open(filename, CR_CW_MODE_READ, ctype, &tmp_err);
|
||||||
|
g_assert(file);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
@@ -281,6 +327,15 @@ test_cr_read_with_autodetection(void)
|
||||||
|
FILE_COMPRESSED_0_CONTENT, FILE_COMPRESSED_0_CONTENT_LEN);
|
||||||
|
test_helper_cw_input(FILE_COMPRESSED_1_XZ, CR_CW_AUTO_DETECT_COMPRESSION,
|
||||||
|
FILE_COMPRESSED_1_CONTENT, FILE_COMPRESSED_1_CONTENT_LEN);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ // Zstd
|
||||||
|
+
|
||||||
|
+ test_helper_cw_input(FILE_COMPRESSED_0_ZSTD, CR_CW_AUTO_DETECT_COMPRESSION,
|
||||||
|
+ FILE_COMPRESSED_0_CONTENT, FILE_COMPRESSED_0_CONTENT_LEN);
|
||||||
|
+ test_helper_cw_input(FILE_COMPRESSED_1_ZSTD, CR_CW_AUTO_DETECT_COMPRESSION,
|
||||||
|
+ FILE_COMPRESSED_1_CONTENT, FILE_COMPRESSED_1_CONTENT_LEN);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -447,6 +502,29 @@ outputtest_cw_output(Outputtest *outputtest,
|
||||||
|
test_helper_cw_output(OUTPUT_TYPE_PRINTF, outputtest->tmp_filename,
|
||||||
|
CR_CW_XZ_COMPRESSION, FILE_COMPRESSED_1_CONTENT,
|
||||||
|
FILE_COMPRESSED_1_CONTENT_LEN);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ // Zstd
|
||||||
|
+
|
||||||
|
+ test_helper_cw_output(OUTPUT_TYPE_WRITE, outputtest->tmp_filename,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, FILE_COMPRESSED_0_CONTENT,
|
||||||
|
+ FILE_COMPRESSED_0_CONTENT_LEN);
|
||||||
|
+ test_helper_cw_output(OUTPUT_TYPE_WRITE, outputtest->tmp_filename,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, FILE_COMPRESSED_1_CONTENT,
|
||||||
|
+ FILE_COMPRESSED_1_CONTENT_LEN);
|
||||||
|
+ test_helper_cw_output(OUTPUT_TYPE_PUTS, outputtest->tmp_filename,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, FILE_COMPRESSED_0_CONTENT,
|
||||||
|
+ FILE_COMPRESSED_0_CONTENT_LEN);
|
||||||
|
+ test_helper_cw_output(OUTPUT_TYPE_PUTS, outputtest->tmp_filename,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, FILE_COMPRESSED_1_CONTENT,
|
||||||
|
+ FILE_COMPRESSED_1_CONTENT_LEN);
|
||||||
|
+ test_helper_cw_output(OUTPUT_TYPE_PRINTF, outputtest->tmp_filename,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, FILE_COMPRESSED_0_CONTENT,
|
||||||
|
+ FILE_COMPRESSED_0_CONTENT_LEN);
|
||||||
|
+ test_helper_cw_output(OUTPUT_TYPE_PRINTF, outputtest->tmp_filename,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, FILE_COMPRESSED_1_CONTENT,
|
||||||
|
+ FILE_COMPRESSED_1_CONTENT_LEN);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -508,6 +586,15 @@ test_cr_error_handling(void)
|
||||||
|
g_error_free(tmp_err);
|
||||||
|
tmp_err = NULL;
|
||||||
|
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ f = cr_open("/", CR_CW_MODE_WRITE, CR_CW_ZSTD_COMPRESSION, &tmp_err);
|
||||||
|
+ g_assert(!f);
|
||||||
|
+ g_assert(tmp_err);
|
||||||
|
+ g_assert_cmpint(tmp_err->code, ==, CRE_IO);
|
||||||
|
+ g_error_free(tmp_err);
|
||||||
|
+ tmp_err = NULL;
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
+
|
||||||
|
// Opening plain text file as compressed
|
||||||
|
|
||||||
|
char buf[256];
|
||||||
|
@@ -550,6 +637,21 @@ test_cr_error_handling(void)
|
||||||
|
ret = cr_close(f, &tmp_err);
|
||||||
|
g_assert_cmpint(ret, ==, CRE_OK);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ f = cr_open(FILE_COMPRESSED_1_PLAIN, CR_CW_MODE_READ,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION, &tmp_err);
|
||||||
|
+ g_assert(f);
|
||||||
|
+ ret = cr_read(f, buf, 256, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, -1);
|
||||||
|
+ g_assert(tmp_err);
|
||||||
|
+ g_assert_cmpint(tmp_err->code, ==, CRE_ZSTD);
|
||||||
|
+ g_error_free(tmp_err);
|
||||||
|
+ tmp_err = NULL;
|
||||||
|
+ ret = cr_close(f, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, CRE_OK);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -670,6 +772,33 @@ test_contentstating_singlewrite(Outputtest *outputtest,
|
||||||
|
g_assert_cmpstr(stat->checksum, ==, content_sha256);
|
||||||
|
cr_contentstat_free(stat, &tmp_err);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ // zstd compression
|
||||||
|
+ stat = cr_contentstat_new(CR_CHECKSUM_SHA256, &tmp_err);
|
||||||
|
+ g_assert(stat);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ f = cr_sopen(outputtest->tmp_filename,
|
||||||
|
+ CR_CW_MODE_WRITE,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION,
|
||||||
|
+ stat,
|
||||||
|
+ &tmp_err);
|
||||||
|
+ g_assert(f);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ ret = cr_write(f, content, content_len, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, content_len);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ cr_close(f, &tmp_err);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ g_assert_cmpint(stat->size, ==, content_len);
|
||||||
|
+ g_assert_cmpstr(stat->checksum, ==, content_sha256);
|
||||||
|
+ cr_contentstat_free(stat, &tmp_err);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -715,6 +844,38 @@ test_contentstating_multiwrite(Outputtest *outputtest,
|
||||||
|
g_assert_cmpstr(stat->checksum, ==, content_sha256);
|
||||||
|
cr_contentstat_free(stat, &tmp_err);
|
||||||
|
g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+#ifdef WITH_ZSTD
|
||||||
|
+ // Zstd compression
|
||||||
|
+
|
||||||
|
+ stat = cr_contentstat_new(CR_CHECKSUM_SHA256, &tmp_err);
|
||||||
|
+ g_assert(stat);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ f = cr_sopen(outputtest->tmp_filename,
|
||||||
|
+ CR_CW_MODE_WRITE,
|
||||||
|
+ CR_CW_ZSTD_COMPRESSION,
|
||||||
|
+ stat,
|
||||||
|
+ &tmp_err);
|
||||||
|
+ g_assert(f);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ ret = cr_write(f, content, 10, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, 10);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ ret = cr_write(f, content+10, 29, &tmp_err);
|
||||||
|
+ g_assert_cmpint(ret, ==, 29);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ cr_close(f, &tmp_err);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+
|
||||||
|
+ g_assert_cmpint(stat->size, ==, content_len);
|
||||||
|
+ g_assert_cmpstr(stat->checksum, ==, content_sha256);
|
||||||
|
+ cr_contentstat_free(stat, &tmp_err);
|
||||||
|
+ g_assert(!tmp_err);
|
||||||
|
+#endif // WITH_ZSTD
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
diff --git a/tests/testdata/compressed_files/00_plain.foo5 b/tests/testdata/compressed_files/00_plain.foo5
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..e58c09d56ab1845ad8c524844d4acd0515de2df5
|
||||||
|
GIT binary patch
|
||||||
|
literal 13
|
||||||
|
UcmdPcs{dDofsuh>=F1y_03PE6+5i9m
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
diff --git a/tests/testdata/compressed_files/00_plain.txt.zst b/tests/testdata/compressed_files/00_plain.txt.zst
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..e58c09d56ab1845ad8c524844d4acd0515de2df5
|
||||||
|
GIT binary patch
|
||||||
|
literal 13
|
||||||
|
UcmdPcs{dDofsuh>=F1y_03PE6+5i9m
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
diff --git a/tests/testdata/compressed_files/01_plain.foo5 b/tests/testdata/compressed_files/01_plain.foo5
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..9d9c470fc36aae29007d667145a3dedf23a825c2
|
||||||
|
GIT binary patch
|
||||||
|
literal 51
|
||||||
|
zcmdPcs{dET!jzHWLt1`*Qeu%pNosKkS6Y5fc2;p>8kkJU&raiFV$fi^7~aE^zvB)7
|
||||||
|
D=VTJ`
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
diff --git a/tests/testdata/compressed_files/01_plain.txt.zst b/tests/testdata/compressed_files/01_plain.txt.zst
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..9d9c470fc36aae29007d667145a3dedf23a825c2
|
||||||
|
GIT binary patch
|
||||||
|
literal 51
|
||||||
|
zcmdPcs{dET!jzHWLt1`*Qeu%pNosKkS6Y5fc2;p>8kkJU&raiFV$fi^7~aE^zvB)7
|
||||||
|
D=VTJ`
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,72 @@
|
|||||||
|
From 37efd285ba34f53451d11ad2390604e1d46536b0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||||
|
Date: Wed, 17 May 2023 09:34:05 +0200
|
||||||
|
Subject: [PATCH 3/4] Fix: error: a label can only be part of a statement
|
||||||
|
|
||||||
|
Declaration is not a statement.
|
||||||
|
This seems to work with newer versions of GCC but the C language
|
||||||
|
standard only allows statements to follow a label.
|
||||||
|
---
|
||||||
|
src/compression_wrapper.c | 11 ++++++-----
|
||||||
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
|
||||||
|
index 9100222..af06543 100644
|
||||||
|
--- a/src/compression_wrapper.c
|
||||||
|
+++ b/src/compression_wrapper.c
|
||||||
|
@@ -845,7 +845,7 @@ cr_close(CR_FILE *cr_file, GError **err)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
- case (CR_CW_ZSTD_COMPRESSION): // --------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): { // --------------------------------------
|
||||||
|
#ifdef WITH_ZSTD
|
||||||
|
ZstdFile * zstd = (ZstdFile *) cr_file->FILE;
|
||||||
|
if (cr_file->mode == CR_CW_MODE_READ) {
|
||||||
|
@@ -881,7 +881,7 @@ cr_close(CR_FILE *cr_file, GError **err)
|
||||||
|
g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
break;
|
||||||
|
#endif // WITH_ZSTD
|
||||||
|
-
|
||||||
|
+ }
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
if (cr_file->mode == CR_CW_MODE_READ)
|
||||||
|
BZ2_bzReadClose(&rc, (BZFILE *) cr_file->FILE);
|
||||||
|
@@ -1093,7 +1093,7 @@ cr_read(CR_FILE *cr_file, void *buffer, unsigned int len, GError **err)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
- case (CR_CW_ZSTD_COMPRESSION): // ---------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): { // ---------------------------------------
|
||||||
|
#ifdef WITH_ZSTD
|
||||||
|
ZstdFile * zstd = (ZstdFile *) cr_file->FILE;
|
||||||
|
|
||||||
|
@@ -1129,7 +1129,7 @@ cr_read(CR_FILE *cr_file, void *buffer, unsigned int len, GError **err)
|
||||||
|
g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
break;
|
||||||
|
#endif // WITH_ZSTD
|
||||||
|
-
|
||||||
|
+ }
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
ret = BZ2_bzRead(&bzerror, (BZFILE *) cr_file->FILE, buffer, len);
|
||||||
|
if (!ret && bzerror == BZ_SEQUENCE_ERROR)
|
||||||
|
@@ -1364,7 +1364,7 @@ cr_write(CR_FILE *cr_file, const void *buffer, unsigned int len, GError **err)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
- case (CR_CW_ZSTD_COMPRESSION): // ---------------------------------------
|
||||||
|
+ case (CR_CW_ZSTD_COMPRESSION): { // ---------------------------------------
|
||||||
|
#ifdef WITH_ZSTD
|
||||||
|
ZstdFile * zstd = (ZstdFile *) cr_file->FILE;
|
||||||
|
ZSTD_inBuffer zib = {buffer, len, 0};
|
||||||
|
@@ -1401,6 +1401,7 @@ cr_write(CR_FILE *cr_file, const void *buffer, unsigned int len, GError **err)
|
||||||
|
g_set_error(err, ERR_DOMAIN, CRE_IO, "createrepo_c wasn't compiled with zstd support");
|
||||||
|
break;
|
||||||
|
#endif // WITH_ZSTD
|
||||||
|
+ }
|
||||||
|
|
||||||
|
case (CR_CW_BZ2_COMPRESSION): // --------------------------------------
|
||||||
|
BZ2_bzWrite(&bzerror, (BZFILE *) cr_file->FILE, (void *) buffer, len);
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
From 84cdfec03f8adfd891227cd2e44b744d0b55b2ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
|
||||||
|
Date: Wed, 8 Nov 2023 23:31:44 +0100
|
||||||
|
Subject: [PATCH 4/4] Set compression level for zstd to level 10
|
||||||
|
|
||||||
|
This requires a good amount of saving due to larger dictionary
|
||||||
|
size with only marginal more time effort for compression. decompression
|
||||||
|
time is unaffected.
|
||||||
|
---
|
||||||
|
src/compression_wrapper.c | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
|
||||||
|
index af06543..175806a 100644
|
||||||
|
--- a/src/compression_wrapper.c
|
||||||
|
+++ b/src/compression_wrapper.c
|
||||||
|
@@ -122,7 +122,16 @@ typedef struct {
|
||||||
|
} XzFile;
|
||||||
|
|
||||||
|
#ifdef WITH_ZSTD
|
||||||
|
-#define CR_CW_ZSTD_COMPRESSION_LEVEL 9
|
||||||
|
+
|
||||||
|
+/** level 10 or 11 are good choices for the XML files that we generate.
|
||||||
|
+ * level 10 requires ~ 18% more time with 1% saving over level 9
|
||||||
|
+ * level 11 requires ~ 50% more time with 1.5% saving over level 9
|
||||||
|
+ * level 12 requires ~ 65% more time with 1.5% saving over level 9
|
||||||
|
+ * level 13 requires ~ 260% more time with 1.55% saving over level 9
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+#define CR_CW_ZSTD_COMPRESSION_LEVEL 10
|
||||||
|
+
|
||||||
|
typedef struct {
|
||||||
|
void *buffer;
|
||||||
|
size_t buffer_size;
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
%global libmodulemd_version 2.3.0
|
%global libmodulemd_version 2.3.0
|
||||||
%{!?_licensedir:%global license %%doc}
|
|
||||||
%define __cmake_in_source_build 1
|
%define __cmake_in_source_build 1
|
||||||
|
|
||||||
%global bash_completion %{_datadir}/bash-completion/completions/*
|
%global bash_completion %{_datadir}/bash-completion/completions/*
|
||||||
@ -22,22 +22,18 @@
|
|||||||
%bcond_without libmodulemd
|
%bcond_without libmodulemd
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} <= 8
|
|
||||||
%bcond_without legacy_hashes
|
|
||||||
%else
|
|
||||||
%bcond_with legacy_hashes
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Summary: Creates a common metadata repository
|
Summary: Creates a common metadata repository
|
||||||
Name: createrepo_c
|
Name: createrepo_c
|
||||||
Version: 0.17.7
|
Version: 0.20.1
|
||||||
Release: 6%{?dist}
|
Release: 4%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/rpm-software-management/createrepo_c
|
URL: https://github.com/rpm-software-management/createrepo_c
|
||||||
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
Patch1: 0001-Preserve-changed-API-for-cr_compress_file_with_stat-RhBug1973588.patch
|
Patch1: 0001-Test_compare_contents_instead_of_checksum-cleanup.patch
|
||||||
Patch2: 0002-Default---keep-all-metadata-to-TRUE-and-add---discard-additional-metadata.patch
|
Patch2: 0002-Add-zstd-compression-support.patch
|
||||||
Patch3: 0003-Revert-added-API-for-parsing-main-metadata-together-RhBug2062299.patch
|
Patch3: 0003-Add-unittests-for-zstd-compression.patch
|
||||||
|
Patch4: 0004-Fix-error-a-label-can-only-be-part-of-a-statement.patch
|
||||||
|
Patch5: 0005-Set-compression-level-for-zstd-to-level-10.patch
|
||||||
|
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
@ -74,6 +70,10 @@ Obsoletes: createrepo < 0.11.0
|
|||||||
Provides: createrepo = %{version}-%{release}
|
Provides: createrepo = %{version}-%{release}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# We need git for the build because we are applying binary patches.
|
||||||
|
# Configured as -S git for the autosetup macro.
|
||||||
|
BuildRequires: git-core
|
||||||
|
|
||||||
%description
|
%description
|
||||||
C implementation of Createrepo.
|
C implementation of Createrepo.
|
||||||
A set of utilities (createrepo_c, mergerepo_c, modifyrepo_c)
|
A set of utilities (createrepo_c, mergerepo_c, modifyrepo_c)
|
||||||
@ -106,7 +106,7 @@ Requires: %{name}-libs = %{version}-%{release}
|
|||||||
Python 3 bindings for the createrepo_c library.
|
Python 3 bindings for the createrepo_c library.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1
|
%autosetup -p1 -S git
|
||||||
|
|
||||||
mkdir build-py3
|
mkdir build-py3
|
||||||
|
|
||||||
@ -116,7 +116,6 @@ pushd build-py3
|
|||||||
%cmake .. \
|
%cmake .. \
|
||||||
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
|
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
|
||||||
-DWITH_LIBMODULEMD=%{?with_libmodulemd:ON}%{!?with_libmodulemd:OFF} \
|
-DWITH_LIBMODULEMD=%{?with_libmodulemd:ON}%{!?with_libmodulemd:OFF} \
|
||||||
-DWITH_LEGACY_HASHES=%{?with_legacy_hashes:ON}%{!?with_legacy_hashes:OFF} \
|
|
||||||
-DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF}
|
-DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF}
|
||||||
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
|
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
|
||||||
# Build C documentation
|
# Build C documentation
|
||||||
@ -185,19 +184,45 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
|
|||||||
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
|
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed May 11 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.17.7-6
|
* Fri Mar 14 2025 Ales Matej <amatej@redhat.com> - 0.20.1-4
|
||||||
- Revert addition of new API for parsing main metadata together (RhBug:2062767)
|
- Add git build require, needed for binary patches (RHEL-67689)
|
||||||
|
|
||||||
* Wed Feb 16 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-4
|
* Mon Mar 10 2025 Ales Matej <amatej@redhat.com> - 0.20.1-3
|
||||||
- Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata (RhBug:1992209)
|
- Add zstd compression support (RHEL-67689)
|
||||||
|
|
||||||
* Mon Nov 29 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-3
|
* Mon Jun 26 2023 Jaroslav Rohel <jrohel@redhat.com> - 0.20.1-2
|
||||||
- Fix memory leak of `tmp_err` (RhBug:2005781)
|
- Change test to compare contents instead of checksum, cleanup (RhBug:2130179)
|
||||||
|
|
||||||
* Mon Nov 15 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-2
|
* Thu Sep 22 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.20.1-1
|
||||||
- Build with legacy hashes (RhBug:2022271)
|
- Update to 0.20.1
|
||||||
|
- createrepo_c shouldn't silently produce duplicate-NEVRA repos
|
||||||
|
- Fix bad performance with task queue management
|
||||||
|
- Update errno usage to fix incorrect GError messages
|
||||||
|
- Install header for createrepo_shared module
|
||||||
|
- Remove C API for cr_xml_parse_main_metadata_together
|
||||||
|
- Remove python bindings for xml_parse_main_metadata_together
|
||||||
|
- Fix '&' encoding in attributes when parsing repodata
|
||||||
|
- Add a streaming parsing API that is user-controllable.
|
||||||
|
- Fix a memory leak of primary pkg when parsing interrupted
|
||||||
|
- Fix a memory leak when removing the first link in a list
|
||||||
|
- Remove `allow_out_of_order` option for `xml_parse_main_metadata_together`
|
||||||
|
- Make parse warnings visible through cr.Repomd(), cr.UpdateInfo()
|
||||||
|
- Use --error-exit-val option by default
|
||||||
|
- If new and old repomd matches during --update don't update
|
||||||
|
- Add `cr_repomd_compare` for comparing two repomds
|
||||||
|
- Store parsed repomd in `cr_MetadataLocation`
|
||||||
|
- Set database version only for the database records, not everything
|
||||||
|
- Use copy+delete fallback when moving of a dir fails
|
||||||
|
- Fix memory leaks
|
||||||
|
- [spec] Option for legacy hashes, enable on RHEL <= 8 (RhBug:2022271)
|
||||||
|
|
||||||
* Tue Nov 09 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-1
|
* Mon Jun 6 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.17.7-4
|
||||||
|
- Revert addition of new API for parsing main metadata together (RhBug:2063141)
|
||||||
|
|
||||||
|
* Wed Feb 16 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 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 <pkratoch@redhat.com> - 0.17.7-1
|
||||||
- Update to 0.17.7
|
- Update to 0.17.7
|
||||||
- Remove insecure hashes SHA-1 and MD5 from the default build (RhBug:1935486)
|
- Remove insecure hashes SHA-1 and MD5 from the default build (RhBug:1935486)
|
||||||
- Fix error when updating repo with removed modules metadata
|
- Fix error when updating repo with removed modules metadata
|
||||||
@ -205,76 +230,151 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
|
|||||||
- Fix memory leaks (RhBug:1998426)
|
- Fix memory leaks (RhBug:1998426)
|
||||||
- Fix valgrind warnings caused by subprocess calls
|
- Fix valgrind warnings caused by subprocess calls
|
||||||
|
|
||||||
* Wed Sep 15 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-3
|
* Mon Aug 16 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-5
|
||||||
- Preserve changed API for cr_compress_file_with_stat (RhBug:1973588)
|
- Fix issues detected by static analyzers
|
||||||
|
|
||||||
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-2
|
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.17.2-4
|
||||||
- Fix: cr_compress_file_with_stat: Memory leak
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
|
Related: rhbz#1991688
|
||||||
|
|
||||||
* Wed Apr 28 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-1
|
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-3
|
||||||
|
- Fix spec conditional to enable libmodulemd in RHEL >= 8 (RhBug:1816753)
|
||||||
|
|
||||||
|
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.17.2-2
|
||||||
|
- Rebuilt for RHEL 9 BETA for openssl 3.0
|
||||||
|
Related: rhbz#1971065
|
||||||
|
|
||||||
|
* Mon Apr 26 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-1
|
||||||
- Update to 0.17.2
|
- Update to 0.17.2
|
||||||
- Fix Python deprecation (PY_SSIZE_T_CLEAN) (RhBug:1891785)
|
- Fix Python deprecation (PY_SSIZE_T_CLEAN) (RhBug:1891785)
|
||||||
- Revert back to old c API for destination file of cr_compress_file_with_stat and cr_compress_file to prevent a memory leak
|
- Revert back to old c API for destination file of cr_compress_file_with_stat and cr_compress_file to prevent a memory leak
|
||||||
|
- Never leave behind .repodata lock on exit (RhBug:1906831)
|
||||||
- Disable drpm for RHEL >= 9 (RhBug:1914828)
|
- Disable drpm for RHEL >= 9 (RhBug:1914828)
|
||||||
- Setting updated/issued_date to None doesn't produce garbage values (RhBug:1921715)
|
- Setting updated/issued_date to None doesn't produce garbage values (RhBug:1921715)
|
||||||
- Allow taking __repr__ (__str__) of closed xmlfile and sqlite (RhBug:1913465)
|
- Allow taking __repr__ (__str__) of closed xmlfile and sqlite (RhBug:1913465)
|
||||||
|
|
||||||
* Fri Jan 29 2021 Nicola Sella <nsella@redhat.com> - 0.16.2-2
|
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 0.16.2-3
|
||||||
- Never leave behind .repodata lock on exit (RhBug:1906831)
|
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||||
|
|
||||||
* Mon Nov 09 2020 Nicola Sella <nsella@redhat.com> - 0.16.2-1
|
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.2-2
|
||||||
- Update to 0.16.2
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
- Add module metadata support to createrepo_c (RhBug:1795936)
|
|
||||||
|
* Mon Nov 23 2020 Nicola Sella <nsella@redhat.com> - 0.16.2-1
|
||||||
- Fix various memory leaks
|
- Fix various memory leaks
|
||||||
|
- Add a new function to replace PyObject_ToStrOrNull()
|
||||||
|
|
||||||
* Thu Jul 30 2020 Ales Matej <amatej@redhat.com> - 0.15.11-2
|
* Tue Oct 06 2020 Nicola Sella <nsella@redhat.com> - 0.16.1
|
||||||
|
- Update to 0.16.1
|
||||||
|
- Add the section number to the manual pages
|
||||||
- Parse xml snippet in smaller parts (RhBug:1859689)
|
- Parse xml snippet in smaller parts (RhBug:1859689)
|
||||||
|
- Add module metadata support to createrepo_c (RhBug:1795936)
|
||||||
|
|
||||||
* Wed Apr 29 2020 Ales Matej <amatej@redhat.com> - 0.15.11-1
|
* Fri Aug 07 2020 Nicola Sella <nsella@redhat.com> - 0.15.11-4
|
||||||
|
- spec: Fix building with new cmake macros
|
||||||
|
|
||||||
|
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.11-3
|
||||||
|
- Second attempt - Rebuilt for
|
||||||
|
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.11-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Jun 02 2020 Ales Matej <amatej@redhat.com> - 0.15.11-1
|
||||||
- Update to 0.15.11
|
- Update to 0.15.11
|
||||||
- Add --arch-expand option
|
- Switch updateinfo to explicitly include bool values (RhBug:1772466)
|
||||||
- Fix various memory leaks
|
|
||||||
|
|
||||||
* Wed Apr 29 2020 Ales Matej <amatej@redhat.com> - 0.15.10-1
|
|
||||||
- Update to 0.15.10
|
|
||||||
- New option --recycle-pkglist for --update mode
|
|
||||||
- Add restart_suggested field to updatecollectionpackage in updateinfo.xml
|
|
||||||
- Add relogin_suggested field to updatecollectionpackage in updateinfo.xml (Rhbug:1779751)
|
|
||||||
- Export all changelog entries to other.xml in compatibility mode
|
|
||||||
- Enhance error handling when locating repositories (RhBug:1762697)
|
- Enhance error handling when locating repositories (RhBug:1762697)
|
||||||
|
- Make documentation for --update-md-path more specific
|
||||||
- Clean up temporary .repodata on sigint
|
- Clean up temporary .repodata on sigint
|
||||||
- Support issued date in epoch format set by Python API (RhBug:1779751)
|
- Add relogin_suggested to updatecollectionpackage (Rhbug:1779751)
|
||||||
- Allow parsing of xml repodata from string via new API functions (RhBug:1804308)
|
- Support issued date in epoch format in Python API (RhBug:1779751)
|
||||||
- Fix a bug when setting updateCollectionModule (RhBug:1821781)
|
- Allow parsing of xml repodata from string (RhBug: 1804308)
|
||||||
|
- Remove expat xml library in favor of libxml2
|
||||||
|
- Copy updateCollectionModule on assignment to prevent bogus data (RhBug:1821781)
|
||||||
|
- Add --arch-expand option to mergerepo_c
|
||||||
|
|
||||||
* Tue Mar 24 2020 Stephen Gallagher <sgallagh@redhat.com> - 0.15.1-3
|
* Sun May 24 2020 Miro Hrončok <mhroncok@redhat.com> - 0.15.5-3
|
||||||
- Fix incorrect conditional causing libmodulemd support to be disabled (RhBug:1816753)
|
- Rebuilt for Python 3.9
|
||||||
|
|
||||||
* Mon Jan 13 2020 Ales Matej <amatej@redhat.com> - 0.15.1-2
|
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.5-2
|
||||||
- Add reboot_suggested to UpdateRecord (RhBug:1772466)
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
- Explicitly output boolean values for updateinfo.xml (RhBug:1772466)
|
|
||||||
- Fix modifyrepo_c with modules.yaml as a symbolic link (RhBug:1776399)
|
|
||||||
|
|
||||||
* Tue Oct 22 2019 Ales Matej <amatej@redhat.com> - 0.15.1-1
|
* Wed Jan 08 2020 Pavel Raiskup <praiskup@redhat.com> - 0.15.5-1
|
||||||
|
- update to upstream 0.15.5 release, per
|
||||||
|
https://github.com/rpm-software-management/createrepo_c/compare/0.15.4...0.15.5
|
||||||
|
- new option --recycle-pkglist for --update mode
|
||||||
|
- a bit more optimal --update caching
|
||||||
|
|
||||||
|
* Wed Dec 11 2019 Mohan Boddu <mboddu@bhujji.com> - 0.15.4-1
|
||||||
|
- Update to upstream 0.15.4 release
|
||||||
|
|
||||||
|
* Tue Sep 17 2019 Ales Matej <amatej@redhat.com> - 0.15.1-1
|
||||||
- Update to 0.15.1
|
- Update to 0.15.1
|
||||||
- Allow pip to see installation of python3-createrepo_c
|
- Allow pip to see installation of python3-createrepo_c
|
||||||
- Imporove documentation
|
- Imporove documentation
|
||||||
|
- Switch off timestamping of documentation to avoid file conflics for createrepo_c-devel i686/x86_64 parallel installation
|
||||||
- Remove dependency on deltarpm in favour of drpm
|
- Remove dependency on deltarpm in favour of drpm
|
||||||
|
|
||||||
|
* Sat Aug 17 2019 Miro Hrončok <mhroncok@redhat.com> - 0.14.2-3
|
||||||
|
- Rebuilt for Python 3.8
|
||||||
|
|
||||||
|
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.2-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jun 27 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.14.2-1
|
||||||
|
- Update to 0.14.2
|
||||||
- Obsolete createrepo on all Fedoras again (RhBug:1702771)
|
- Obsolete createrepo on all Fedoras again (RhBug:1702771)
|
||||||
- Fix issue with createrepo_c hanging at the end (RhBug:1714666)
|
- Fix issue with createrepo_c hanging at the end (RhBug:1714666)
|
||||||
- Don't include packages with forbidden control chars in repodata
|
- Don't include packages with forbidden control chars in repodata
|
||||||
|
|
||||||
|
* Mon Jun 10 22:13:18 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.14.1-4
|
||||||
|
- Rebuild for RPM 4.15
|
||||||
|
|
||||||
|
* Mon Jun 10 15:42:00 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.14.1-3
|
||||||
|
- Rebuild for RPM 4.15
|
||||||
|
|
||||||
|
* Tue May 28 2019 Stephen Gallagher <sgallagh@redhat.com> - 0.14.1-2
|
||||||
- Depend on the appropriate minimum version of libmodulemd
|
- Depend on the appropriate minimum version of libmodulemd
|
||||||
|
|
||||||
|
* Fri May 24 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.14.1-1
|
||||||
|
- Update to 0.14.1
|
||||||
- Add --pkgorigins mode for Koji
|
- Add --pkgorigins mode for Koji
|
||||||
|
- Correct pkg count in headers if there were invalid pkgs (RhBug:1596211)
|
||||||
- Prevent exiting with 0 if errors occur while finalizing repodata.
|
- Prevent exiting with 0 if errors occur while finalizing repodata.
|
||||||
|
|
||||||
|
* Mon May 20 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.13.2-2
|
||||||
|
- Backport patch to fix crash when dumping updateinfo and module is ommited (RhBug:1707981)
|
||||||
|
|
||||||
|
* Tue May 07 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.13.2-1
|
||||||
|
- Update to 0.13.2
|
||||||
- Add support for reading and merging module metadata
|
- Add support for reading and merging module metadata
|
||||||
|
- Add support for modular errata (RhBug:1656584)
|
||||||
- Update --keep-all-metadata to keep all additional metadata, not just updateinfo and groupfile (RhBug:1639287)
|
- Update --keep-all-metadata to keep all additional metadata, not just updateinfo and groupfile (RhBug:1639287)
|
||||||
- mergerepo_c: Add support for --koji simple mode
|
- mergerepo_c: Add support for --koji simple mode
|
||||||
- Fix generating corrupted sqlite files (RhBug: 1696808)
|
- Fix generating corrupted sqlite files (RhBug: 1696808)
|
||||||
|
- modifyrepo_c: Prevent doubling of compression suffix (test.gz.gz)
|
||||||
- Do not obsolete createrepo on Fedora < 31
|
- Do not obsolete createrepo on Fedora < 31
|
||||||
|
|
||||||
|
* Mon Mar 11 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.12.2-1
|
||||||
|
- Update to 0.12.2
|
||||||
- mergerepo_c: check if nevra is NULL and warn user about src.rpm naming
|
- mergerepo_c: check if nevra is NULL and warn user about src.rpm naming
|
||||||
|
- Consistently produce valid URLs by prepending protocol. (RhBug:1632121)
|
||||||
|
|
||||||
|
* Wed Feb 13 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.12.1-1
|
||||||
|
- Update to 0.12.1-1
|
||||||
- Include file timestamp in repomd.xml to allow reproducing exact metadata as produced in the past
|
- Include file timestamp in repomd.xml to allow reproducing exact metadata as produced in the past
|
||||||
- Enhance support of zchunk
|
- Enhance support of zchunk
|
||||||
|
|
||||||
|
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.0-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Dec 12 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.12.0-1
|
||||||
|
- Update to 0.12.0
|
||||||
- Support of zchunk
|
- Support of zchunk
|
||||||
|
|
||||||
|
* Mon Nov 26 2018 Miro Hrončok <mhroncok@redhat.com> - 0.11.1-2
|
||||||
|
- Drop Python 2 subpackage on Fedora 30 (#1651182)
|
||||||
|
|
||||||
|
* Tue Jul 31 2018 Daniel Mach <dmach@redhat.com> - 0.11.1-1
|
||||||
- [spec] Fix ldconfig for rhel <= 7
|
- [spec] Fix ldconfig for rhel <= 7
|
||||||
- Fix "CR_DELTA_RPM_SUPPORT" redefined warnings
|
- Fix "CR_DELTA_RPM_SUPPORT" redefined warnings
|
||||||
- Set to build against Python 3 by default
|
- Set to build against Python 3 by default
|
||||||
@ -282,15 +382,14 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
|
|||||||
- Add mergerepo_c --repo-prefix-search and --repo-prefix-replace.
|
- Add mergerepo_c --repo-prefix-search and --repo-prefix-replace.
|
||||||
- Fix missing packages in mergerepo_c in case multiple VR exists for single pkg in repo.
|
- Fix missing packages in mergerepo_c in case multiple VR exists for single pkg in repo.
|
||||||
|
|
||||||
* Thu Aug 08 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.11.0-3
|
* Wed Jul 25 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.11.0-4
|
||||||
- Backport patch to switch off timestamps on documentation in order to remove
|
- Backport patch for multiple packages with same name for mergerepo_c
|
||||||
file conflicts (RhBug:1738788)
|
|
||||||
|
|
||||||
* Mon Jul 22 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.11.0-2
|
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.0-3
|
||||||
- Consistently produce valid URLs by prepending protocol. (RhBug:1632121)
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
- modifyrepo_c: Prevent doubling of compression (test.gz.gz) (RhBug:1639287)
|
|
||||||
- Correct pkg count in headers if there were invalid pkgs (RhBug:1596211)
|
* Mon Jul 02 2018 Miro Hrončok <mhroncok@redhat.com> - 0.11.0-2
|
||||||
- Add support for modular errata (RhBug:1656584)
|
- Rebuilt for Python 3.7
|
||||||
|
|
||||||
* Wed Jun 27 2018 Marek Blaha <mblaha@redhat.com> - 0.11.0-1
|
* Wed Jun 27 2018 Marek Blaha <mblaha@redhat.com> - 0.11.0-1
|
||||||
- Update to 0.11.0
|
- Update to 0.11.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user