[pacman-dev] [PATCH] Treat packages to be printed as non-ignored
Andrew Gregory
andrew.gregory.8 at gmail.com
Tue Mar 12 22:17:22 EDT 2013
On 03/12/13 at 06:51pm, Connor Behan wrote:
> Calling pacman -Sp is guaranteed not to install a package. So the user's IgnorePkg pref is still respected regardless of whether or not we print the mirror location. Therefore we might as well do so to give as much information as possible. Also fixes an edge case with devtools.
>
> Signed-off-by: Connor Behan <connor.behan at gmail.com>
> ---
This is really a frontend issue. If pacman doesn't want alpm to
ignore packages it should just set ignorepkgs to an empty list.
> lib/libalpm/alpm.h | 1 +
> lib/libalpm/handle.c | 7 +++++++
> lib/libalpm/handle.h | 1 +
> lib/libalpm/package.c | 8 +++++++-
> src/pacman/conf.c | 1 +
> 5 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
> index ccbdd1c..ec5716a 100644
> --- a/lib/libalpm/alpm.h
> +++ b/lib/libalpm/alpm.h
> @@ -587,6 +587,7 @@ int alpm_option_set_arch(alpm_handle_t *handle, const char *arch);
>
> double alpm_option_get_deltaratio(alpm_handle_t *handle);
> int alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio);
> +int alpm_option_set_print(alpm_handle_t *handle, int print);
>
> int alpm_option_get_checkspace(alpm_handle_t *handle);
> int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
> diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
> index 53c86c5..2d914ca 100644
> --- a/lib/libalpm/handle.c
> +++ b/lib/libalpm/handle.c
> @@ -594,6 +594,13 @@ int SYMEXPORT alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio)
> return 0;
> }
>
> +int SYMEXPORT alpm_option_set_print(alpm_handle_t *handle, int print)
> +{
> + CHECK_HANDLE(handle, return -1);
> + handle->print = print;
> + return 0;
> +}
> +
> alpm_db_t SYMEXPORT *alpm_get_localdb(alpm_handle_t *handle)
> {
> CHECK_HANDLE(handle, return NULL);
> diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
> index 5e84d58..413e19a 100644
> --- a/lib/libalpm/handle.h
> +++ b/lib/libalpm/handle.h
> @@ -89,6 +89,7 @@ struct __alpm_handle_t {
> /* options */
> char *arch; /* Architecture of packages we should allow */
> double deltaratio; /* Download deltas if possible; a ratio value */
> + int print; /* Treat pkgs as if they will not be installed anyway */
> int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
> int checkspace; /* Check disk space before installing */
> alpm_siglevel_t siglevel; /* Default signature verification level */
> diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
> index 098c867..ea82148 100644
> --- a/lib/libalpm/package.c
> +++ b/lib/libalpm/package.c
> @@ -762,7 +762,8 @@ alpm_pkg_t SYMEXPORT *alpm_pkg_find(alpm_list_t *haystack, const char *needle)
> /** Test if a package should be ignored.
> *
> * Checks if the package is ignored via IgnorePkg, or if the package is
> - * in a group ignored via IgnoreGroup.
> + * in a group ignored via IgnoreGroup. Packages only being printed are
> + * immune from this.
> *
> * @param handle the context handle
> * @param pkg the package to test
> @@ -772,6 +773,11 @@ alpm_pkg_t SYMEXPORT *alpm_pkg_find(alpm_list_t *haystack, const char *needle)
> int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg)
> {
> alpm_list_t *groups = NULL;
> +
> + /* #FS#34066 - Querying URLs for packages (even ignored ones) should succeed */
> + if (handle->print) {
> + return 0;
> + }
>
> /* first see if the package is ignored */
> if(alpm_list_find(handle->ignorepkg, pkg->name, _alpm_fnmatch)) {
> diff --git a/src/pacman/conf.c b/src/pacman/conf.c
> index 815df95..07255cb 100644
> --- a/src/pacman/conf.c
> +++ b/src/pacman/conf.c
> @@ -721,6 +721,7 @@ static int setup_libalpm(void)
> alpm_option_set_checkspace(handle, config->checkspace);
> alpm_option_set_usesyslog(handle, config->usesyslog);
> alpm_option_set_deltaratio(handle, config->deltaratio);
> + alpm_option_set_print(handle, config->print);
>
> alpm_option_set_ignorepkgs(handle, config->ignorepkg);
> alpm_option_set_ignoregroups(handle, config->ignoregrp);
> --
> 1.8.1.5
More information about the pacman-dev
mailing list