28#define RAT_NAME_MAX 32
29#define RAT_VERSION_MAX 32
31#define RAT_PATH_MAX 255
32#define RAT_ERROR_MAX 512
35#define RAT_DB_DIR "var/lib/rat"
136#define RAT_DOWNGRADE 0x2
void rat_package_free(rat_package_t *package)
release the memory of a package (not the struct itself).
Definition archive.c:600
int rat_package_read(const char *path, const char *arch, rat_package_t *package, rat_error_t *err)
read and check a package file.
Definition archive.c:594
uint8_t flags
Definition idt.c:3
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
NULL, size_t, ptrdiff_t, offsetof.
integer types of fixed width.
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
__INT64_TYPE__ int64_t
Definition stdint.h:16
#define RAT_ERROR_MAX
Definition rat.h:32
int rat_update(rat_t *rat, rat_progress_t progress, void *context, rat_update_t *result_out, rat_error_t *err)
get the index of the repository (the url for this architecture in <root>/etc/rat/repos....
Definition repo.c:219
void rat_info_free(rat_info_t *info)
release the strings of an info (not the struct itself).
Definition info.c:181
void rat_infos_free(rat_info_t *infos, int count)
release an array from rat_list.
Definition info.c:191
void rat_close(rat_t *rat)
close the handle and release the lock.
Definition open.c:81
int rat_install_name(rat_t *rat, const char *name, unsigned flags, rat_note_t note, rat_progress_t progress, void *context, rat_error_t *err)
install or upgrade a package of the index: download it into the cache, check its size and SHA-256 aga...
Definition repo.c:377
#define RAT_ARCH_MAX
Definition rat.h:30
const char * rat_recovered(const rat_t *rat)
what rat_open did with an interrupted change.
Definition open.c:95
bool rat_name_ok(const char *name)
check a package name: 1 to RAT_NAME_MAX characters of a-z, 0-9, '-', '+' and '.
Definition info.c:15
int rat_upgradable(rat_t *rat, const rat_index_t *index, rat_upgradable_t **items_out, int *count_out, rat_error_t *err)
the installed packages that the index has in a newer version, sorted by name.
Definition repo.c:458
int rat_clean(rat_t *rat, uint64_t *freed_out, rat_error_t *err)
remove the downloaded files of the cache.
Definition repo.c:504
int rat_install_file(rat_t *rat, const char *path, unsigned flags, rat_note_t note, void *context, rat_error_t *err)
install a package file.
Definition install.c:421
bool rat_pending(const rat_t *rat)
true if a handle opened for queries saw an interrupted change, which the next rat_open for writing fi...
Definition open.c:100
int rat_owner(rat_t *rat, const char *path, char name_out[RAT_NAME_MAX+1], rat_error_t *err)
which package owns a path.
Definition query.c:144
int rat_files(rat_t *rat, const char *name, rat_entry_t **entries_out, int *count_out, rat_error_t *err)
the folders, files and links of an installed package, sorted by path.
Definition query.c:54
const rat_remote_t * rat_index_find(const rat_index_t *index, const char *name)
a package of the index by name.
Definition index.c:223
int rat_info(rat_t *rat, const char *name, rat_info_t *info_out, rat_error_t *err)
the fields of an installed package.
Definition query.c:24
int rat_list(rat_t *rat, rat_info_t **infos_out, int *count_out, rat_error_t *err)
the installed packages, sorted by name.
Definition query.c:80
int rat_index_load(rat_t *rat, rat_index_t *index, rat_error_t *err)
read the index that rat_update kept, and check its signature again.
Definition repo.c:138
void(*) rat_progress_t(void *context, const char *file, uint64_t done, uint64_t total)
a function that gets the progress of a download.
Definition rat.h:130
bool rat_root_in_ram(const rat_t *rat)
true if the root folder is the root image in RAM (from /proc/mounts): a change is then lost at the ne...
Definition open.c:105
void(*) rat_note_t(void *context, const char *text)
a function that gets the notes of a change (one line, without ' ')
Definition rat.h:123
int rat_verify(rat_t *rat, const char *name, rat_note_t note, void *context, int *problems_out, rat_error_t *err)
compare the files of an installed package with the record: a missing file, another type,...
Definition query.c:239
#define RAT_VERSION_MAX
Definition rat.h:29
struct rat rat_t
an open root folder
Definition rat.h:120
int rat_version_compare(const char *version_a, long release_a, const char *version_b, long release_b)
compare two versions of a package: first the versions, with the rules of Debian (digit runs as number...
Definition version.c:89
void rat_index_free(rat_index_t *index)
release the memory of an index (not the struct itself).
Definition index.c:212
rat_entry_type_t
the types of the members of a package
Definition rat.h:45
@ RAT_ENTRY_LINK
Definition rat.h:48
@ RAT_ENTRY_DIR
Definition rat.h:47
@ RAT_ENTRY_FILE
Definition rat.h:46
void rat_upgradables_free(rat_upgradable_t *items, int count)
release an array from rat_upgradable.
Definition repo.c:495
#define RAT_NAME_MAX
Definition rat.h:28
int rat_remove(rat_t *rat, const char *name, rat_note_t note, void *context, rat_error_t *err)
remove an installed package: its files, its links, and its folders that are then empty and that the b...
Definition remove.c:97
int rat_index_similar(const rat_index_t *index, const char *name, const char **names_out, int max)
the names in the index that are near a name that it does not have, for a "did you mean" message: one ...
Definition index.c:304
void rat_entries_free(rat_entry_t *entries, int count)
release an array from rat_files.
Definition util.c:473
rat_t * rat_open(const char *root, bool write, rat_error_t *err)
open a root folder.
Definition open.c:16
bool rat_remote_matches(const rat_remote_t *remote, const char *word)
true if word is in the name or the description of the package, without a difference between capitals ...
Definition index.c:266
an open-file description.
Definition file.h:64
a folder, file or symbolic link of a package
Definition rat.h:53
char * target
Definition rat.h:59
uint32_t mode
Definition rat.h:56
uint64_t size
Definition rat.h:57
char * path
Definition rat.h:54
uint8_t sha256[32]
Definition rat.h:58
char type
Definition rat.h:55
a message about a failure
Definition rat.h:39
char message[RAT_ERROR_MAX]
Definition rat.h:40
the index of the repository, after its signature was checked
Definition rat.h:95
char generated[11]
Definition rat.h:99
rat_remote_t * packages
Definition rat.h:96
int64_t generated_days
Definition rat.h:100
int count
Definition rat.h:97
uint64_t sequence
Definition rat.h:98
the fields of .RATINFO
Definition rat.h:64
char arch[RAT_ARCH_MAX+1]
Definition rat.h:68
long release
Definition rat.h:67
char * licence
Definition rat.h:70
char version[RAT_VERSION_MAX+1]
Definition rat.h:66
char name[RAT_NAME_MAX+1]
Definition rat.h:65
char * description
Definition rat.h:69
char * installed
Definition rat.h:72
uint64_t installed_size
Definition rat.h:71
a package file that was read and checked
Definition rat.h:77
rat_entry_t * entries
Definition rat.h:79
int count
Definition rat.h:80
rat_info_t info
Definition rat.h:78
char * ratinfo
Definition rat.h:81
a package of the index of the repository
Definition rat.h:86
rat_info_t info
Definition rat.h:87
uint8_t sha256[32]
Definition rat.h:90
uint64_t size
Definition rat.h:89
char * file
Definition rat.h:88
what rat_update did
Definition rat.h:105
uint64_t old_sequence
Definition rat.h:106
uint64_t sequence
Definition rat.h:107
int count
Definition rat.h:108
char generated[11]
Definition rat.h:109
an installed package that the index has in a newer version
Definition rat.h:114
rat_info_t installed
Definition rat.h:115
const rat_remote_t * remote
Definition rat.h:116
char * root
Definition internal.h:37
ssize_t write(int fd, const void *buf, size_t count)
write bytes to a file descriptor.