1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* createrepo_c - Library of routines for manipulation with repodata
* Copyright (C) 2012 Tomas Mlcoch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
#ifndef __C_CREATEREPOLIB_PARSEPKG_H__
#define __C_CREATEREPOLIB_PARSEPKG_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <glib.h>
#include "checksum.h"
#include "parsehdr.h"
#include "package.h"
#include "xml_dump.h"
/** \defgroup parsepkg Package parser API.
* \addtogroup parsepkg
* @{
*/
/** Initialize global structures for package parsing.
* This function call rpmReadConfigFiles() and create global transaction set.
* This function should be called only once! This function is not thread safe!
*/
void cr_package_parser_init();
/** Free global structures for package parsing.
*/
void cr_package_parser_cleanup();
/** Generate a package object from a package file.
* Some attributes like pkgId (checksum), checksum_type, time_file,
* location_href, location_base, rpm_header_start, rpm_header_end
* are not filled.
* @param filename filename
* @param changelog_limit number of changelogs that will be loaded
* @param flags Flags for header reading
* @param err GError **
* @return cr_Package or NULL on error
*/
cr_Package *
cr_package_from_rpm_base(const char *filename,
int changelog_limit,
cr_HeaderReadingFlags flags,
GError **err);
/** Generate a package object from a package file.
* @param filename filename
* @param checksum_type type of checksum to be used
* @param location_href package location inside repository
* @param location_base location (url) of repository
* @param changelog_limit number of changelog entries
* @param stat_buf struct stat of the filename
* (optional - could be NULL)
* @param flags Flags for header reading
* @param err GError **
* @return cr_Package or NULL on error
*/
cr_Package *cr_package_from_rpm(const char *filename,
cr_ChecksumType checksum_type,
const char *location_href,
const char *location_base,
int changelog_limit,
struct stat *stat_buf,
cr_HeaderReadingFlags flags,
GError **err);
/** Generate XML for the specified package.
* @param filename rpm filename
* @param checksum_type type of checksum to be used
* @param location_href package location inside repository
* @param location_base location (url) of repository
* @param changelog_limit number of changelog entries
* @param stat_buf struct stat of the filename
* (optional - could be NULL)
* @param err GError **
* @return struct cr_XmlStruct with primary, filelists and
* other xmls
*/
struct cr_XmlStruct cr_xml_from_rpm(const char *filename,
cr_ChecksumType checksum_type,
const char *location_href,
const char *location_base,
int changelog_limit,
struct stat *stat_buf,
GError **err);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* __C_CREATEREPOLIB_PARSEPKG_H__ */
|