Change in repomd module interface
authorTomas Mlcoch <tmlcoch@redhat.com>
Thu, 15 Nov 2012 13:15:02 +0000 (14:15 +0100)
committerTomas Mlcoch <tmlcoch@redhat.com>
Thu, 15 Nov 2012 13:15:02 +0000 (14:15 +0100)
src/createrepo_c.c
src/mergerepo_c.c
src/repomd.c
src/repomd.h

index 3a7fbe6..895a1c8 100644 (file)
@@ -1009,9 +1009,9 @@ main(int argc, char **argv)
 
     // XML
 
-    cr_fill_repomdrecord(pri_xml_rec, &(cmd_options->checksum_type));
-    cr_fill_repomdrecord(fil_xml_rec, &(cmd_options->checksum_type));
-    cr_fill_repomdrecord(oth_xml_rec, &(cmd_options->checksum_type));
+    cr_fill_repomdrecord(pri_xml_rec, cmd_options->checksum_type);
+    cr_fill_repomdrecord(fil_xml_rec, cmd_options->checksum_type);
+    cr_fill_repomdrecord(oth_xml_rec, cmd_options->checksum_type);
 
 
     // Groupfile
@@ -1021,7 +1021,7 @@ main(int argc, char **argv)
         compressed_groupfile_rec = cr_new_repomdrecord(groupfile);
         cr_process_groupfile_repomdrecord(groupfile_rec,
                                           compressed_groupfile_rec,
-                                          &(cmd_options->checksum_type),
+                                          cmd_options->checksum_type,
                                           groupfile_compression);
     }
 
@@ -1030,7 +1030,7 @@ main(int argc, char **argv)
 
     if (updateinfo) {
         updateinfo_rec = cr_new_repomdrecord(updateinfo);
-        cr_fill_repomdrecord(updateinfo_rec, &(cmd_options->checksum_type));
+        cr_fill_repomdrecord(updateinfo_rec, cmd_options->checksum_type);
     }
 
 
@@ -1075,9 +1075,9 @@ main(int argc, char **argv)
         fil_db_rec = cr_new_repomdrecord(fil_db_name);
         oth_db_rec = cr_new_repomdrecord(oth_db_name);
 
-        cr_fill_repomdrecord(pri_db_rec, &(cmd_options->checksum_type));
-        cr_fill_repomdrecord(fil_db_rec, &(cmd_options->checksum_type));
-        cr_fill_repomdrecord(oth_db_rec, &(cmd_options->checksum_type));
+        cr_fill_repomdrecord(pri_db_rec, cmd_options->checksum_type);
+        cr_fill_repomdrecord(fil_db_rec, cmd_options->checksum_type);
+        cr_fill_repomdrecord(oth_db_rec, cmd_options->checksum_type);
 
         g_free(pri_db_name);
         g_free(fil_db_name);
