Ticket #13031 (closed defect: fixed)
port installed should list versions in natural order
| Reported by: | ryandesign@… | Owned by: | macports-tickets@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | MacPorts 1.7.0 |
| Component: | base | Version: | 1.6.0 |
| Keywords: | Cc: | ryandesign@…, afb@… | |
| Port: |
Description
"port installed" seems to list software versions in ASCII order instead of natural order.
A reproduction recipe follows, but you'll need Subversion installed, and your ports tree must be a Subversion working copy instead of an rsync directory.
If you don't already have apr 1.2.11 installed, install it:
$ svn up -r 28770 `port dir apr` $ sudo port install apr
If you don't already have apr 1.2.8 and 1.2.9 installed, install them:
$ sudo -s Password: $ cd /opt/local/var/macports/distfiles/apr $ curl -O http://archive.apache.org/dist/apr/apr-1.2.8.tar.bz2 $ svn up -r 22846 `port dir apr` $ port install apr $ curl -O http://archive.apache.org/dist/apr/apr-1.2.9.tar.bz2 $ svn up -r 26846 `port dir apr` $ port install apr
It'll complain about already-installed versions. Nevermind that. Now see the list of installed versions of apr:
$ port installed apr The following ports are currently installed: apr @1.2.11_0 (active) apr @1.2.8_0 apr @1.2.9_0 $
It would be better if these were listed in natural order, e.g. with 1.2.11 coming after 1.2.9.
Attachments
Change History
Changed 6 years ago by afb@…
- Attachment macports-portsort.patch added
comment:2 Changed 6 years ago by ryandesign@…
- Cc afb@… added
Thanks for being so quick on this! Your code looks great... but for some reason I've applied the patch to trunk and rebuilt port but it's not doing anything different. I tried inserting ui_debug and ui_msg statements into the portlist_compare function to see what it's doing but they're not getting printed either. Any ideas?
comment:3 Changed 6 years ago by ryandesign@…
Oh, I see now, portlist_compare is only called for port list but I'm not using port list; I'm using port installed... How do we apply this fix for port installed?
comment:4 Changed 6 years ago by afb@…
Hmm, maybe that calls a different sort/order function (or doesn't sort at all)
comment:6 Changed 5 years ago by afb@…
- Status changed from new to closed
- Resolution set to fixed
Fixed, r32721.
Resorted the results from "port installed", to make sure it was printed sorted.


macports-portsort.patch