Data Structures | |
struct | cr_EVR |
struct | cr_NVREA |
struct | cr_Version |
struct | cr_HeaderRangeStruct |
Defines | |
#define | CR_UNUSED(x) (void)(x) |
#define | CR_STATICSTRLEN(s) (sizeof(s)/sizeof(s[0])) |
#define | CR_ARRAYLEN(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) |
#define | cr_compress_file(SRC, DST, COMTYPE, ERR) cr_compress_file_with_stat(SRC, DST, COMTYPE, NULL, ERR) |
#define | cr_decompress_file(SRC, DST, COMTYPE, ERR) cr_decompress_file_with_stat(SRC, DST, COMTYPE, NULL, ERR) |
#define | cr_cmp_nvrea(A, B) |
Enumerations | |
enum | cr_CpFlags { CR_CP_DEFAULT = (1<<0), CR_CP_RECURSIVE = (1<<1), CR_CP_PRESERVE_ALL = (1<<2) } |
enum | cr_RmFlags { CR_RM_DEFAULT = (1<<0), CR_RM_RECURSIVE = (1<<1), CR_RM_FORCE = (1<<2) } |
Functions | |
const char * | cr_flag_to_str (gint64 flags) |
struct cr_EVR | cr_str_to_evr (const char *string, GStringChunk *chunk) |
struct cr_HeaderRangeStruct | cr_get_header_byte_range (const char *filename, GError **err) |
char * | cr_get_filename (const char *filepath) |
int | cr_download (CURL *handle, const char *url, const char *destination, GError **err) |
int | cr_copy_file (const char *src, const char *dst, GError **err) |
int | cr_compress_file_with_stat (const char *src, const char *dst, cr_CompressionType comtype, cr_ContentStat *stat, GError **err) |
int | cr_decompress_file_with_stat (const char *src, const char *dst, cr_CompressionType comtype, cr_ContentStat *stat, GError **err) |
int | cr_better_copy_file (const char *src, const char *dst, GError **err) |
int | cr_remove_dir (const char *path, GError **err) |
char * | cr_normalize_dir_path (const char *path) |
struct cr_Version | cr_str_to_version (const char *str) |
int | cr_cmp_version_str (const char *str1, const char *str2) |
void | cr_null_log_fn (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) |
void | cr_log_fn (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) |
void | cr_slist_free_full (GSList *list, GDestroyNotify free_f) |
struct cr_NVREA * | cr_split_rpm_filename (const char *filename) |
void | cr_nvrea_free (struct cr_NVREA *nvrea) |
int | cr_cmp_evr (const char *e1, const char *v1, const char *r1, const char *e2, const char *v2, const char *r2) |
int | cr_warning_cb (cr_XmlParserWarningType type, char *msg, void *cbdata, GError **err) |
gboolean | cr_write_to_file (GError **err, gchar *filename, const char *format,...) |
gboolean | cr_cp (const char *src, const char *dst, cr_CpFlags flags, const char *working_directory, GError **err) |
gboolean | cr_rm (const char *path, cr_RmFlags flags, const char *working_dir, GError **err) |
gchar * | cr_append_pid_and_datetime (const char *str, const char *suffix) |
gboolean | cr_spawn_check_exit_status (gint exit_status, GError **error) |
#define cr_cmp_nvrea | ( | A, | |||
B | ) |
(cr_cmp_evr((A)->epoch, (A)->version, (A)->release,\ (B)->epoch, (B)->version, (B)->release))
Compare evr of two cr_NVREA. Name and arch are ignored.
#define cr_compress_file | ( | SRC, | |||
DST, | |||||
COMTYPE, | |||||
ERR | ) | cr_compress_file_with_stat(SRC, DST, COMTYPE, NULL, ERR) |
#define cr_decompress_file | ( | SRC, | |||
DST, | |||||
COMTYPE, | |||||
ERR | ) | cr_decompress_file_with_stat(SRC, DST, COMTYPE, NULL, ERR) |
Decompress file.
SRC | source filename | |
DST | destination (If dst is dir, filename of src without compression suffix (if present) is used. If dst is NULL, src without compression suffix is used) Otherwise ".decompressed" suffix is used | |
COMTYPE | type of compression | |
ERR | GError ** |
#define CR_STATICSTRLEN | ( | s | ) | (sizeof(s)/sizeof(s[0])) |
#define CR_UNUSED | ( | x | ) | (void)(x) |
enum cr_CpFlags |
enum cr_RmFlags |
gchar* cr_append_pid_and_datetime | ( | const char * | str, | |
const char * | suffix | |||
) |
Append "YYYYmmddHHMMSS.MICROSECONDS.PID" suffix to the str.
str | String or NULL | |
suffix | Another string that will be appended or NULL | |
return | Newly allocated string |
int cr_better_copy_file | ( | const char * | src, | |
const char * | dst, | |||
GError ** | err | |||
) |
int cr_cmp_evr | ( | const char * | e1, | |
const char * | v1, | |||
const char * | r1, | |||
const char * | e2, | |||
const char * | v2, | |||
const char * | r2 | |||
) |
Compare two version strings splited into evr chunks.
e1 | 1. epoch | |
v1 | 1. version | |
r1 | 1. release | |
e2 | 2. epoch | |
v2 | 2. version | |
r2 | 2. release |
int cr_cmp_version_str | ( | const char * | str1, | |
const char * | str2 | |||
) |
Compare two version string.
str1 | first version string | |
str2 | second version string |
int cr_compress_file_with_stat | ( | const char * | src, | |
const char * | dst, | |||
cr_CompressionType | comtype, | |||
cr_ContentStat * | stat, | |||
GError ** | err | |||
) |
Compress file.
src | source filename | |
dst | destination (If dst is dir, filename of src + compression suffix is used. If dst is NULL, src + compression suffix is used) | |
comtype | type of compression | |
stat | pointer to cr_ContentStat or NULL | |
err | GError ** |
int cr_copy_file | ( | const char * | src, | |
const char * | dst, | |||
GError ** | err | |||
) |
Copy file.
src | source filename | |
dst | destination (if dst is dir, filename of src is used) | |
err | GError ** |
gboolean cr_cp | ( | const char * | src, | |
const char * | dst, | |||
cr_CpFlags | flags, | |||
const char * | working_directory, | |||
GError ** | err | |||
) |
Recursive copy of directory (works on files as well)
src | Source (supports wildcards) | |
dst | Destination (supports wildcards) | |
flags | Flags | |
working_dir | Working directory | |
err | GError ** |
int cr_decompress_file_with_stat | ( | const char * | src, | |
const char * | dst, | |||
cr_CompressionType | comtype, | |||
cr_ContentStat * | stat, | |||
GError ** | err | |||
) |
Decompress file.
src | source filename | |
dst | destination (If dst is dir, filename of src without compression suffix (if present) is used. If dst is NULL, src without compression suffix is used) Otherwise ".decompressed" suffix is used | |
comtype | type of compression | |
stat | pointer to cr_ContentStat or NULL | |
err | GError ** |
int cr_download | ( | CURL * | handle, | |
const char * | url, | |||
const char * | destination, | |||
GError ** | err | |||
) |
Download a file from the URL into the in_dst via curl handle.
handle | CURL handle | |
url | source url | |
destination | destination (if destination is dir, filename from the url is used) | |
err | GError ** |
const char* cr_flag_to_str | ( | gint64 | flags | ) |
Convert flags from RPM header to a string representation.
flags | flags |
char* cr_get_filename | ( | const char * | filepath | ) |
Return pointer to the rest of string after last '/'. (e.g. for "/foo/bar" returns "bar")
filepath | path |
struct cr_HeaderRangeStruct cr_get_header_byte_range | ( | const char * | filename, | |
GError ** | err | |||
) | [read] |
Return header byte range.
filename | filename | |
err | GError ** |
void cr_log_fn | ( | const gchar * | log_domain, | |
GLogLevelFlags | log_level, | |||
const gchar * | message, | |||
gpointer | user_data | |||
) |
Createrepo_c library standard logging function.
log_domain | logging domain | |
log_level | logging level | |
message | message | |
user_data | user data |
char* cr_normalize_dir_path | ( | const char * | path | ) |
Normalize path (Path with exactly one trailing '/').
path | path |
void cr_null_log_fn | ( | const gchar * | log_domain, | |
GLogLevelFlags | log_level, | |||
const gchar * | message, | |||
gpointer | user_data | |||
) |
Logging function with no output.
log_domain | logging domain | |
log_level | logging level | |
message | message | |
user_data | user data |
void cr_nvrea_free | ( | struct cr_NVREA * | nvrea | ) |
int cr_remove_dir | ( | const char * | path, | |
GError ** | err | |||
) |
Recursively remove directory.
path | filepath | |
err | GError ** |
gboolean cr_rm | ( | const char * | path, | |
cr_RmFlags | flags, | |||
const char * | working_dir, | |||
GError ** | err | |||
) |
Wrapper over rm command
path | Path (supports wildcards) | |
flags | Flags | |
working_dir | Working directory | |
err | GError ** |
void cr_slist_free_full | ( | GSList * | list, | |
GDestroyNotify | free_f | |||
) |
Frees all the memory used by a GSList, and calls the specified destroy function on every element's data. This is the same function as g_slist_free_full(). The original function is implemented in glib since 2.28 but we need to support the older glib too.
list | pointer to GSList | |
free_f | the function to be called to free each element's data |
gboolean cr_spawn_check_exit_status | ( | gint | exit_status, | |
GError ** | error | |||
) |
Createrepo_c's reimplementation of convinient g_spawn_check_exit_status() function which is available since glib 2.34 (createrepo_c is currently compatible with glib >= 2.28)
exit_status | An exit code as returned from g_spawn_sync() | |
error | GError ** |
struct cr_NVREA* cr_split_rpm_filename | ( | const char * | filename | ) | [read] |
struct cr_EVR cr_str_to_evr | ( | const char * | string, | |
GStringChunk * | chunk | |||
) | [read] |
Convert epoch-version-release string into cr_EVR structure. If no GStringChunk passed, all non NULL items in returned structure are malloced and in that case, you have to free all non-NULL element yourself.
string | NULL terminated n-v-r string | |
chunk | string chunk for strings (optional - could be NULL) |
struct cr_Version cr_str_to_version | ( | const char * | str | ) | [read] |
int cr_warning_cb | ( | cr_XmlParserWarningType | type, | |
char * | msg, | |||
void * | cbdata, | |||
GError ** | err | |||
) |
Warning callback for xml parser warnings. For use in xml parsers like primary, filelists, other or repomd parser. Name of the parser should be passed as a string via warning callback data (warningcb_data) argument of the parser.
gboolean cr_write_to_file | ( | GError ** | err, | |
gchar * | filename, | |||
const char * | format, | |||
... | ||||
) |
Open file and write content.
err | GError ** | |
filename | Filename | |
format | Format string | |
... | Arguments |