index 81e00e3..1f34131 100644 (file)
@@ -1136,9 +1136,9 @@ dump_merged_metadata(GHashTable *merged_hashtable,
 
     // XML
 
-    cr_fill_repomdrecord(pri_xml_rec, NULL);
-    cr_fill_repomdrecord(fil_xml_rec, NULL);
-    cr_fill_repomdrecord(oth_xml_rec, NULL);
+    cr_fill_repomdrecord(pri_xml_rec, CR_CHECKSUM_SHA256);
+    cr_fill_repomdrecord(fil_xml_rec, CR_CHECKSUM_SHA256);
+    cr_fill_repomdrecord(oth_xml_rec, CR_CHECKSUM_SHA256);
 
 
     // Groupfile
@@ -1148,7 +1148,7 @@ dump_merged_metadata(GHashTable *merged_hashtable,
         compressed_groupfile_rec = cr_new_repomdrecord(groupfile);
         cr_process_groupfile_repomdrecord(groupfile_rec,
                                           compressed_groupfile_rec,
-                                          NULL,
+                                          CR_CHECKSUM_SHA256,
                                           cmd_options->groupfile_compression_type);
     }
 
@@ -1157,7 +1157,7 @@ dump_merged_metadata(GHashTable *merged_hashtable,
 
     if (!cmd_options->noupdateinfo) {
         update_info_rec = cr_new_repomdrecord(update_info_filename);
-        cr_fill_repomdrecord(update_info_rec, NULL);
+        cr_fill_repomdrecord(update_info_rec, CR_CHECKSUM_SHA256);
     }
 
 
@@ -1166,7 +1166,7 @@ dump_merged_metadata(GHashTable *merged_hashtable,
     if (cmd_options->koji) {
         gchar *pkgorigins_path = g_strconcat(cmd_options->tmp_out_repo, "pkgorigins.gz", NULL);
         pkgorigins_rec = cr_new_repomdrecord(pkgorigins_path);
-        cr_fill_repomdrecord(pkgorigins_rec, NULL);
+        cr_fill_repomdrecord(pkgorigins_rec, CR_CHECKSUM_SHA256);
         g_free(pkgorigins_path);
     }
 
@@ -1220,9 +1220,9 @@ dump_merged_metadata(GHashTable *merged_hashtable,
         g_free(fil_db_c_filename);
         g_free(oth_db_c_filename);
 
-        cr_fill_repomdrecord(pri_db_rec, NULL);
-        cr_fill_repomdrecord(fil_db_rec, NULL);
-        cr_fill_repomdrecord(oth_db_rec, NULL);
+        cr_fill_repomdrecord(pri_db_rec, CR_CHECKSUM_SHA256);
+        cr_fill_repomdrecord(fil_db_rec, CR_CHECKSUM_SHA256);
+        cr_fill_repomdrecord(oth_db_rec, CR_CHECKSUM_SHA256);
     }
 
 
index 141c7db..3867909 100644 (file)
@@ -35,9 +35,6 @@
 
 #define LOCATION_HREF_PREFIX            "repodata/"
 
-#define DEFAULT_CHECKSUM                "sha256"
-#define DEFAULT_CHECKSUM_ENUM_VAL        CR_CHECKSUM_SHA256
-
 #define DEFAULT_DATABASE_VERSION        10
 
 #define STR_BUFFER_SIZE      32
@@ -190,10 +187,10 @@ get_compressed_content_stat(const char *filename, cr_ChecksumType checksum_type)
 
 
 int
-cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType *checksum_type)
+cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType checksum_type)
 {
-    const char *checksum_str = DEFAULT_CHECKSUM;
-    cr_ChecksumType checksum_t = DEFAULT_CHECKSUM_ENUM_VAL;
+    const char *checksum_str;
+    cr_ChecksumType checksum_t;
     gchar *path;
 
     if (!md || !(md->location_real) || !strlen(md->location_real)) {
@@ -203,10 +200,8 @@ cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType *checksum_type)
 
     path = md->location_real;
 
-    if (checksum_type) {
-        checksum_str = cr_checksum_name_str(*checksum_type);
-        checksum_t = *checksum_type;
-    }
+    checksum_str = cr_checksum_name_str(checksum_type);
+    checksum_t = checksum_type;
 
     if (!g_file_test(path, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_REGULAR)) {
         // File doesn't exists
@@ -284,7 +279,7 @@ cr_fill_repomdrecord(cr_RepomdRecord md, cr_ChecksumType *checksum_type)
 void
 cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
                                   cr_RepomdRecord cgroupfile,
-                                  cr_ChecksumType *checksum_type,
+                                  cr_ChecksumType checksum_type,
                                   cr_CompressionType groupfile_compression)
 {
     const char *suffix;
@@ -298,6 +293,8 @@ cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
     long gf_size = -1, cgf_size = -1;
     long gf_time = -1, cgf_time = -1;
     struct stat gf_stat, cgf_stat;
+    const char *checksum_str;
+    cr_ChecksumType checksum_t;
 
     if (!groupfile || !(groupfile->location_real)
         || !strlen(groupfile->location_real) || !cgroupfile) {
@@ -307,13 +304,8 @@ cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
 
     // Checksum stuff
 
-    const char *checksum_str = DEFAULT_CHECKSUM;
-    cr_ChecksumType checksum_t = DEFAULT_CHECKSUM_ENUM_VAL;
-
-    if (checksum_type) {
-        checksum_str = cr_checksum_name_str(*checksum_type);
-        checksum_t = *checksum_type;
-    }
+    checksum_str = cr_checksum_name_str(checksum_type);
+    checksum_t = checksum_type;
 
 
     // Paths
index 3b15d98..d3b22b1 100644 (file)
@@ -116,7 +116,7 @@ void cr_free_repomdrecord(cr_RepomdRecord record);
  * @param checksum_type         type of checksum to use
  */
 int cr_fill_repomdrecord(cr_RepomdRecord record,
-                         cr_ChecksumType *checksum_type);
+                         cr_ChecksumType checksum_type);
 
 /** \ingroup repomd
  * Analogue of cr_fill_repomdrecord but for groupfile.
@@ -131,7 +131,7 @@ int cr_fill_repomdrecord(cr_RepomdRecord record,
  */
 void cr_process_groupfile_repomdrecord(cr_RepomdRecord groupfile,
                                        cr_RepomdRecord compressed_groupfile,
-                                       cr_ChecksumType *checksum_type,
+                                       cr_ChecksumType checksum_type,
                                        cr_CompressionType compression);
 
 /** \ingroup repomd