From 8f817f46b63f81f9eab52b956602a9e46b43bdbb Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Mon, 25 Feb 2013 16:06:45 +0100 Subject: [PATCH] doc: example of usage for repomd module. --- src/constants.h | 7 +++++++ src/parsehdr.h | 1 + src/repomd.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/constants.h b/src/constants.h index 9960200..1c7ea9f 100644 --- a/src/constants.h +++ b/src/constants.h @@ -24,6 +24,11 @@ extern "C" { #endif +/** \defgroup contants Global constants and enums. + * \addtogroup constants + * @{ + */ + /** * Checksum type. */ @@ -33,6 +38,8 @@ typedef enum { CR_CHECKSUM_SHA256 /*!< SHA256 checksum */ } cr_ChecksumType; +/** @} */ + #ifdef __cplusplus } #endif diff --git a/src/parsehdr.h b/src/parsehdr.h index 97da4a3..7a3608a 100644 --- a/src/parsehdr.h +++ b/src/parsehdr.h @@ -31,6 +31,7 @@ extern "C" { /** \defgroup parsehdr Header parser API. * \addtogroup parsehdr + * @{ */ /** Read data from header and return filled cr_Package structure. diff --git a/src/repomd.h b/src/repomd.h index 5e3304a..8f0c2e8 100644 --- a/src/repomd.h +++ b/src/repomd.h @@ -28,6 +28,37 @@ extern "C" { #include "package.h" /** \defgroup repomd Repomd API. + * + * Module for generating repomd.xml. + * + * Example: + * + * \code + * char *xml; + * cr_Repomd md = cr_repomd_new(); + * cr_RepomdRecord rec; + * + * // Set some repomd stuff + * cr_repomd_set_revision(md, "007"); + * cr_repomd_add_repo_tag(md, "repotag"); + * cr_repomd_add_content_tag(md, "contenttag"); + * cr_repomd_add_distro_tag(md, "foocpeid", "data"); + * + * // Create record for new metadata file + * rec = cr_repomd_record_new("/foo/bar/repodata/primary.xml.xz"); + * // Calculate all needed parameters (uncompresed size, checksum, ...) + * cr_repomd_record_fill(rec, CR_CHECKSUM_SHA256); + * // Rename source file - insert checksum into the filename + * cr_repomd_record_rename_file(rec) + * // Append the record into the repomd + * cr_repomd_set_record(md, rec, "primary"); + * + * // Get repomd.xml content + * // Note: cr_xml_dump_init() shoud be once called before dump + * xml = cr_repomd_xml_dump(md); + * cr_repomd_free(md); + * \endcode + * * \addtogroup repomd * @{ */ -- 2.7.4