On Fri, Aug 22, 2008 at 2:56 PM, Nagy Gabor <ngaba@bibl.u-szeged.hu> wrote:
First, thanks for the feedback!
0. I don't like this _alpm_pkg_compare_versions() function at all, it has some annoying warning messages (why is the "forcing upgrade..." message important?), these reduce its usability (hardwired "upgrade" word etc.). This function is just a vercmp + force check + printing some (useless?) warnings. (The second "downgrade" warning also seems a bit odd in "-S target" operation because of mentioning the repo.)
I agree that these warning messages are annoying and rather useless.
However, I like the idea of having a simple wrapper to vercmp handling the force flag (and maybe the epoch idea in 10 years :P)
Btw, in your patch (without downgrade messages) we shouldn't check force in sync_addtarget, because force cannot affect "vercmp != 0" result. (I assume that --needed filters out reinstalls only). So pkg_vercmp (or strcmp;-) is enough here imho (without upgrade/downgrade distinction).
Finally, why is it odd to mention the repo?
OK. This is not odd, just strange. Clearly, this was designed for -Su. No other -S messages uses this "from repo extra" phrasing.
1. After your patch we won't display warning in 2) case neither (as you wrote in patch description). I am not sure this is better. I would simply inform user about both downgrade (but not in pkg_compare_versions!) and reinstall instead.
Could you be much more precise here?
There are 3 different values returned by compare_versions, and 2 values for the needed flag, which makes 6 different combination.
downgrade only applies when compare_versions == -1 and with both values of needed (because of point 2. below)
reinstall happens when compare_versions == 0 and needed == 0
So you want to display these messages only in these cases? And nothing in the other cases? (like skipping when compare_versions == 0 and needed == 1)
I am talking about "-S target" not about -Su (sync_newversion). 1. Target is newer: usual case, no warning 2. Reinstall was requested (local_ver == target_ver): Skipping/Reinstalling foo... (1.0-1 => 1.0-1) 3. Target is older: Downgrading foo... (2.0-1 => 1.0-1) [These => notations can be confusing with force flagged packages.] I am a bit unsure about downgrade warning idea (after thinking a bit). (However, atm if pkg_compare_versions is used, we get a downgrade warning.) It would be cool (imho), but in fact we use downgrade/upgrade distinction nowhere else. (see -U, resolvedeps added packages (edge), many event/debug messages and so on.) Bye