createrepo_c library
0.17.5
C library for metadata manipulation
|
Data Structures | |
struct | cr_XmlFile |
Macros | |
#define | cr_xmlfile_open_primary(FILENAME, COMTYPE, ERR) cr_xmlfile_open(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, ERR) |
#define | cr_xmlfile_sopen_primary(FILENAME, COMTYPE, STAT, ERR) cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, STAT, ERR) |
#define | cr_xmlfile_open_filelists(FILENAME, COMTYPE, ERR) cr_xmlfile_open(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, ERR) |
#define | cr_xmlfile_sopen_filelists(FILENAME, COMTYPE, STAT, ERR) cr_xmlfile_sopen(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, STAT, ERR) |
#define | cr_xmlfile_open_other(FILENAME, COMTYPE, ERR) cr_xmlfile_open(FILENAME, CR_XMLFILE_OTHER, COMTYPE, ERR) |
#define | cr_xmlfile_sopen_other(FILENAME, COMTYPE, STAT, ERR) cr_xmlfile_sopen(FILENAME, CR_XMLFILE_OTHER, COMTYPE, STAT, ERR) |
#define | cr_xmlfile_open_prestodelta(FILENAME, COMTYPE, ERR) cr_xmlfile_open(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, ERR) |
#define | cr_xmlfile_sopen_prestodelta(FILENAME, COMTYPE, STAT, ERR) cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, STAT, ERR) |
#define | cr_xmlfile_open_updateinfo(FILENAME, COMTYPE, ERR) cr_xmlfile_open(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, ERR) |
#define | cr_xmlfile_sopen_updateinfo(FILENAME, COMTYPE, STAT, ERR) cr_xmlfile_sopen(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, STAT, ERR) |
#define | cr_xmlfile_open(FILENAME, TYPE, COMTYPE, ERR) cr_xmlfile_sopen(FILENAME, TYPE, COMTYPE, NULL, ERR) |
Enumerations | |
enum | cr_XmlFileType { CR_XMLFILE_PRIMARY , CR_XMLFILE_FILELISTS , CR_XMLFILE_OTHER , CR_XMLFILE_PRESTODELTA , CR_XMLFILE_UPDATEINFO , CR_XMLFILE_SENTINEL } |
Functions | |
cr_XmlFile * | cr_xmlfile_sopen (const char *filename, cr_XmlFileType type, cr_CompressionType comtype, cr_ContentStat *stat, GError **err) |
int | cr_xmlfile_set_num_of_pkgs (cr_XmlFile *f, long num, GError **err) |
int | cr_xmlfile_add_pkg (cr_XmlFile *f, cr_Package *pkg, GError **err) |
int | cr_xmlfile_add_chunk (cr_XmlFile *f, const char *chunk, GError **err) |
int | cr_xmlfile_close (cr_XmlFile *f, GError **err) |
void | cr_rewrite_header_package_count (gchar *original_filename, cr_CompressionType xml_compression, int package_count, int task_count, cr_ContentStat *file_stat, gchar *zck_dict_file, GError **err) |
#define cr_xmlfile_open | ( | FILENAME, | |
TYPE, | |||
COMTYPE, | |||
ERR | |||
) | cr_xmlfile_sopen(FILENAME, TYPE, COMTYPE, NULL, ERR) |
Open a new XML file with stats. Note: Opened file must not exists! This function cannot open existing file!.
FILENAME | Filename. |
TYPE | Type of XML file. |
COMTYPE | Type of used compression. |
ERR | **GError |
Definition at line 166 of file xml_file.h.
#define cr_xmlfile_open_filelists | ( | FILENAME, | |
COMTYPE, | |||
ERR | |||
) | cr_xmlfile_open(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, ERR) |
Open a new filelists XML file.
FILENAME | Filename. |
COMTYPE | Type of used compression. |
ERR | GError ** |
Definition at line 87 of file xml_file.h.
#define cr_xmlfile_open_other | ( | FILENAME, | |
COMTYPE, | |||
ERR | |||
) | cr_xmlfile_open(FILENAME, CR_XMLFILE_OTHER, COMTYPE, ERR) |
Open a new other XML file.
FILENAME | Filename. |
COMTYPE | Type of used compression. |
ERR | GError ** |
Definition at line 106 of file xml_file.h.
#define cr_xmlfile_open_prestodelta | ( | FILENAME, | |
COMTYPE, | |||
ERR | |||
) | cr_xmlfile_open(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, ERR) |
Open a new prestodelta XML file.
FILENAME | Filename. |
COMTYPE | Type of used compression. |
ERR | GError ** |
Definition at line 125 of file xml_file.h.
#define cr_xmlfile_open_primary | ( | FILENAME, | |
COMTYPE, | |||
ERR | |||
) | cr_xmlfile_open(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, ERR) |
Open a new primary XML file.
FILENAME | Filename. |
COMTYPE | Type of compression. |
ERR | GError ** |
Definition at line 68 of file xml_file.h.
#define cr_xmlfile_open_updateinfo | ( | FILENAME, | |
COMTYPE, | |||
ERR | |||
) | cr_xmlfile_open(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, ERR) |
Open a new updateinfo XML file.
FILENAME | Filename. |
COMTYPE | Type of used compression. |
ERR | GError ** |
Definition at line 144 of file xml_file.h.
#define cr_xmlfile_sopen_filelists | ( | FILENAME, | |
COMTYPE, | |||
STAT, | |||
ERR | |||
) | cr_xmlfile_sopen(FILENAME, CR_XMLFILE_FILELISTS, COMTYPE, STAT, ERR) |
Open a new filelists XML file.
FILENAME | Filename. |
COMTYPE | Type of compression. |
STAT | cr_ContentStat object or NULL. |
ERR | GError ** |
Definition at line 97 of file xml_file.h.
#define cr_xmlfile_sopen_other | ( | FILENAME, | |
COMTYPE, | |||
STAT, | |||
ERR | |||
) | cr_xmlfile_sopen(FILENAME, CR_XMLFILE_OTHER, COMTYPE, STAT, ERR) |
Open a new other XML file.
FILENAME | Filename. |
COMTYPE | Type of compression. |
STAT | cr_ContentStat object or NULL. |
ERR | GError ** |
Definition at line 116 of file xml_file.h.
#define cr_xmlfile_sopen_prestodelta | ( | FILENAME, | |
COMTYPE, | |||
STAT, | |||
ERR | |||
) | cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRESTODELTA, COMTYPE, STAT, ERR) |
Open a new prestodelta XML file.
FILENAME | Filename. |
COMTYPE | Type of compression. |
STAT | cr_ContentStat object or NULL. |
ERR | GError ** |
Definition at line 135 of file xml_file.h.
#define cr_xmlfile_sopen_primary | ( | FILENAME, | |
COMTYPE, | |||
STAT, | |||
ERR | |||
) | cr_xmlfile_sopen(FILENAME, CR_XMLFILE_PRIMARY, COMTYPE, STAT, ERR) |
Open a new primary XML file.
FILENAME | Filename. |
COMTYPE | Type of compression. |
STAT | cr_ContentStat object or NULL. |
ERR | GError ** |
Definition at line 78 of file xml_file.h.
#define cr_xmlfile_sopen_updateinfo | ( | FILENAME, | |
COMTYPE, | |||
STAT, | |||
ERR | |||
) | cr_xmlfile_sopen(FILENAME, CR_XMLFILE_UPDATEINFO, COMTYPE, STAT, ERR) |
Open a new updateinfo XML file.
FILENAME | Filename. |
COMTYPE | Type of compression. |
STAT | cr_ContentStat object or NULL. |
ERR | GError ** |
Definition at line 154 of file xml_file.h.
enum cr_XmlFileType |
Supported types of xml files
Definition at line 38 of file xml_file.h.
void cr_rewrite_header_package_count | ( | gchar * | original_filename, |
cr_CompressionType | xml_compression, | ||
int | package_count, | ||
int | task_count, | ||
cr_ContentStat * | file_stat, | ||
gchar * | zck_dict_file, | ||
GError ** | err | ||
) |
Rewrite package count field in repodata header in xml file. In order to do this we have to decompress and after the change compress the whole file again, so entirely new file is created.
original_filename | Current file with wrong value in header |
package_count | Actual package count (desired value in header) |
task_count | Task count (current value in header) |
file_stat | cr_ContentStat for stats of the new file, it will be modified |
zck_dict_file | Optional path to zck dictionary |
err | **GError |
int cr_xmlfile_add_chunk | ( | cr_XmlFile * | f, |
const char * | chunk, | ||
GError ** | err | ||
) |
Add (write) string with XML chunk into the file. Note: Because of writing, in case of multithreaded program, should be guarded by locks, this function could be much more effective than cr_xml_file_add_pkg(). In case of _add_pkg() function, creating of string with xml chunk is done in a critical section. In _add_chunk() function, you could just dump XML whenever you want and in the critical section do only writting.
f | An opened cr_XmlFile |
chunk | String with XML chunk. |
err | **GError |
int cr_xmlfile_add_pkg | ( | cr_XmlFile * | f, |
cr_Package * | pkg, | ||
GError ** | err | ||
) |
Add package to the xml file.
f | An opened cr_XmlFile |
pkg | Package object. |
err | **GError |
int cr_xmlfile_close | ( | cr_XmlFile * | f, |
GError ** | err | ||
) |
int cr_xmlfile_set_num_of_pkgs | ( | cr_XmlFile * | f, |
long | num, | ||
GError ** | err | ||
) |
Set total number of packages that will be in the file. This number must be set before any write operation (cr_xml_add_pkg, cr_xml_file_add_chunk, ..).
f | An opened cr_XmlFile |
num | Total number of packages in the file. |
err | **GError |
cr_XmlFile* cr_xmlfile_sopen | ( | const char * | filename, |
cr_XmlFileType | type, | ||
cr_CompressionType | comtype, | ||
cr_ContentStat * | stat, | ||
GError ** | err | ||
) |
Open a new XML file. Note: Opened file must not exists! This function cannot open existing file!.
filename | Filename. |
type | Type of XML file. |
comtype | Type of used compression. |
stat | pointer to cr_ContentStat or NULL |
err | **GError |