createrepo_c library
0.17.7
C library for metadata manipulation
|
Macros | |
#define | CR_CB_RET_OK 0 |
#define | CR_CB_RET_ERR 1 |
Typedefs | |
typedef int(* | cr_XmlParserNewPkgCb) (cr_Package **pkg, const char *pkgId, const char *name, const char *arch, void *cbdata, GError **err) |
typedef int(* | cr_XmlParserPkgCb) (cr_Package *pkg, void *cbdata, GError **err) |
typedef int(* | cr_XmlParserWarningCb) (cr_XmlParserWarningType type, char *msg, void *cbdata, GError **err) |
Enumerations | |
enum | cr_XmlParserWarningType { CR_XML_WARNING_UNKNOWNTAG, CR_XML_WARNING_MISSINGATTR, CR_XML_WARNING_UNKNOWNVAL, CR_XML_WARNING_BADATTRVAL, CR_XML_WARNING_MISSINGVAL, CR_XML_WARNING_BADMDTYPE, CR_XML_WARNING_SENTINEL } |
Functions | |
int | cr_xml_parse_primary (const char *path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, int do_files, GError **err) |
int | cr_xml_parse_primary_snippet (const char *xml_string, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, int do_files, GError **err) |
int | cr_xml_parse_filelists (const char *path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err) |
int | cr_xml_parse_filelists_snippet (const char *xml_string, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err) |
int | cr_xml_parse_other (const char *path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err) |
int | cr_xml_parse_other_snippet (const char *xml_string, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err) |
int | cr_xml_parse_repomd (const char *path, cr_Repomd *repomd, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err) |
int | cr_xml_parse_updateinfo (const char *path, cr_UpdateInfo *updateinfo, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err) |
int | cr_xml_parse_main_metadata_together (const char *primary_path, const char *filelists_path, const char *other_path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, gboolean allow_out_of_order, GError **err) |
#define CR_CB_RET_ERR 1 |
Return value for callbacks signalizing error
Definition at line 38 of file xml_parser.h.
#define CR_CB_RET_OK 0 |
Return value for callbacks signalizing success
Definition at line 37 of file xml_parser.h.
typedef int(* cr_XmlParserNewPkgCb) (cr_Package **pkg, const char *pkgId, const char *name, const char *arch, void *cbdata, GError **err) |
Callback for XML parser which is called when a new package object parsing is started. This function has to set *pkg to package object which will be populated by parser. The object could be empty, or already partially filled (by other XML parsers) package object. If the pointer is set to NULL, current package will be skiped. Note: For the primary.xml file pkgId, name and arch are NULL!
pkg | Package that will be populated. |
pkgId | pkgId (hash) of the new package (in case of filelists.xml or other.xml) or package type ("rpm" in case of primary.xml). |
name | Name of the new package. |
arch | Arch of the new package. |
cbdata | User data. |
err | GError ** |
Definition at line 68 of file xml_parser.h.
typedef int(* cr_XmlParserPkgCb) (cr_Package *pkg, void *cbdata, GError **err) |
Callback for XML parser which is called when a package element is parsed.
pkg | Currently parsed package. |
cbdata | User data. |
err | GError ** |
Definition at line 81 of file xml_parser.h.
typedef int(* cr_XmlParserWarningCb) (cr_XmlParserWarningType type, char *msg, void *cbdata, GError **err) |
Callback for XML parser warnings. All reported warnings are non-fatal, and ignored by default. But if callback return CR_CB_RET_ERR instead of CR_CB_RET_OK then parsing is immediately interrupted.
type | Type of warning |
msg | Warning msg. The message is destroyed after the call. If you want to use the message later, you have to copy it. |
cbdata | User data. |
err | GError ** |
Definition at line 95 of file xml_parser.h.
Type of warnings reported by parsers by the warning callback.
Definition at line 42 of file xml_parser.h.
int cr_xml_parse_filelists | ( | const char * | path, |
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
GError ** | err | ||
) |
Parse filelists.xml. File could be compressed.
path | Path to filelists.xml |
newpkgcb | Callback for new package (Called when new package xml chunk is found and package object to store the data is needed). If NULL cr_newpkgcb is used. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. (Called when complete package xml chunk is parsed.). Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
err | GError ** |
int cr_xml_parse_filelists_snippet | ( | const char * | xml_string, |
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
GError ** | err | ||
) |
Parse string snippet of filelists xml repodata. Snippet cannot contain root xml element <filelists>. It contains only <package> elemetns.
xml_string | String containg filelists xml data |
newpkgcb | Callback for new package (Called when new package xml chunk is found and package object to store the data is needed). If NULL cr_newpkgcb is used. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. (Called when complete package xml chunk is parsed.). Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
err | GError ** |
int cr_xml_parse_main_metadata_together | ( | const char * | primary_path, |
const char * | filelists_path, | ||
const char * | other_path, | ||
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
gboolean | allow_out_of_order, | ||
GError ** | err | ||
) |
Parse all 3 main metadata types (primary, filelists and other) at the same time. Once a package is fully parsed pkgcb is called which transfers ownership of the package to the user, cr_xml_parse_main_metadata_together no longer needs it and it can be freed. This means we don't have store all the packages in memory at the same time, which significantly reduces the memory footprint. Input metadata files can be compressed.
primary_path | Path to a primary xml file. |
filelists_path | Path to a filelists xml file. |
other_path | Path to an other xml file. |
newpkgcb | Callback for a new package. Called when the new package xml chunk is found and a package object to store the data is needed. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. Called when a package is completely parsed containing information from all 3 main metadata files. Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
allow_out_of_order | Whether we should allow different order of packages among the main metadata files. If allowed, the more the order varies the more memory we will need to store all the started but unfinished packages. |
err | GError ** |
int cr_xml_parse_other | ( | const char * | path, |
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
GError ** | err | ||
) |
Parse other.xml. File could be compressed.
path | Path to other.xml |
newpkgcb | Callback for new package (Called when new package xml chunk is found and package object to store the data is needed). If NULL cr_newpkgcb is used. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. (Called when complete package xml chunk is parsed.). Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
err | GError ** |
int cr_xml_parse_other_snippet | ( | const char * | xml_string, |
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
GError ** | err | ||
) |
Parse string snippet of other xml repodata. Snippet cannot contain root xml element <otherdata>. It contains only <package> elemetns.
xml_string | String containg other xml data |
newpkgcb | Callback for new package (Called when new package xml chunk is found and package object to store the data is needed). If NULL cr_newpkgcb is used. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. (Called when complete package xml chunk is parsed.). Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
err | GError ** |
int cr_xml_parse_primary | ( | const char * | path, |
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
int | do_files, | ||
GError ** | err | ||
) |
Parse primary.xml. File could be compressed.
path | Path to filelists.xml |
newpkgcb | Callback for new package (Called when new package xml chunk is found and package object to store the data is needed). If NULL cr_newpkgcb is used. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. (Called when complete package xml chunk is parsed.). Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
do_files | 0 - Ignore file tags in primary.xml. |
err | GError ** |
int cr_xml_parse_primary_snippet | ( | const char * | xml_string, |
cr_XmlParserNewPkgCb | newpkgcb, | ||
void * | newpkgcb_data, | ||
cr_XmlParserPkgCb | pkgcb, | ||
void * | pkgcb_data, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
int | do_files, | ||
GError ** | err | ||
) |
Parse string snippet of primary xml repodata. Snippet cannot contain root xml element <metadata>. It contains only <package> elemetns.
xml_string | String containg primary xml data |
newpkgcb | Callback for new package (Called when new package xml chunk is found and package object to store the data is needed). If NULL cr_newpkgcb is used. |
newpkgcb_data | User data for the newpkgcb. |
pkgcb | Package callback. (Called when complete package xml chunk is parsed.). Could be NULL if newpkgcb is not NULL. |
pkgcb_data | User data for the pkgcb. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
do_files | 0 - Ignore file tags in primary.xml. |
err | GError ** |
int cr_xml_parse_repomd | ( | const char * | path, |
cr_Repomd * | repomd, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
GError ** | err | ||
) |
Parse repomd.xml. File could be compressed.
path | Path to repomd.xml |
repomd | cr_Repomd object. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
err | GError ** |
int cr_xml_parse_updateinfo | ( | const char * | path, |
cr_UpdateInfo * | updateinfo, | ||
cr_XmlParserWarningCb | warningcb, | ||
void * | warningcb_data, | ||
GError ** | err | ||
) |
Parse updateinfo.xml. File could be compressed.
path | Path to updateinfo.xml |
updateinfo | cr_UpdateInfo object. |
warningcb | Callback for warning messages. |
warningcb_data | User data for the warningcb. |
err | GError ** |