Added the concept of package properties in the API.

See the NEWS file and xbps-bin(8) for more information.
This commit is contained in:
Juan RP
2011-02-05 11:25:04 +01:00
parent d25bc35711
commit de296d8192
12 changed files with 820 additions and 212 deletions

View File

@@ -53,7 +53,7 @@
* @def XBPS_RELVER
* Current library release date.
*/
#define XBPS_RELVER "20110201"
#define XBPS_RELVER "20110205"
/**
* @def XBPS_META_PATH
@@ -174,6 +174,31 @@ int xbps_configure_all_pkgs(void);
/*@}*/
/** @addtogroup pkgprops */
/*@{*/
/**
* Sets the property \a prop in a package matching the name \a pkgname.
*
* @param[in] prop Property key to be set.
* @param[in] pkgname Package name to set the property.
*
* @return 0 on success, otherwise an errno value.
*/
int xbps_property_set(const char *prop, const char *pkgname);
/**
* Unsets the property \a prop in a package matching the name \a pkgname.
*
* @param[in] prop Property key to be unset.
* @param[in] pkgname Package name to unset the property.
*
* @return 0 on success, otherwise an errno value.
*/
int xbps_property_unset(const char *prop, const char *pkgname);
/*@}*/
/**
* @ingroup vermatch
*
@@ -436,7 +461,8 @@ prop_dictionary_t xbps_find_pkg_in_dict_by_pattern(prop_dictionary_t dict,
* a package name.
*
* @param[in] plist Path to a plist file.
* @param[in] pkgname Package name to look for.
* @param[in] key Proplib array's key name.
* @param[in] pkgname Package name to match in array.
*
* @return The package's proplib dictionary on success, NULL otherwise and
* errno is set appropiately. Returned dictionary is copied via
@@ -444,8 +470,25 @@ prop_dictionary_t xbps_find_pkg_in_dict_by_pattern(prop_dictionary_t dict,
* release the object with prop_object_release() when done.
*/
prop_dictionary_t xbps_find_pkg_dict_from_plist_by_name(const char *plist,
const char *key,
const char *pkgname);
/**
* Finds the package's proplib dictionary in a plist file by specifying
* a package pattern.
*
* @param[in] plist Path to a plist file.
* @param[in] key Proplib array's key name.
* @param[in] pattern Package pattern to match in array.
*
* @return The package's proplib dictionary on success, NULL otherwise and
* errno is set appropiately. Returned dictionary should be released with
* prop_object_release() when it's not any longer needed.
*/
prop_dictionary_t xbps_find_pkg_dict_from_plist_by_pattern(const char *plist,
const char *key,
const char *pattern);
/**
* Finds a package's dictionary searching in the registered packages
* database by using a package name or a package pattern.

View File

@@ -199,6 +199,19 @@ int HIDDEN xbps_file_chdir_exec(const char *path, const char *arg, ...);
int HIDDEN xbps_repository_pkg_replaces(prop_dictionary_t,
prop_dictionary_t);
/**
* @private
* From lib/plist.c
*/
prop_dictionary_t HIDDEN
xbps_find_virtualpkg_user_in_dict_by_name(prop_dictionary_t,
const char *,
const char *);
prop_dictionary_t HIDDEN
xbps_find_virtualpkg_user_in_dict_by_pattern(prop_dictionary_t,
const char *,
const char *);
__END_DECLS
#endif /* !_XBPS_API_IMPL_H_ */