createrepo_c library  0.3.0
C library for metadata manipulation
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
repomd.h
1 /* createrepo_c - Library of routines for manipulation with repodata
2  * Copyright (C) 2012 Tomas Mlcoch
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17  * USA.
18  */
19 
20 #ifndef __C_CREATEREPOLIB_REPOMD_H__
21 #define __C_CREATEREPOLIB_REPOMD_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "checksum.h"
28 #include "compression_wrapper.h"
29 #include "package.h"
30 
73 typedef struct {
74  char *type;
75  char *location_real;
76  char *location_href;
77  char *location_base;
78  char *checksum;
79  char *checksum_type;
80  char *checksum_open;
82  gint64 timestamp;
83  gint64 size;
84  gint64 size_open;
85  int db_ver;
87  GStringChunk *chunk;
89 
92 typedef struct {
93  gchar *cpeid;
94  gchar *val;
95 } cr_DistroTag;
96 
99 typedef struct {
100  gchar *revision;
101  gchar *repoid;
102  gchar *repoid_type;
103  gchar *contenthash;
105  GSList *repo_tags;
106  GSList *content_tags;
107  GSList *distro_tags;
108  GSList *records;
110  GStringChunk *chunk;
113 } cr_Repomd;
114 
119 cr_RepomdRecord *cr_repomd_record_new(const char *type, const char *path);
120 
127 
133 
147  cr_ChecksumType checksum_type,
148  GError **err);
149 
162  cr_RepomdRecord *compressed_record,
163  cr_ChecksumType checksum_type,
164  cr_CompressionType compression,
165  GError **err);
166 
172 int cr_repomd_record_rename_file(cr_RepomdRecord *record, GError **err);
173 
180  cr_ContentStat *stats);
181 
185 
190 void cr_repomd_set_record(cr_Repomd *repomd, cr_RepomdRecord *record);
191 
196 void cr_repomd_set_revision(cr_Repomd *repomd, const char *revision);
197 
203 void cr_repomd_set_repoid(cr_Repomd *repomd,
204  const char *repoid,
205  const char *type);
206 
213  const char *hash,
214  const char *type);
215 
222  const char *cpeid,
223  const char *tag);
224 
229 void cr_repomd_add_repo_tag(cr_Repomd *repomd, const char *tag);
230 
235 void cr_repomd_add_content_tag(cr_Repomd *repomd, const char *tag);
236 
242 cr_RepomdRecord *cr_repomd_get_record(cr_Repomd *repomd, const char *type);
243 
251 
257 void cr_repomd_sort_records(cr_Repomd *repomd);
258 
262 void cr_repomd_free(cr_Repomd *repomd);
263 
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 #endif /* __C_CREATEREPOLIB_REPOMD_H__ */