[pacman-dev] [PATCH] Add more information in conflicts question

Sebastian Nowicki sebnow at gmail.com
Sun Apr 17 11:40:19 EDT 2011

On Sun, Apr 17, 2011 at 5:50 PM, Rémy Oudompheng
<remyoudompheng at gmail.com> wrote:
> On Sun 17 April 2011 at 17:03 +0800, Sebastian Nowicki wrote:
> > In addition to the names of the conflicting packages, the origin and
> > versions will be displayed to the user.
> >
> > This introduces a slight API change in the PM_TRANS_CONV_CONFLICT_PKG
> > conversation callback. The format of the first two strings has changed
> > from package names to strings of the format "db/name-version".
> >
> > Fixes FS#12536
> > ---
> >
> > I rewrote the patch to pre-format the package information rather than
> > changing the API completely, as per Dan's suggestion. This still
> > introduces a bit of an API change as the two string can no longer be
> > used as package identifiers, e.g. in alpm_db_get_pkg().
> >
> > $ sudo ./src/pacman/pacman -S qemu-kvm
> > resolving dependencies...
> > looking for inter-conflicts...
> > :: extra/qemu-kvm-0.14.0-1 and local/qemu-0.14.0-1 are in conflict (qemu). Remove local/qemu-0.14.0-1? [y/N] n
> > error: unresolvable package conflicts detected
> > error: failed to prepare transaction (conflicting dependencies)
> > :: qemu-kvm and qemu are in conflict
> >
> >  lib/libalpm/sync.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++---
> >  1 files changed, 48 insertions(+), 3 deletions(-)
> I am totally against this. Really really totally.
> I personally think a formatting function for package information has
> strictly nothing to do in sync.c, and maybe not even in libalpm.
> Second, it would introduce additional parsing effort from front-ends to
> split against the passed string if they want to display information in a
> different way.

Agreed, but the alternatives require changes to the API (char * -> pmpkg_t).

> And what output do you expect if a conflict arises when running
> pacman -U ?? What do you think is the repository from a package loaded
> from a file.

Just the package name and version. Having a "file/" prefix would be
meaningless, and if you're installing from a single file, you're
likely to know what you're installing anyway.

> I don't even understand why we would want to display any sort of version
> information. I don't see how it would help me answer yes or no to that
> conflict question either.
> That is in my mind the job of the front-end: if you really
> want information, it should display the list of selected packages
> (repository/pkgname-pkgver) that comes between the parsing of the
> command-line and the beginning of the transaction.
> For example:
> cb_trans_conv (from pacman) should be patched to display :
>  :: target qemu-kvm conflicts with installed qemu. Remove qemu ?
> which is perfectly clear: qemu is installed and pacman wants you to
> remove it, "local/qemu" brings no additional information, and the version
> number is usually meaningless. The callback returns precisely one local
> package and one target package, it can be reflected in the user output.

If the version of the local package is newer than the one being
installed, it would be good to inform the user (as would have been
likely with the libdrm-git package). The "local/" prefix can easily be

> If you need to display the version number, then I don't feel like
> messing with libalpm's internals is the right answer. I would probably
> prefer have process_targname() patched (in pacman/sync.c), so that
> after running alpm_find_dbs_satisfier(), it prints something.

I think that changing the API of the callback to use pmpkg_t, (or even
pmconflict_t if that's exposed) rather than a string, is the right
thing to do. The front-end shouldn't have to find the package again to
get its metadata (what if there are multiple packages with the same
name?). For instance a GUI front-end may want to show the description
of the package or something. It's a pretty drastic change considering
the result is cosmetic.

> However, I think modifying the callback to return pmpkg_t is not a bad
> idea, but then the formatting function should go in pacman. I just want
> to understand the first reason why we are doing this. The bug report is
> totally inconsistent (the title is inconsistent with the described
> problem and so on), and it seems we are trying to solve some imaginary
> problem.
> The best thing we can probably do is make libalpm functions return more
> information about their internal processing. Modifying formatting will
> not help that. And if people want to know why some package suddenly
> appears in the target list, I fear there is no solution.

In which case the API needs to change. I don't think cosmetic changes
are worth doing so, but that's a decision for the devs.

More information about the pacman-dev mailing list