From patchwork Mon Dec 7 22:19:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: morganamilo X-Patchwork-Id: 1825 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id BE0E21C9979BE for ; Mon, 7 Dec 2020 22:46:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,SPF_HELO_PASS=-0.001,T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: Received: from mail.archlinux.org (mail.archlinux.org [IPv6:2a01:4f9:c010:3052::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 7 Dec 2020 22:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1607379730; bh=t91UClIjHgoiDTvrHgwMvsxR7CrIELIFCgWYHuXqfV0=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To; b=VIBS5lvyxTFLYy1viiMdImCxKa70npZNqafAfVHYer0xEsffrYmxEwo7fsLLdlvei c85/h9/Y4Nqtv/t4iNvOkkFhR88y5fFxwm01KkhqelR7aNZSFQLtqe7rJuqGhQfp6g wYOb+5dwM2SJ8CXktYoqk3eHv0nr5lx+H2wUKof5IGMCthwIUex0VsJZjEpRfQ6Qhk 0wRj0zZ7wUpoJQ+OZwlL3PSHkoolbiN4C4IZd+6H47/AJZrslvBd1pHI2fmnJjm0G1 LfIvlxhx4SxELYEMyINIZ4R6Lmb52OD4zTZNJYAkgZv+UHX9zRwCZEoj4xshbknGjf Pog1WssXs2uLjtXsoooIHzXQbyySkLTBcATI/vJS0+hP9uHWnsYTZ/i9lJorzU2aBY GFHOC3HaEyTrRiFaprjWio3YTfKY4lDYt899ilQb++sYuIK8V/H1Ta6o2xlIFQMj8P Ovo3DeccVEjJNOEk5xmRsGDzjupbA6KAWucff2mZyL53CjTVmJ92lRx4PP5TpwFtEI +vQZuFJkLRUwHaMp9mJJGkja9Re0IQ3tIQNlJbjdzSgDD/ip0Ue2m+N7ZDxhB9IQRR eyxr2MwZZOyni+KjNosPPNu4s61v1r7yCeUFP6uIw2xeLfBSoJ5YhZwCdXgiBoQQXh fFPPDRq7QCn+BblGDAAGBVF4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1607381192; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Kr929elsnEuTr7fF+8ZLsDapjAhQa0W274kragatftE=; b=CUj8ODThuzGLTc3eyftbJADJRKmYqSjOtEOdeM9wgYDYWib9XbNEunjkMQsI17B7fAVHWu jETN9AIQrRFrkEcYkvLNyObJ5c4toyUhzjSjtr0effCrobhLdxNP8vMi2dw/5uITzmYMal ElBUglIH/YE66HF0xuKrO1gtvubyf/4+yO4Vy+SlorLixGcFoJPiBeDCLVrWA+GwRd38ZT 6BMckv8SyQY6gmKFSGrlTxZHU7pnn/y0zkivYn4inAnZlerwUMAGX2R4JDJsOoznQZLFmn BWFaLmSO9T5mHMedOnyDYtJzrt16WB+K/b4pSvDEsJjKp/e71r49SM1cahNZmqhItQYu0X J0AtjtOqQBkufPVJdfKaQ0MlMwkoaiV7sUQaTFm27l0QZH+G9KTEPzy3epnYcgP+xP3vX5 iAszgYvuvHmGD7k+6D60rq3ZNUrNY1r68Gin9l/nGgFgL1eYVCHDQWAAfHCLhA7JpjTBhv O+yWIgiKOhsjE7knHbdxlGmEH59hOuWp+mqfpF/g3U+V/cmUqqhJxqHXImrR/5rL9RvTCh rkU7TST9ZXp/Q7hxLwkwL2XryjJ8GLlAEZAx5meLJl3uX9CfxrukU3lVcgktZvhjt107i7 Q5MNSxd3rLDKF16a54zcvLD2x9hXXbXnSeMbo3wFWIpxTb4rW5miE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1607381192; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Kr929elsnEuTr7fF+8ZLsDapjAhQa0W274kragatftE=; b=FTWIf2NLaNqxs6WQTmtKnlXkC1j0gpc/yLmKbpgo3Xu6VdE95At5GE+Z+nxCiizkLP/YkC lnSB+fO7MPEdIVBw== From: morganamilo DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1607379727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kr929elsnEuTr7fF+8ZLsDapjAhQa0W274kragatftE=; b=nUMHN7DcOPA6ZDkXk+hVPh04pdDiSpY9lEFLOrk8gq1lC2ery6UxZs1jXmYPjrXcCInU4H C3aHTgrPt3GemY1yw0DXh4gHArHqjNIZGR/9R9m1jgweA2ObCANXTDB21rFRPNIYKv5sGT SSyjq8I5EEHm+taxiopqpYRWIEpT8daKCF42ma6EPbG3/lPmqULeUe0MccC7AbkvEx8VH3 +bWyp8D1cQJNUC8HlUhEhv2AfjgtgeIRNldjk7YB3hQNbe+yykTHi7YepLVQflk1UYZuNS M3Hq7czZM4ZfAm5MjyTjdbjZ+gsnxNkU18JFV91I2feiguWM9PeP0NWQV+Hneb/FIrYu0d lQs3X2ng1heCzqH9rTR0fRWD+C1l+zC9OF3miaHtHxN0oRiKxHVNwkfO0YbEGmAspp82Gs M/95xqAhPiyGG4Tax+8qpOXFYOXh3pyCmsgWAod/pzf/ClU3MBt0oFAq7b7VHD6Rh5otIq IpaM9JBe6Sw2lqfEy8gXN9KK/hCXHJKTJMMZzfw7bjC6S0g0p4xfIQ1icsjWlXidtG4bDt qkTW44saZI8whcPzvLZwSp+r8Sk0WVyV1kyZLd6cxnO0ovEujxbTIlbo/bhQYnjZuoWVIe yMnAehcDGUD5k2jQC6W3+VMU14I1sUzc7dPcG4o0UadwdpwJwZ9Eo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1607379727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kr929elsnEuTr7fF+8ZLsDapjAhQa0W274kragatftE=; b=8K5q+KLLPA64GI4qJo7PHwYt5KCVL9opJgw04lZWtoiBcD1KWRSdNWUUbALbdgL6Ga3Ik3 0j/t2d7HplP/YlDw== To: pacman-dev@archlinux.org Date: Mon, 7 Dec 2020 22:19:39 +0000 Message-Id: <20201207221956.667322-7-morganamilo@archlinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201207221956.667322-1-morganamilo@archlinux.org> References: <20201207221956.667322-1-morganamilo@archlinux.org> MIME-Version: 1.0 Subject: [pacman-dev] [PATCH 06/23] doc: document depends X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" Authentication-Results: mail.archlinux.org; auth=pass smtp.auth=luna smtp.mailfrom=pacman-dev-bounces@archlinux.org --- lib/libalpm/alpm.h | 295 +++++++++++++++++++++++++-------------------- 1 file changed, 164 insertions(+), 131 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 43a47d54..ea99a8b3 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -441,49 +441,26 @@ int alpm_extract_keyid(alpm_handle_t *handle, const char *identifier, /** @} */ -/* - * Enumerations - * These ones are used in multiple contexts, so are forward-declared. +/** @addtogroup alpm_depends Dependency + * @brief Functions dealing with libalpm's dependency and conflict + * information. + * @{ */ -/** Package install reasons. */ -typedef enum _alpm_pkgreason_t { - /** Explicitly requested by the user. */ - ALPM_PKG_REASON_EXPLICIT = 0, - /** Installed as a dependency for another package. */ - ALPM_PKG_REASON_DEPEND = 1 -} alpm_pkgreason_t; - -/** Location a package object was loaded from. */ -typedef enum _alpm_pkgfrom_t { - ALPM_PKG_FROM_FILE = 1, - ALPM_PKG_FROM_LOCALDB, - ALPM_PKG_FROM_SYNCDB -} alpm_pkgfrom_t; - -/** Method used to validate a package. */ -typedef enum _alpm_pkgvalidation_t { - ALPM_PKG_VALIDATION_UNKNOWN = 0, - ALPM_PKG_VALIDATION_NONE = (1 << 0), - ALPM_PKG_VALIDATION_MD5SUM = (1 << 1), - ALPM_PKG_VALIDATION_SHA256SUM = (1 << 2), - ALPM_PKG_VALIDATION_SIGNATURE = (1 << 3) -} alpm_pkgvalidation_t; - /** Types of version constraints in dependency specs. */ typedef enum _alpm_depmod_t { - /** No version constraint */ - ALPM_DEP_MOD_ANY = 1, - /** Test version equality (package=x.y.z) */ - ALPM_DEP_MOD_EQ, - /** Test for at least a version (package>=x.y.z) */ - ALPM_DEP_MOD_GE, - /** Test for at most a version (package<=x.y.z) */ - ALPM_DEP_MOD_LE, - /** Test for greater than some version (package>x.y.z) */ - ALPM_DEP_MOD_GT, - /** Test for less than some version (package=x.y.z) */ + ALPM_DEP_MOD_GE, + /** Test for at most a version (package<=x.y.z) */ + ALPM_DEP_MOD_LE, + /** Test for greater than some version (package>x.y.z) */ + ALPM_DEP_MOD_GT, + /** Test for less than some version (package=2.12" + */ +char *alpm_dep_compute_string(const alpm_depend_t *dep); + +/** Return a newly allocated dependency information parsed from a string + *\link alpm_dep_free should be used to free the dependency \endlink + * @param depstring a formatted string, e.g. "glibc=2.12" + * @return a dependency info structure + */ +alpm_depend_t *alpm_dep_from_string(const char *depstring); + +/** Free a dependency info structure + * @param dep struct to free + */ +void alpm_dep_free(alpm_depend_t *dep); + +/** Free a fileconflict and its members. + * @param conflict the fileconflict to free + */ +void alpm_fileconflict_free(alpm_fileconflict_t *conflict); + +/** Free a depmissing and its members + * @param miss the depmissing to fre + * */ +void alpm_depmissing_free(alpm_depmissing_t *miss); + +/** + * Free a conflict and its members. + * @param conflict the conflict to free + */ +void alpm_conflict_free(alpm_conflict_t *conflict); + + +/* End of alpm_depends */ +/** @} */ + +/* + * Enumerations + * These ones are used in multiple contexts, so are forward-declared. + */ + +/** Package install reasons. */ +typedef enum _alpm_pkgreason_t { + /** Explicitly requested by the user. */ + ALPM_PKG_REASON_EXPLICIT = 0, + /** Installed as a dependency for another package. */ + ALPM_PKG_REASON_DEPEND = 1 +} alpm_pkgreason_t; + +/** Location a package object was loaded from. */ +typedef enum _alpm_pkgfrom_t { + ALPM_PKG_FROM_FILE = 1, + ALPM_PKG_FROM_LOCALDB, + ALPM_PKG_FROM_SYNCDB +} alpm_pkgfrom_t; + +/** Method used to validate a package. */ +typedef enum _alpm_pkgvalidation_t { + ALPM_PKG_VALIDATION_UNKNOWN = 0, + ALPM_PKG_VALIDATION_NONE = (1 << 0), + ALPM_PKG_VALIDATION_MD5SUM = (1 << 1), + ALPM_PKG_VALIDATION_SHA256SUM = (1 << 2), + ALPM_PKG_VALIDATION_SIGNATURE = (1 << 3) +} alpm_pkgvalidation_t; + +/* + * Structures + */ + /** Package group */ typedef struct _alpm_group_t { /** group name */ @@ -1900,76 +2016,6 @@ int alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg); /** @} */ -/** @addtogroup alpm_api_depends Dependency Functions - * Functions dealing with libalpm representation of dependency - * information. - * @{ - */ - -/** Checks dependencies and returns missing ones in a list. - * Dependencies can include versions with depmod operators. - * @param handle the context handle - * @param pkglist the list of local packages - * @param remove an alpm_list_t* of packages to be removed - * @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade) - * @param reversedeps handles the backward dependencies - * @return an alpm_list_t* of alpm_depmissing_t pointers. - */ -alpm_list_t *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglist, - alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps); - -/** Find a package satisfying a specified dependency. - * The dependency can include versions with depmod operators. - * @param pkgs an alpm_list_t* of alpm_pkg_t where the satisfier will be searched - * @param depstring package or provision name, versioned or not - * @return a alpm_pkg_t* satisfying depstring - */ -alpm_pkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring); - -/** Find a package satisfying a specified dependency. - * First look for a literal, going through each db one by one. Then look for - * providers. The first satisfier that belongs to an installed package is - * returned. If no providers belong to an installed package then an - * alpm_question_select_provider_t is created to select the provider. - * The dependency can include versions with depmod operators. - * - * @param handle the context handle - * @param dbs an alpm_list_t* of alpm_db_t where the satisfier will be searched - * @param depstring package or provision name, versioned or not - * @return a alpm_pkg_t* satisfying depstring - */ -alpm_pkg_t *alpm_find_dbs_satisfier(alpm_handle_t *handle, - alpm_list_t *dbs, const char *depstring); - -/** - * @brief Check the package conflicts in a database - * - * @param handle the context handle - * @param pkglist the list of packages to check - * - * @return an alpm_list_t of alpm_conflict_t - */ -alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist); - -/** Returns a newly allocated string representing the dependency information. - * @param dep a dependency info structure - * @return a formatted string, e.g. "glibc>=2.12" - */ -char *alpm_dep_compute_string(const alpm_depend_t *dep); - -/** Return a newly allocated dependency information parsed from a string - * @param depstring a formatted string, e.g. "glibc=2.12" - * @return a dependency info structure - */ -alpm_depend_t *alpm_dep_from_string(const char *depstring); - -/** Free a dependency info structure - * @param dep struct to free - */ -void alpm_dep_free(alpm_depend_t *dep); - -/** @} */ - /** @} */ /* @@ -2021,19 +2067,6 @@ const char *alpm_version(void); * */ int alpm_capabilities(void); -/** - * Free a fileconflict and its members. - * @param conflict the fileconflict to free - */ -void alpm_fileconflict_free(alpm_fileconflict_t *conflict); -void alpm_depmissing_free(alpm_depmissing_t *miss); - -/** - * Free a conflict and its members. - * @param conflict the conflict to free - */ -void alpm_conflict_free(alpm_conflict_t *conflict); - /* End of alpm_api */ /** @} */