libxbps: renamed xbps_repository_{install,update}_xxx to xbps_transaction_xxx.

This commit is contained in:
Juan RP 2011-11-25 10:12:03 +01:00
parent f3099fa2c6
commit bbfd2813b2
5 changed files with 27 additions and 34 deletions

View File

@ -2,7 +2,7 @@ TOPDIR = ../..
-include $(TOPDIR)/config.mk
BIN = xbps-bin
OBJS = install.o main.o remove.o show-deps.o
OBJS = transaction.o main.o remove.o show-deps.o
OBJS += show-info-files.o util.o find-files.o
OBJS += question.o fetch_cb.o state_cb.o
OBJS += check.o check_pkg_automatic.o check_pkg_files.o

View File

@ -187,7 +187,7 @@ autoupdate_pkgs(bool yes, bool show_download_pkglist_url)
* Update all currently installed packages, aka
* "xbps-bin autoupdate".
*/
if ((rv = xbps_repository_update_packages()) != 0) {
if ((rv = xbps_transaction_update_packages()) != 0) {
if (rv == ENOENT) {
printf("No packages currently registered.\n");
return 0;
@ -219,7 +219,7 @@ install_new_pkg(const char *pkg)
if (xbps_pkgpattern_version(pkg)) {
pkgpatt = __UNCONST(pkg);
} else {
/*
/*
* If only pkgname has been specified, always append
* '-[0-9]*' at the end, will be easier to parse.
*/
@ -246,7 +246,7 @@ install_new_pkg(const char *pkg)
}
printf("Package `%s' needs to be configured.\n", pkgname);
}
if ((rv = xbps_repository_install_pkg(pkgpatt)) != 0) {
if ((rv = xbps_transaction_install_pkg(pkgpatt)) != 0) {
if (rv == ENOENT) {
xbps_error_printf("xbps-bin: unable to locate '%s' in "
"repository pool.\n", pkg);
@ -272,7 +272,7 @@ update_pkg(const char *pkgname)
{
int rv = 0;
rv = xbps_repository_update_pkg(pkgname);
rv = xbps_transaction_update_pkg(pkgname);
if (rv == EEXIST)
printf("Package '%s' is up to date.\n", pkgname);
else if (rv == ENOENT)

View File

@ -55,7 +55,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.3"
#define XBPS_API_VERSION "20111125"
#define XBPS_API_VERSION "20111125-1"
#define XBPS_VERSION "0.11.0"
/**
@ -1142,7 +1142,7 @@ int xbps_remove_pkg_files(prop_dictionary_t dict,
/*@}*/
/** @addtogroup repo_pkgs */
/** @addtogroup transdict */
/*@{*/
/**
@ -1150,14 +1150,11 @@ int xbps_remove_pkg_files(prop_dictionary_t dict,
* the transaction dictionary for future use. The first repository in
* the pool that matched the pattern wins.
*
* @note The function name might be misleading, but is correct because
* if package is found, it will be marked as "going to be installed".
*
* @param pkgpattern Package name or pattern to find.
*
* @return 0 on success, otherwise an errno value.
*/
int xbps_repository_install_pkg(const char *pkgpattern);
int xbps_transaction_install_pkg(const char *pkgpattern);
/**
* Marks a package as "going to be updated" in the transaction dictionary.
@ -1168,7 +1165,7 @@ int xbps_repository_install_pkg(const char *pkgpattern);
*
* @return 0 on success, otherwise an errno value.
*/
int xbps_repository_update_pkg(const char *pkgname);
int xbps_transaction_update_pkg(const char *pkgname);
/**
* Finds newer versions for all installed packages by looking at the
@ -1177,12 +1174,7 @@ int xbps_repository_update_pkg(const char *pkgname);
*
* @return 0 on success, otherwise an errno value.
*/
int xbps_repository_update_packages(void);
/*@}*/
/** @addtogroup transdict */
/*@{*/
int xbps_transaction_update_packages(void);
/**
* Returns the transaction dictionary, as shown above in the image.
@ -1196,8 +1188,8 @@ int xbps_repository_update_packages(void);
* while sorting packages or computing the transaction size.
*
* @note
* - This function will set errno to ENXIO if xbps_repository_install_pkg()
* xbps_repository_update_pkg() functions were not called previously.
* - This function will set errno to ENXIO if xbps_transaction_install_pkg()
* or xbps_transaction_update_pkg() functions were not called previously.
*/
prop_dictionary_t xbps_transaction_prepare(void);
@ -1212,8 +1204,8 @@ prop_dictionary_t xbps_transaction_prepare(void);
int xbps_transaction_commit(prop_dictionary_t transd);
/**
* Returns the missing deps array if xbps_repository_install_pkg()
* or xbps_repository_update_pkg() failed to find required packages
* Returns the missing deps array if xbps_transaction_install_pkg()
* or xbps_transaction_update_pkg() failed to find required packages
* in registered repositories.
*
* @return The proplib array, NULL if it couldn't be created.

View File

@ -45,11 +45,12 @@ OBJS = package_configure.o package_config_files.o package_orphans.o
OBJS += package_remove.o package_remove_obsoletes.o package_state.o
OBJS += package_unpack.o package_requiredby.o package_register.o
OBJS += package_purge.o transaction_commit.o transaction_package_replace.o
OBJS += transaction_dictionary.o transaction_sortdeps.o download.o
OBJS += transaction_dictionary.o transaction_sortdeps.o transaction_ops.o
OBJS += download.o
OBJS += plist.o plist_archive_entry.o plist_find.o plist_match.o
OBJS += plist_remove.o plist_fetch.o util.o util_hash.o
OBJS += initend.o regpkgdb_dictionary.o init_virtualpkgs.o
OBJS += repository_findpkg.o repository_finddeps.o cb_util.o
OBJS += repository_finddeps.o cb_util.o
OBJS += repository_pool.o repository_pool_find.o repository_sync_index.o
OBJS += $(EXTOBJS) $(COMPAT_SRCS)

View File

@ -32,9 +32,9 @@
#include "xbps_api_impl.h"
/**
* @file lib/repository_findpkg.c
* @brief Repository package handling routines
* @defgroup repo_pkgs Repository package handling functions
* @file lib/transaction_ops.c
* @brief Transaction package handling routines
* @defgroup repo_pkgs Transaction package handling functions
*
* The following image shows off the full transaction dictionary returned
* by xbps_transaction_prepare().
@ -52,7 +52,7 @@
* data type is specified on its edge, i.e string, array, integer, dictionary.
*/
static int
repository_find_pkg(const char *pattern, const char *reason)
transaction_find_pkg(const char *pattern, const char *reason)
{
prop_dictionary_t pkg_repod = NULL;
prop_dictionary_t transd;
@ -178,7 +178,7 @@ out:
}
int
xbps_repository_update_packages(void)
xbps_transaction_update_packages(void)
{
struct xbps_handle *xhp;
prop_object_t obj;
@ -200,7 +200,7 @@ xbps_repository_update_packages(void)
*/
while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
if ((rv = xbps_repository_update_pkg(pkgname)) != 0) {
if ((rv = xbps_transaction_update_pkg(pkgname)) != 0) {
if (rv == ENOENT || rv == EEXIST) {
/*
* missing pkg or installed version is
@ -226,13 +226,13 @@ xbps_repository_update_packages(void)
}
int
xbps_repository_update_pkg(const char *pkgname)
xbps_transaction_update_pkg(const char *pkgname)
{
return repository_find_pkg(pkgname, "update");
return transaction_find_pkg(pkgname, "update");
}
int
xbps_repository_install_pkg(const char *pkgpattern)
xbps_transaction_install_pkg(const char *pkgpattern)
{
return repository_find_pkg(pkgpattern, "install");
return transaction_find_pkg(pkgpattern, "install");
}