Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 303129 - equery / epkginfo should be consistent with ekeyword sorting
Summary: equery / epkginfo should be consistent with ekeyword sorting
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 237964
  Show dependency tree
 
Reported: 2010-02-01 18:37 UTC by Paul Varner (RETIRED)
Modified: 2010-11-22 20:50 UTC (History)
1 user (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 Paul Varner (RETIRED) gentoo-dev 2010-02-01 18:37:26 UTC
Current output looks like:
~amd64 ~amd64-linux ~ppc ~ppc-macos ~x86 ~x86-linux ~x86-macos ~x86-solaris

Should look like:
~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris
Comment 1 Sebastian Luther (few) 2010-02-01 19:29:16 UTC
Where does GLEP 53 say something about the order of keywords?
Comment 2 Paul Varner (RETIRED) gentoo-dev 2010-02-02 17:10:33 UTC
Actually, re-reading the GLEP, it doesn't say anything about sorting. Re-wording bug summary.
Comment 3 Douglas Anderson 2010-03-12 04:50:55 UTC
The following test has been added to equery's test suite and passes. The keyword sorting func can be found in gentoolkit.equery.keyword.compare_strs. equery.meta now makes use of this function to sort keywords.

def test_compare_strs(self):
	compare_strs = keyword.compare_strs
	# Test ordering of keyword strings
	version_tests = [
		# different archs
		('amd64', 'x86'),
		# stable vs. unstable
		('amd64-linux', '~amd64-linux'),
		# different OSes
		('~x86-linux', '~x86-solaris'),
		# OS vs. no OS
		('x86', '~amd64-linux')
	]
	# Check less than
	for vt in version_tests:
		self.failUnless(compare_strs(vt[0], vt[1]) == -1)
	# Check greater than
	for vt in version_tests:
		self.failUnless(compare_strs(vt[1], vt[0]) == 1)
	# Check equal
	vt = ('~amd64-linux', '~amd64-linux')
	self.failUnless(compare_strs(vt[0], vt[1]) == 0)

	kwds_presort = [
		'~amd64', '~amd64-linux', '~ppc', '~ppc-macos', '~x86',
		'~x86-linux', '~x86-macos', '~x86-solaris'
	]
	kwds_postsort = [
		'~amd64', '~ppc', '~x86', '~amd64-linux', '~x86-linux',
		'~ppc-macos', '~x86-macos', '~x86-solaris'
	]
	self.failUnlessEqual(sorted(kwds_presort, cmp=compare_strs), kwds_postsort)
Comment 4 Paul Varner (RETIRED) gentoo-dev 2010-04-08 15:46:55 UTC
Not fixed in gentoolkit-0.3.0_rc10.  Test case:
$ epkginfo xfce4-panel
 * xfce-base/xfce4-panel [gentoo]
Herd:        xfce (xfce@gentoo.org)
Maintainer:  None specified
Upstream:    None specified
Location:    /usr/portage/xfce-base/xfce4-panel
Keywords:    4.6.1:0: hppa
Keywords:    4.6.2:0: alpha amd64 arm ia64 ppc ppc64 sparc x86
Keywords:    4.6.2-r1:0: 
Keywords:    4.7.1:0: ~alpha ~amd64 ~amd64-linux ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix
                      ~x86-linux ~x86-solaris
Comment 5 Douglas Anderson 2010-07-17 14:22:42 UTC
The problem here is that the various sorting methods in gentoolkit.keyword all work for standard strings, but inside gentoolkit keywords are passed around as a list of unicode strings, and for some reason they don't sort the same. The test case in comment #3 needs to be modified to test for keywords like [u'this'].
Comment 6 Douglas Anderson 2010-07-18 17:23:31 UTC
Fixed in genscripts r458, though honestly I couldn't figure out why it wasn't working the other way... apparently it was not affected by the strings being unicode.
Comment 7 Paul Varner (RETIRED) gentoo-dev 2010-11-22 20:50:16 UTC
Released in gentoolkit-0.3.0_rc11