XBPS Library API 20250531
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)
 
int xbps_repo_lock (const char *repodir, const char *arch)
 
void xbps_repo_unlock (const char *repodir, const char *arch, int fd)
 
struct xbps_repoxbps_repo_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)
 
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 388 of file repo.c.

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

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 427 of file repo.c.

References xbps_handle::repositories, and xbps_remove_string_from_array().

Referenced by xbps_rpool_foreach().

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

◆ xbps_repo_lock()

int xbps_repo_lock ( const char *  repodir,
const char *  arch 
)

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 49 of file repo.c.

References xbps_repository_is_remote().

Here is the call graph for this function:

◆ xbps_repo_unlock()

void xbps_repo_unlock ( const char *  repodir,
const char *  arch,
int  fd 
)

Unlocks a local repository and removes its lock file.

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

Definition at line 86 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 487 of file repo.c.

References xbps_repo::arch, xbps_handle::flags, xbps_repo::idx, xbps_repo::index, xbps_repo::is_remote, xbps_handle::native_arch, xbps_handle::target_arch, xbps_repo::uri, xbps_repo_release(), xbps_repository_is_remote(), 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_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.

◆ 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.

◆ 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 533 of file repo.c.

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

Referenced by xbps_repo_open().

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.

◆ 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 592 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 558 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 720 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 762 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: