Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rpm-software-management/createrepo_c.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mlcoch <xtojaj@gmail.com>2016-12-26 12:04:29 +0300
committerGitHub <noreply@github.com>2016-12-26 12:04:29 +0300
commit748891ff8ee524c2d37926c608cd2794f88013f3 (patch)
tree0babf010ea6c192662958131e398dff8c065884b
parent547b5db54bb71157eb0187c1c6de8581f4b8ff44 (diff)
parent5e44d23842d68e31e92498edeb6aba2e72a63abd (diff)
Merge pull request #64 from puiterwijk/set-record-be-set
Make set_record act like a setter
-rw-r--r--src/repomd.c8
-rw-r--r--tests/python/tests/test_repomd.py4
2 files changed, 12 insertions, 0 deletions
diff --git a/src/repomd.c b/src/repomd.c
index fea2c7e..3e79ccf 100644
--- a/src/repomd.c
+++ b/src/repomd.c
@@ -682,6 +682,14 @@ cr_repomd_set_record(cr_Repomd *repomd,
cr_RepomdRecord *record)
{
if (!repomd || !record) return;
+
+ cr_RepomdRecord *delrec = NULL;
+ // Remove all existing record of the same type
+ while((delrec = cr_repomd_get_record(repomd, record->type)) != NULL) {
+ cr_repomd_detach_record(repomd, delrec);
+ cr_repomd_record_free(delrec);
+ }
+
repomd->records = g_slist_append(repomd->records, record);
}
diff --git a/tests/python/tests/test_repomd.py b/tests/python/tests/test_repomd.py
index 283dedc..6b6b3ad 100644
--- a/tests/python/tests/test_repomd.py
+++ b/tests/python/tests/test_repomd.py
@@ -99,6 +99,10 @@ class TestCaseRepomd(unittest.TestCase):
self.assertEqual(len(md.records), 1)
+ md.set_record(rec)
+
+ self.assertEqual(len(md.records), 1)
+
md.repoid = None
md.contenthash = None