XBPS Library API 20240111
The X Binary Package System
Functions
Repository functions

Functions

bool xbps_repo_store (struct xbps_handle *xhp, const char *url)
 
bool xbps_repo_remove (struct xbps_handle *xhp, const char *url)
 
bool xbps_repo_lock (struct xbps_handle *xhp, const char *uri, int *lockfd, char **lockfname)
 
void xbps_repo_unlock (int lockfd, char *lockfname)
 
struct xbps_repoxbps_repo_open (struct xbps_handle *xhp, const char *uri)
 
struct xbps_repoxbps_repo_stage_open (struct xbps_handle *xhp, const char *uri)
 
struct xbps_repoxbps_repo_public_open (struct xbps_handle *xhp, const char *uri)
 
void xbps_repo_close (struct xbps_repo *repo)
 
void xbps_repo_release (struct xbps_repo *repo)
 
char * xbps_repo_path (struct xbps_handle *xhp, const char *url)
 
char * xbps_repo_path_with_name (struct xbps_handle *xhp, const char *url, const char *name)
 
bool xbps_repo_fetch_remote (struct xbps_repo *repo, const char *url)
 
xbps_dictionary_t xbps_repo_get_pkg (struct xbps_repo *repo, const char *pkg)
 
xbps_dictionary_t xbps_repo_get_virtualpkg (struct xbps_repo *repo, const char *pkg)
 
xbps_array_t xbps_repo_get_pkg_revdeps (struct xbps_repo *repo, const char *pkg)
 
int xbps_repo_key_import (struct xbps_repo *repo)
 

Detailed Description

Function Documentation

◆ xbps_repo_store()

bool xbps_repo_store ( struct xbps_handle xhp,
const char *  url 
)

Stores repository url into the repository pool.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]urlRepository URI to store.
Returns
True on success, false otherwise.

Definition at line 267 of file repo.c.

References xbps_handle::repositories, xbps_match_string_in_array(), xbps_repository_is_remote(), and xbps_repo::xhp.

Here is the call graph for this function:

◆ xbps_repo_remove()

bool xbps_repo_remove ( struct xbps_handle xhp,
const char *  url 
)

Removes repository url from the repository pool.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]urlRepository URI to remove.
Returns
True on success, false otherwise.

Definition at line 306 of file repo.c.

References xbps_handle::repositories, xbps_remove_string_from_array(), and xbps_repo::xhp.

Referenced by xbps_rpool_foreach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_lock()

bool xbps_repo_lock ( struct xbps_handle xhp,
const char *  uri,
int *  lockfd,
char **  lockfname 
)

Creates a lock for a local repository to obtain exclusive access (write).

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]uriRepository URI to match.
[out]lockfdLock file descriptor assigned.
[out]lockfnameLock filename assigned.
Returns
True on success and lockfd/lockfname are assigned appropiately. otherwise false and lockfd/lockfname aren't set.

Definition at line 86 of file repo.c.

References xbps_repo_path(), and xbps_xasprintf().

Here is the call graph for this function:

◆ xbps_repo_unlock()

void xbps_repo_unlock ( int  lockfd,
char *  lockfname 
)

Unlocks a local repository and removes its lock file.

Parameters
[in]lockfdLock file descriptor.
[in]lockfnameLock filename.

Definition at line 124 of file repo.c.

◆ xbps_repo_open()

struct xbps_repo * xbps_repo_open ( struct xbps_handle xhp,
const char *  uri 
)

Opens a repository and returns a xbps_repo object.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]uriRepository URI to match.
Returns
The matching repository object, NULL otherwise.

Definition at line 340 of file repo.c.

References xbps_repo::idx, xbps_repo::is_remote, xbps_repo_public_open(), xbps_repo_release(), xbps_repo_stage_open(), and xbps_repo::xhp.

Referenced by xbps_rpool_foreach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_stage_open()

struct xbps_repo * xbps_repo_stage_open ( struct xbps_handle xhp,
const char *  uri 
)

Opens a staging repository and returns a xbps_repo object.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]uriRepository URI to match.
Returns
The matching repository object, NULL otherwise.

Definition at line 329 of file repo.c.

References xbps_repo::xhp.

Referenced by xbps_repo_open().

Here is the caller graph for this function:

◆ xbps_repo_public_open()

struct xbps_repo * xbps_repo_public_open ( struct xbps_handle xhp,
const char *  uri 
)

Opens a repository and returns a xbps_repo object.

Parameters
[in]xhpPointer to the xbps_handle struct.
[in]uriRepository URI to match.
Returns
The matching repository object, NULL otherwise.

Definition at line 335 of file repo.c.

References xbps_repo::xhp.

Referenced by xbps_repo_open().

