Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46114 - "etcat -v mldonkey" fails and gives Traceback error
Summary: "etcat -v mldonkey" fails and gives Traceback error
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
: 48476 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-29 07:46 UTC by Jean-Marc Coic
Modified: 2004-08-21 13:43 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Marc Coic 2004-03-29 07:46:29 UTC
Instead of displaying current versions of mldonkey, etcat fails.

Reproducible: Always
Steps to Reproduce:
1. etcat -v mldonkey
2.
3.

Actual Results:  
# etcat -v mldonkey 
[ Results for search key           : mldonkey ] 
[ Candidate applications found : 5 ] 
 
 Only printing found installed programs. 
 
Traceback (most recent call last): 
  File "/usr/bin/etcat", line 670, in ? 
    main() 
  File "/usr/bin/etcat", line 666, in main 
    function(query, matches) 
  File "/usr/bin/etcat", line 251, in versions 
    matches = gentoolkit.sort_package_list(matches) 
  File "/usr/lib/gentoolkit/pym/gentoolkit.py", line 294, in sort_package_list 
    pkglist.sort(Package.compare_version) 
TypeError: comparison function must return int 
 

Expected Results:  
displaying current versions of mldonkey 

#emerge info 
Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.3, glibc-2.3.2-r9, 2.6.4-rc2-love1) 
================================================================= 
System uname: 2.6.4-rc2-love1 i686 AMD Athlon(tm) XP 2600+ 
Gentoo Base System version 1.4.3.10 
distcc 2.11.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] 
Autoconf: sys-devel/autoconf-2.59 
Automake: sys-devel/automake-1.7.5-r2 
ACCEPT_KEYWORDS="x86" 
AUTOCLEAN="yes" 
CFLAGS="-mcpu=athlon-xp -O2 -pipe" 
CHOST="i686-pc-linux-gnu" 
COMPILER="gcc3" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/confi                         
g /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /usr/share/texmf/tex/g                         
eneric/config/ /usr/share/texmf/tex/platex/config/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" 
CXXFLAGS="-mcpu=athlon-xp -O2 -pipe" 
DISTDIR="/mnt/reiser/distfiles" 
FEATURES="autoaddcvs ccache sandbox" 
GENTOO_MIRRORS="ftp://trumpetti.atm.tut.fi/gentoo/ http://gentoo.mirror.sdv.fr 
ftp://sunsite                         .cnlab-switch.ch/mirror/gentoo/" 
MAKEOPTS="-j2" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/mnt/reiser/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/usr/local/portage" 
SYNC="rsync://rsync.fr.gentoo.org/gentoo-portage" 
USE="3dnow X aalib alsa apm arts avi berkdb cdr cjk crypt cups dvd encode esd foomaticdb gdb                         
m gif gphoto2 gpm gtk gtk2 imlib jpeg kde ldap libg++ libwww mad mikmod mmx motif mpeg 
mysql                          nas ncurses nls nptl oggvorbis opengl oss pam pdflib perl png python qt 
quicktime readline                          sdl slang spell sse ssl svga tcpd tetex truetype x86 xinerama xml2 
xmms xv zlib"
Comment 1 Gregorio Guidi (RETIRED) gentoo-dev 2004-04-12 10:04:18 UTC
This happens because mldonkey is ambiguous: when etcat produces the list
of the package names/versions to display, it finds something like
app-emacs/mldonkey-0.0.2a
net-p2p/mldonkey-2.5.4
net-p2p/mldonkey-2.5.11
...

Then etcat tries to compare the versions of those packages, but since
comparison of packages that have different categories/names is not allowed,
it gives the backtrace.

in /usr/bin/etcat, there's some code to deal with the "ambiguous package"
case, which is:

                except ValueError, e:
                        if type(e[0]) == types.ListType:
                                print red("!!!"), "Ambiguous package name \"%s\"" % query
                                print red("!!!"), "Please use one of the following long names:"
                                for p in e[0]:
                                        print red("!!!"), "    "+p

But this is never executed because in gentoolkit.py the "ambiguous package"
exception is explicitly catched, so that having a list of packages that
is ambiguous is not a problem.
One solution could be to avoid catching that exception, so that lines 187-202
in gentoolkit.py look like the following:

#       try:
        if masked:
                t=portage.portdb.xmatch("match-all", search_key)
        else:
                t=portage.portdb.match(search_key)
        # catch the "amgigous package" Exception
#       except ValueError, e:
#               if type(e[0]) == types.ListType:
#                       t=[]
#                       for cp in e[0]:
#                               if masked:
#                                       t += portage.portdb.xmatch("match-all",$#                               else:
#                                       t += portage.portdb.match(cp)
#               else:
#                       raise ValueError(e)

Another solution could be to allow comparison of versions from different
packages.
Comment 2 Martin Holzer (RETIRED) gentoo-dev 2004-04-21 00:02:13 UTC
*** Bug 48476 has been marked as a duplicate of this bug. ***
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2004-04-21 19:43:08 UTC
changed the comparison function so it returns sys.maxint instead of None
Comment 4 James Roberts-Thomson 2004-07-29 14:28:25 UTC
I've just noticed that "etcat -v readline" still gives this error.  Should the fix have made it into portage and/or gentoolkit yet?
Comment 5 Brian Harring (RETIRED) gentoo-dev 2004-08-16 11:05:34 UTC
Still an issue?  I don't use etcat at all...
Comment 6 Andre Hinrichs 2004-08-16 11:31:34 UTC
Yes, it is still an issue!
But don't know why? emerge handles such cases in the right way, but etcat
doesn't. Output is still as reported. I'm not familiar with python, but it
should be easy to copy the idea from emerge to etcat, shouldn't it?
Here is, what emerge says...


# emerge -p ocaml

These are the packages that I would merge, in order:

Calculating dependencies

!!! The short ebuild name "ocaml" is ambiguous.  Please specify
!!! one of the following fully-qualified ebuild names instead:

    app-xemacs/ocaml
    dev-lang/ocaml
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2004-08-21 13:43:37 UTC
this tool is deprecated