libalpm
Arch Linux Package Manager Library
be_sync.c File Reference
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include <archive.h>
#include <archive_entry.h>
#include "util.h"
#include "log.h"
#include "libarchive-compat.h"
#include "alpm.h"
#include "alpm_list.h"
#include "package.h"
#include "handle.h"
#include "deps.h"
#include "dload.h"
#include "filelist.h"
Include dependency graph for be_sync.c:

Macros

#define READ_NEXT()
 
#define READ_AND_STORE(f)
 
#define READ_AND_STORE_ALL(f)
 
#define READ_AND_SPLITDEP(f)
 

Functions

static char * get_sync_dir (alpm_handle_t *handle)
 
static int sync_db_validate (alpm_db_t *db)
 
int alpm_db_update (alpm_handle_t *handle, alpm_list_t *dbs, int force)
 Update package databases.
 
static int sync_db_read (alpm_db_t *db, struct archive *archive, struct archive_entry *entry, alpm_pkg_t **likely_pkg)
 
static int _sync_get_validation (alpm_pkg_t *pkg)
 
static const struct pkg_operationsget_sync_pkg_ops (void)
 Package sync operations struct accessor.
 
static alpm_pkg_t * load_pkg_for_entry (alpm_db_t *db, const char *entryname, const char **entry_filename, alpm_pkg_t *likely_pkg)
 
static size_t estimate_package_count (struct stat *st, struct archive *archive)
 
static int sync_db_populate (alpm_db_t *db)
 

Variables

struct db_operations sync_db_ops
 

Macro Definition Documentation

◆ READ_AND_SPLITDEP

#define READ_AND_SPLITDEP ( f)
Value:
do { \
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
} while(1) /* note the while(1) and not (0) */
alpm_depend_t * alpm_dep_from_string(const char *depstring)
Return a newly allocated dependency information parsed from a string should be used to free the depen...
Definition deps.c:458
alpm_list_t * alpm_list_add(alpm_list_t *list, void *data)
Add a new item to the end of the list.
Definition alpm_list.c:64
#define error(...)

Referenced by sync_db_read().

◆ READ_AND_STORE

#define READ_AND_STORE ( f)
Value:
do { \
READ_NEXT(); \
STRDUP(f, line, goto error); \
} while(0)

Referenced by sync_db_read().

◆ READ_AND_STORE_ALL

#define READ_AND_STORE_ALL ( f)
Value:
do { \
char *linedup; \
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
STRDUP(linedup, buf.line, goto error); \
f = alpm_list_add(f, linedup); \
} while(1) /* note the while(1) and not (0) */
#define STRDUP(r, s, action)
Definition util.h:58

Referenced by sync_db_read().

◆ READ_NEXT

#define READ_NEXT ( )
Value:
do { \
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
line = buf.line; \
_alpm_strip_newline(line, buf.real_line_size); \
} while(0)

Referenced by sync_db_read().

Function Documentation

◆ _sync_get_validation()

static int _sync_get_validation ( alpm_pkg_t * pkg)
static

◆ estimate_package_count()

static size_t estimate_package_count ( struct stat * st,
struct archive * archive )
static

Referenced by sync_db_populate().

◆ get_sync_dir()

static char * get_sync_dir ( alpm_handle_t * handle)
static

◆ get_sync_pkg_ops()

static const struct pkg_operations * get_sync_pkg_ops ( void )
static

Package sync operations struct accessor.

We implement this as a method because we want to reuse the majority of the default_pkg_ops struct and add only a few operations of our own on top.

References _sync_get_validation(), default_pkg_ops, and pkg_operations::get_validation.

Referenced by load_pkg_for_entry().

◆ load_pkg_for_entry()

static alpm_pkg_t * load_pkg_for_entry ( alpm_db_t * db,
const char * entryname,
const char ** entry_filename,
alpm_pkg_t * likely_pkg )
static

◆ sync_db_populate()

◆ sync_db_read()

◆ sync_db_validate()

Variable Documentation

◆ sync_db_ops

struct db_operations sync_db_ops
Initial value:
= {
.validate = sync_db_validate,
.populate = sync_db_populate,
.unregister = _alpm_db_unregister,
}
static int sync_db_populate(alpm_db_t *db)
Definition be_sync.c:420
static int sync_db_validate(alpm_db_t *db)
Definition be_sync.c:71