import createrepo_c-0.17.2-3.el8
This commit is contained in:
parent
5295dd8323
commit
12a0fb39d1
@ -1 +1 @@
|
||||
39e70f306cff3675e581b204a2754212280342e1 SOURCES/createrepo_c-0.16.2.tar.gz
|
||||
9feb9bf8e6a9812a08ef8156c3ccc1c4dac90b7a SOURCES/createrepo_c-0.17.2.tar.gz
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/createrepo_c-0.16.2.tar.gz
|
||||
SOURCES/createrepo_c-0.17.2.tar.gz
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 1ec1e767e4a48bc2c1d09b52da9e749352f8d925 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Thu, 6 May 2021 19:09:19 +0200
|
||||
Subject: [PATCH] Fix: cr_compress_file_with_stat: Memory leak
|
||||
|
||||
---
|
||||
src/misc.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/misc.c b/src/misc.c
|
||||
index e5350ac..59c04e6 100644
|
||||
--- a/src/misc.c
|
||||
+++ b/src/misc.c
|
||||
@@ -503,6 +503,8 @@ cr_compress_file_with_stat(const char *src,
|
||||
if (!orig) {
|
||||
ret = tmp_err->code;
|
||||
g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", src);
|
||||
+ if (dst != in_dst)
|
||||
+ g_free(dst);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
libgit2 1.0.1
|
||||
|
@ -1,106 +0,0 @@
|
||||
From e21b038a231e2743e30915af9575b8c43e9fda1f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||
Date: Tue, 15 Dec 2020 14:15:39 +0100
|
||||
Subject: [PATCH] Never leave behind .repodata lock on exit (RhBug:1906831
|
||||
|
||||
createrepo_c was removing `.repodata` if `exit_val` was se to failure.
|
||||
Problem is `exit_val` is set only on a couple of places so most of the
|
||||
failures (no matter how rare) leave `.repodata` behind.
|
||||
|
||||
However because on a successful run `.repodata` is renamed to normal
|
||||
output `repodata` we know that if `.repodata` are present there was an
|
||||
error and we can delete them.
|
||||
---
|
||||
src/createrepo_c.c | 5 +----
|
||||
src/createrepo_shared.c | 29 +++++++++--------------------
|
||||
2 files changed, 10 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/src/createrepo_c.c b/src/createrepo_c.c
|
||||
index 8c90ebd..eeb871c 100644
|
||||
--- a/src/createrepo_c.c
|
||||
+++ b/src/createrepo_c.c
|
||||
@@ -665,9 +665,6 @@ main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
- // Set exit_value pointer used in cleanup handlers
|
||||
- cr_set_global_exit_value(&exit_val);
|
||||
-
|
||||
// Setup cleanup handlers
|
||||
if (!cr_set_cleanup_handler(lock_dir, tmp_out_repo, &tmp_err)) {
|
||||
g_printerr("%s\n", tmp_err->message);
|
||||
@@ -885,7 +882,7 @@ main(int argc, char **argv)
|
||||
char *moduleindex_str = modulemd_module_index_dump_to_string (moduleindex, &tmp_err);
|
||||
g_clear_pointer(&moduleindex, g_object_unref);
|
||||
if (tmp_err) {
|
||||
- g_critical("%s: Cannot cannot dump module index: %s", __func__, tmp_err->message);
|
||||
+ g_critical("%s: Cannot dump module index: %s", __func__, tmp_err->message);
|
||||
free(moduleindex_str);
|
||||
g_clear_error(&tmp_err);
|
||||
exit(EXIT_FAILURE);
|
||||
diff --git a/src/createrepo_shared.c b/src/createrepo_shared.c
|
||||
index f8ef998..d1a37bd 100644
|
||||
--- a/src/createrepo_shared.c
|
||||
+++ b/src/createrepo_shared.c
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "misc.h"
|
||||
#include "cleanup.h"
|
||||
|
||||
-int *global_exit_status = NULL; // pointer to exit_value used in failure_exit_cleanup
|
||||
-
|
||||
char *global_lock_dir = NULL; // Path to .repodata/ dir that is used as a lock
|
||||
char *global_tmp_out_repo = NULL; // Path to temporary repodata directory,
|
||||
// if NULL that it's same as
|
||||
@@ -43,18 +41,16 @@ char *global_tmp_out_repo = NULL; // Path to temporary repodata directory,
|
||||
*
|
||||
*/
|
||||
static void
|
||||
-failure_exit_cleanup()
|
||||
+exit_cleanup()
|
||||
{
|
||||
- if (global_exit_status && *global_exit_status != EXIT_SUCCESS) {
|
||||
- if (global_lock_dir) {
|
||||
- g_debug("Removing %s", global_lock_dir);
|
||||
- cr_remove_dir(global_lock_dir, NULL);
|
||||
- }
|
||||
+ if (global_lock_dir) {
|
||||
+ g_debug("Removing %s", global_lock_dir);
|
||||
+ cr_remove_dir(global_lock_dir, NULL);
|
||||
+ }
|
||||
|
||||
- if (global_tmp_out_repo) {
|
||||
- g_debug("Removing %s", global_tmp_out_repo);
|
||||
- cr_remove_dir(global_tmp_out_repo, NULL);
|
||||
- }
|
||||
+ if (global_tmp_out_repo) {
|
||||
+ g_debug("Removing %s", global_tmp_out_repo);
|
||||
+ cr_remove_dir(global_tmp_out_repo, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,16 +61,9 @@ static void
|
||||
sigint_catcher(int sig)
|
||||
{
|
||||
g_message("%s caught: Terminating...", strsignal(sig));
|
||||
- *global_exit_status = 1;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
-void
|
||||
-cr_set_global_exit_value(int *exit_val)
|
||||
-{
|
||||
- global_exit_status = exit_val;
|
||||
-}
|
||||
-
|
||||
gboolean
|
||||
cr_set_cleanup_handler(const char *lock_dir,
|
||||
const char *tmp_out_repo,
|
||||
@@ -90,7 +79,7 @@ cr_set_cleanup_handler(const char *lock_dir,
|
||||
global_tmp_out_repo = NULL;
|
||||
|
||||
// Register on exit cleanup function
|
||||
- if (atexit(failure_exit_cleanup))
|
||||
+ if (atexit(exit_cleanup))
|
||||
g_warning("Cannot set exit cleanup function by atexit()");
|
||||
|
||||
// Prepare signal handler configuration
|
@ -0,0 +1,380 @@
|
||||
From a611bb0c3729713af28031cdf1d056823d663db1 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
|
||||
---
|
||||
src/misc.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
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, 204 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/src/misc.c b/src/misc.c
|
||||
index 59c04e6..b3a218c 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,142 @@ 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);
|
||||
+ 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 9ef839d..91b5430 100644
|
||||
--- a/src/threads.c
|
||||
+++ b/src/threads.c
|
||||
@@ -100,13 +100,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.0.1
|
||||
|
@ -1,34 +1,22 @@
|
||||
%global libmodulemd_version 2.3.0
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%define __cmake_in_source_build 1
|
||||
|
||||
# Bash completion (we need different approach for RHEL-6)
|
||||
%if 0%{?rhel} == 6
|
||||
%global bash_completion %config%{_sysconfdir}/bash_completion.d/createrepo_c.bash
|
||||
%else
|
||||
%global bash_completion %{_datadir}/bash-completion/completions/*
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} <= 7
|
||||
%bcond_with python3
|
||||
%if 0%{?rhel} && ( 0%{?rhel} <= 7 || 0%{?rhel} >= 9 )
|
||||
%bcond_with drpm
|
||||
%else
|
||||
%bcond_without python3
|
||||
%bcond_without drpm
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} > 29 || 0%{?rhel} > 7
|
||||
%bcond_with python2
|
||||
%else
|
||||
%bcond_without python2
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} || (0%{?fedora} && 0%{?fedora} < 29)
|
||||
%bcond_with zchunk
|
||||
%else
|
||||
%bcond_without zchunk
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} < 8 || (0%{?fedora} && 0%{?fedora} < 29)
|
||||
%if (0%{?rhel} && 0%{?rhel} < 8) || (0%{?fedora} && 0%{?fedora} < 29)
|
||||
%bcond_with libmodulemd
|
||||
%else
|
||||
%bcond_without libmodulemd
|
||||
@ -36,12 +24,13 @@
|
||||
|
||||
Summary: Creates a common metadata repository
|
||||
Name: createrepo_c
|
||||
Version: 0.16.2
|
||||
Release: 2%{?dist}
|
||||
Version: 0.17.2
|
||||
Release: 3%{?dist}
|
||||
License: GPLv2+
|
||||
URL: https://github.com/rpm-software-management/createrepo_c
|
||||
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: 0001-Never-leave-behind-repodata-lock-on-exit-RhBug-1906831.patch
|
||||
Patch1: 0001-Fix-cr_compress_file_with_stat-Memory-leak.patch
|
||||
Patch2: 0002-Preserve-changed-API-for-cr_compress_file_with_stat-RhBug1973588.patch
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc
|
||||
@ -54,6 +43,7 @@ BuildRequires: libxml2-devel
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: rpm-devel >= 4.8.0-28
|
||||
BuildRequires: sqlite-devel
|
||||
BuildRequires: xz
|
||||
BuildRequires: xz-devel
|
||||
BuildRequires: zlib-devel
|
||||
%if %{with zchunk}
|
||||
@ -66,12 +56,8 @@ BuildRequires: libmodulemd
|
||||
Requires: libmodulemd%{?_isa} >= %{libmodulemd_version}
|
||||
%endif
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
%if 0%{?rhel} == 6
|
||||
Requires: rpm >= 4.8.0-28
|
||||
%else
|
||||
BuildRequires: bash-completion
|
||||
Requires: rpm >= 4.9.0
|
||||
%endif
|
||||
%if %{with drpm}
|
||||
BuildRequires: drpm-devel >= 0.4.0
|
||||
%endif
|
||||
@ -102,84 +88,35 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
This package contains the createrepo_c C library and header files.
|
||||
These development files are for easy manipulation with a repodata.
|
||||
|
||||
%if %{with python2}
|
||||
%package -n python2-%{name}
|
||||
Summary: Python bindings for the createrepo_c library
|
||||
%{?python_provide:%python_provide python2-%{name}}
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-nose
|
||||
%if 0%{?rhel} && 0%{?rhel} <= 7
|
||||
BuildRequires: python-sphinx
|
||||
%else
|
||||
BuildRequires: python2-sphinx
|
||||
%endif
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
|
||||
%description -n python2-%{name}
|
||||
Python bindings for the createrepo_c library.
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%package -n python3-%{name}
|
||||
Summary: Python 3 bindings for the createrepo_c library
|
||||
%{?python_provide:%python_provide python3-%{name}}
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-nose
|
||||
BuildRequires: python3-sphinx
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
|
||||
%description -n python3-%{name}
|
||||
Python 3 bindings for the createrepo_c library.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
%if %{with python2}
|
||||
mkdir build-py2
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
mkdir build-py3
|
||||
%endif
|
||||
|
||||
%build
|
||||
# Build createrepo_c with Python 2
|
||||
%if %{with python2}
|
||||
pushd build-py2
|
||||
%cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python2} %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF}
|
||||
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
|
||||
%if %{without python3}
|
||||
# Build C documentation
|
||||
make doc-c
|
||||
%endif
|
||||
popd
|
||||
%endif
|
||||
|
||||
# Build createrepo_c with Pyhon 3
|
||||
%if %{with python3}
|
||||
pushd build-py3
|
||||
%cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python3} %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF}
|
||||
%cmake .. \
|
||||
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
|
||||
-DWITH_LIBMODULEMD=%{?with_libmodulemd:ON}%{!?with_libmodulemd:OFF} \
|
||||
-DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF}
|
||||
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
|
||||
# Build C documentation
|
||||
make doc-c
|
||||
popd
|
||||
%endif
|
||||
|
||||
%check
|
||||
%if %{with python2}
|
||||
pushd build-py2
|
||||
%if %{without python3}
|
||||
# Compile C tests
|
||||
make tests
|
||||
%endif
|
||||
|
||||
# Run Python 2 tests
|
||||
make ARGS="-V" test
|
||||
popd
|
||||
%endif
|
||||
|
||||
# Run Python 3 tests
|
||||
%if %{with python3}
|
||||
pushd build-py3
|
||||
# Compile C tests
|
||||
make tests
|
||||
@ -187,22 +124,12 @@ pushd build-py3
|
||||
# Run Python 3 tests
|
||||
make ARGS="-V" test
|
||||
popd
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if %{with python2}
|
||||
pushd build-py2
|
||||
# Install createrepo_c with Python 2
|
||||
make install DESTDIR=%{buildroot}
|
||||
popd
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
pushd build-py3
|
||||
# Install createrepo_c with Python 3
|
||||
make install DESTDIR=%{buildroot}
|
||||
popd
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||
ln -sr %{buildroot}%{_bindir}/createrepo_c %{buildroot}%{_bindir}/createrepo
|
||||
@ -240,28 +167,30 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
|
||||
%{_libdir}/lib%{name}.so.*
|
||||
|
||||
%files devel
|
||||
%if %{with python3}
|
||||
%doc build-py3/doc/html
|
||||
%else
|
||||
%doc build-py2/doc/html
|
||||
%endif
|
||||
%{_libdir}/lib%{name}.so
|
||||
%{_libdir}/pkgconfig/%{name}.pc
|
||||
%{_includedir}/%{name}/
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-%{name}
|
||||
%{python2_sitearch}/%{name}/
|
||||
%{python2_sitearch}/%{name}-%{version}-py%{python2_version}.egg-info
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%files -n python3-%{name}
|
||||
%{python3_sitearch}/%{name}/
|
||||
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Sep 15 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-3
|
||||
- Preserve changed API for cr_compress_file_with_stat (RhBug:1973588)
|
||||
|
||||
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-2
|
||||
- Fix: cr_compress_file_with_stat: Memory leak
|
||||
|
||||
* Wed Apr 28 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-1
|
||||
- Update to 0.17.2
|
||||
- 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
|
||||
- Disable drpm for RHEL >= 9 (RhBug:1914828)
|
||||
- Setting updated/issued_date to None doesn't produce garbage values (RhBug:1921715)
|
||||
- Allow taking __repr__ (__str__) of closed xmlfile and sqlite (RhBug:1913465)
|
||||
|
||||
* Fri Jan 29 2021 Nicola Sella <nsella@redhat.com> - 0.16.2-2
|
||||
- Never leave behind .repodata lock on exit (RhBug:1906831)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user