Here is the caller graph for this function:

◆ xbps_repo_close()

void xbps_repo_close ( struct xbps_repo repo)

Closes a repository object, its archive associated is closed and those resources released.

Parameters
[in]repoThe repository object to close.

Definition at line 372 of file repo.c.

Referenced by xbps_repo_release().

Here is the caller graph for this function:

◆ xbps_repo_release()

void xbps_repo_release ( struct xbps_repo repo)

This calls xbps_repo_close() and releases all resources associated with this repository object.

Parameters
[in]repoThe repository object to release.

Definition at line 388 of file repo.c.

References xbps_repo::idx, xbps_repo::idxmeta, and xbps_repo_close().

Referenced by xbps_repo_open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_path()

char * xbps_repo_path ( struct xbps_handle xhp,
const char *  url 
)

Returns a heap-allocated string with the repository local path.

Parameters
[in]xhpThe xbps_handle object.
[in]urlThe repository URL to match.
Returns
A heap allocated string that must be free(3)d when it's unneeded.

Definition at line 51 of file repo.c.

References xbps_repo_path_with_name().

Referenced by xbps_repo_lock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_path_with_name()

char * xbps_repo_path_with_name ( struct xbps_handle xhp,
const char *  url,
const char *  name 
)

Returns a heap-allocated string with the repository local path.

Parameters
[in]xhpThe xbps_handle object.
[in]urlThe repository URL to match.
[in]nameThe repository name (stage or repodata)
Returns
A heap allocated string that must be free(3)d when it's unneeded.

Definition at line 57 of file repo.c.

References xbps_handle::native_arch, xbps_handle::target_arch, and xbps_xasprintf().

Referenced by xbps_repo_path().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_fetch_remote()

bool xbps_repo_fetch_remote ( struct xbps_repo repo,
const char *  url 
)

Remotely fetch repository data and keep it in memory.

Parameters
[in]repoA struct xbps_repo pointer to be filled in.
[in]urlFull url to the target remote repository data archive.
Returns
True on success, false otherwise and errno is set appropiately.

Definition at line 184 of file plist_fetch.c.

References xbps_repo::idx, xbps_repo::idxmeta, and xbps_repo::is_signed.

◆ xbps_repo_get_pkg()

xbps_dictionary_t xbps_repo_get_pkg ( struct xbps_repo repo,
const char *  pkg 
)

Returns a pkg dictionary from a repository repo matching the expression pkg.

Parameters
[in]repoPointer to an xbps_repo structure.
[in]pkgPackage expression to match in this repository index.
Returns
The pkg dictionary on success, NULL otherwise.

Definition at line 441 of file repo.c.

References xbps_repo::idx, xbps_repo::uri, xbps_pkg_name(), and xbps_repo::xhp.

Referenced by xbps_repo_get_pkg_revdeps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_get_virtualpkg()

xbps_dictionary_t xbps_repo_get_virtualpkg ( struct xbps_repo repo,
const char *  pkg 
)

Returns a pkg dictionary from a repository repo matching the expression pkg. On match the first package matching the virtual package expression will be returned.

Parameters
[in]repoPointer to an xbps_repo structure.
[in]pkgPackage expression to match in this repository index.
Returns
The pkg dictionary on success, NULL otherwise.

Definition at line 407 of file repo.c.

References xbps_repo::idx, xbps_repo::uri, xbps_pkg_name(), and xbps_repo::xhp.

Referenced by xbps_repo_get_pkg_revdeps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbps_repo_get_pkg_revdeps()

xbps_array_t xbps_repo_get_pkg_revdeps ( struct xbps_repo repo,
const char *  pkg 
)

Returns a proplib array of strings with reverse dependencies from repository repo matching the expression pkg.

Parameters
[in]repoPointer to an xbps_repo structure.
[in]pkgPackage expression to match in this repository index.
Returns
The array of strings on success, NULL otherwise and errno is set appropiately.

Definition at line 569 of file repo.c.

References xbps_repo::idx, xbps_pkg_name(), xbps_repo_get_pkg(), and xbps_repo_get_virtualpkg().

Here is the call graph for this function:

◆ xbps_repo_key_import()

int xbps_repo_key_import ( struct xbps_repo repo)

Imports the RSA public key of target repository. The repository must be signed properly for this to work.

Parameters
[in]repoPointer to the target xbps_repo structure.
Returns
0 on success, an errno value otherwise.

Definition at line 611 of file repo.c.

References xbps_repo::idxmeta, xbps_handle::metadir, xbps_repo::uri, xbps_mkpath(), xbps_plist_dictionary_from_file(), xbps_pubkey2fp(), xbps_xasprintf(), and xbps_repo::xhp.

Here is the call graph for this function: