[pacman-dev] [PATCH] alpm_list_add == alpm_list_add_last I: recursedeps clean-up

Xavier shiningxc at gmail.com
Wed Nov 14 09:03:15 EST 2007


On Wed, Nov 14, 2007 at 01:18:28PM +0100, Nagy Gabor wrote:
> Subject: [PATCH] alpm_list_add == alpm_list_add_last I: recursedeps clean-up
>  It's time to _define_ that alpm_list_add(list, foo) adds 'foo' to the end of 'list' and returns with 'list', because:
>  1. list is a list, not a set
>  2. sortbydeps _needs_ an alpm_list_add _definition_ to work properly
> 
> As a first step, I used this definition in recursedeps
> 

There are several other places where this assumption is made, so I guess it's
alright..
The last one I saw is in the groups handling of the -S operation, in
src/pacman/sync.c , lines 500-520.

So shouldn't it be commented in alpm_list.c itself?

> diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
> index cefffe5..5040fbf 100644
> --- a/lib/libalpm/deps.c
> +++ b/lib/libalpm/deps.c
> @@ -596,12 +596,13 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
>   * @brief Adds unneeded dependencies to an existing list of packages.
>   * By unneeded, we mean dependencies that are only required by packages in the
>   * target list, so they can be safely removed.
> + * If the input list was topo sorted, the output list will be topo sorted too
>   *
>   * @param db package database to do dependency tracing in
>   * @param *targs pointer to a list of packages
>   * @param include_explicit if 0, explicitly installed packages are not included
>   */

And if it isn't topo sorted, then what happens?
Shouldn't the comment rather be something like :
The targets list must be topo sorted, and will stay topo sorted.




More information about the pacman-dev mailing list