FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 10-26-2010, 10:13 PM
Jeroen Roovers
 
Default New eshowkw

On Tue, 26 Oct 2010 18:13:25 +0200
Fabian Groffen <grobian@gentoo.org> wrote:

> On 26-10-2010 17:39:04 +0200, Tomáš Chvátal wrote:
> > So since I would like to have this script replace current eshowkw
> > one I want to ask you for kind help on that script and review it
> > and suggest improvements.

Great work!

> I think you should implement some means of selecting which archs you
> want to plot. Preferably through some config file thing. I'd think
> of specifying per arch, and or using predefined sets, e.g. to remove
> all prefix arches, since they spoil any output with huge unreadable
> matrices.

+1.

In fact my adapted version of the /old/ eshowkw already filters
everything after the line '^# Prefix keywords$' in profiles/arch.list,
simply because the entire bunch arch.list entries makes the output
broader than what happens to be my default $COLUMNS of 87, which breaks
the layout, and because I hardly ever need to know about the prefix
keywording.

Alternatively to arch.list, the script might be capable of parsing
profiles.desc in order to establish which arches can go stable, by
using information from the first and third columns, as well as getting
the best option out of the third column, so 'stable' for an arch which
also has 'dev' or 'exp' profiles. That could be used below.

> Have you ever played with rotating the view? Some keywords are
> awfully long, like sparc64-solaris. Most versions are shorter.
> In case the number of versions is small, you could even have the
> versions in columnar style (e.g. not vertical, just a column spanning
> a couple of chars), such that it is much better readable.

+1.

> Maybe consider a raw, tab, csv alike output format, for easy parsing
> by other scripts? Could perhaps handy to render it alternatively as
> xml, latex, etc.

+1.

Combined with the arch masking option, this could easily show a package
maintainer which arches to call on a stabilisation request. All too
often an arch is forgotten or needlessly added, when a script parsing
arch.list/profiles.desc could easily sort it out and even print a list
of arch@gentoo.org aliases.


jer
 
Old 10-26-2010, 10:16 PM
Tomáš Chvátal
 
Default New eshowkw

Updated few function calls to fill empty spaces.
Thanks to Michal (mgorny) for suggestions.
Now it works a bit faster

Tomas

--- eshowkwng.py.old 2010-10-27 00:13:21.476218699 +0200
+++ eshowkwng.py 2010-10-27 00:11:33.929218700 +0200
@@ -34,32 +34,33 @@
"""Prepare list of aditional fileds displayed by eshowkw"""
return [ 'unused', 'slot' ]

- def __prepareChar(self, arch, position, count, maxlen, order = 'bottom', imp_arch = ', bold = False):
+ def __prepareChar(self, string, position, count, maxlen, imp_arch = ', order = 'bottom', bold = False):
"""Return specified character for the list position."""

# first figure out what character we want to work with
# based on order and position in the string
- char = ' '
- if order == 'bottom' and (position < maxlen) and (position >= maxlen-len(arch)):
- char = list(arch)[position-maxlen+len(arch)]
- elif order == 'top' and position < len(arch):
- char = list(arch)[position]
+ if order == 'bottom':
+ string = string.rjust(maxlen)
+ else:
+ string = string.ljust(maxlen)
+ char = list(string)[position]
+
# figure out what color we want to use
- if arch in imp_arch:
+ if string in imp_arch:
color = 'blue'
if char == ' ':
color = 'bg_lightgray'
- elif arch in self.__IMPARCHS:
+ elif string in self.__IMPARCHS:
color = 'darkyellow'
# colors
- if arch in imp_arch or arch in self.__IMPARCHS:
+ if string in imp_arch or string in self.__IMPARCHS:
char = colorize(color, char)
# bolding
if bold != False and count%2 == 0:
char = colorize('bold', char)
return char

- def __rotateContent(self, string, length, order = 'bottom', imp_arch = ', bold = False):
+ def __rotateContent(self, lister, length, imp_arch = ', order = 'bottom', bold = False):
"""
Rotate string over 90 degrees:
alpha -> a
@@ -69,21 +70,17 @@
a
"""
# join used to have list of lines rather than list of chars
- return [' '.join([self.__prepareChar(line, i, count, length, order, imp_arch, bold)
- for count, line in enumerate(string)])
+ return [' '.join([self.__prepareChar(string, i, count, length, imp_arch, order, bold)
+ for count, string in enumerate(lister)])
for i in range(length)]

def getFormatedKeywordsList(self):
"""Return the formated output as one string for printout."""
return '.join([x for x in self.__keywords_list])

- def __getVersionSpacer(self, length):
- """Generate spaces to have version string nicely aligned."""
- return '.join([' ' for i in range(length)])
-
def __prepareFormatting(self, rotated_keywords, rotated_additional, length):
"""Format result for printout as list per line of content."""
- return ['%s| %s | %s
' % (self.__getVersionSpacer(length), x, y)
+ return ['%s | %s | %s
' % ('.rjust(length), x, y)
for x, y in zip(rotated_keywords, rotated_additional)]

def __init__(self, imp_arch, version_length, order, bold):
@@ -98,10 +95,9 @@
self.keywords = self.__readKeywords()
self.keywords = self.__sortKeywords(self.keywords)
additional = self.__prepareAdditionalFields()
- keywords_maxlen = reduce(lambda x, y: (x, y)[x < y],
- [len(str) for str in self.keywords])
- rotated_keywords = self.__rotateContent(self.keywords, keywords_maxlen, order, imp_arch, bold)
- rotated_additional = self.__rotateContent(additional, keywords_maxlen, order, imp_arch, bold)
+ keywords_maxlen = len(max(self.keywords))
+ rotated_keywords = self.__rotateContent(self.keywords, keywords_maxlen, imp_arch, order, bold)
+ rotated_additional = self.__rotateContent(additional, keywords_maxlen, imp_arch, order, bold)
self.__keywords_list = self.__prepareFormatting(rotated_keywords, rotated_additional, version_length)
self.keywords_count = len(self.keywords)
self.additional_count = len(additional)
@@ -115,17 +111,16 @@
def __listRedundant(self, keywords, ignore_slots, slots):
"""List all redundant packages."""
if ignore_slots:
- return self.__getRedundantAll(keywords)
+ return self.__listRedundantAll(keywords)
else:
- return self.__getRedundantSlots(keywords, slots)
+ return self.__listRedundantSlots(keywords, slots)

- def __getRedundantSlots(self, keywords, slots):
+ def __listRedundantSlots(self, keywords, slots):
"""Search for redundant packages walking per keywords for specified slot."""
result = [self.__compareSelected([k for k, s in zip(keywords, slots)
if s == slot])
for slot in self.__uniq(slots)]
# this is required because the list itself is not just one level depth
- print '.join(result)
return list('.join(result))

def __uniq(self, seq):
@@ -139,7 +134,7 @@
result.append(item)
return result

- def __getRedundantAll(self, keywords):
+ def __listRedundantAll(self, keywords):
"""Search for redundant packages using all versions ignoring its slotting."""
tmp = keywords[:]
# this is required because the list itself is not just one level depth
@@ -196,9 +191,7 @@
class VersionChecker:
def getVersionsLength(self):
"""Get version string length."""
- # + 1 to add trailing space
- return reduce(lambda x, y: (x, y)[x < y],
- [len(str) for str in self.__versions]) + 1
+ return len(self.__versions[0])

def getVersions(self):
"""Get list of availible versions."""
@@ -211,17 +204,11 @@

def __stripStartingSpaces(self, pvs):
"""Strip starting whitespace if there is no real reason for it."""
-
if not self.__require_prepend:
- return [x[len('[M]'):] for x in pvs]
+ return [x.lstrip() for x in pvs]
else:
return pvs

- def __fillSpaces(self, string, length):
- """Fill spaces to match maximal version length."""
- spacer = '.join([' ' for i in range(length-len(string))])
- return '%s%s' % (string, spacer)
-
def __separateVersion(self, cpv):
"""Get version string for specfied cpv"""
#pv = portage.versions.cpv_getversion(cpv)
@@ -282,15 +269,17 @@
Format version string. Append trailing whitespace and
prepend information if it is masked or installed version.
"""
- pv = self.__fillSpaces(pv, self.getVersionsLength())
+ # allign package versions
+ pv = pv.rjust(self.getVersionsLength())
+
# allign the versions nicely (before colors mess lining up)
# set fontcolor on the package version if it is masked od installed
# we figure it out of the prepended string on the start of the pv
- if pv.startswith('[M][i]'):
+ if pv.find('[M][i]') != -1:
pv = colorize('darkyellow', pv)
- elif pv.startswith('[M]'):
+ elif pv.find('[M]') != -1:
pv = colorize('darkred', pv)
- elif pv.startswith('[i]'):
+ elif pv.find('[i]') != -1:
pv = colorize('bold', pv)
return pv

@@ -411,16 +400,16 @@
d = ' '
c = colorize('purple', c)
d = colorize('bold', d)
- lister.append('%s| %s | %s %s
' % (a, b, c, d))
+ lister.append('%s | %s | %s %s
' % (a, b, c, d))
return lister

def __getHorizontalSeparator(self, slots_length, pv_length, keywords_length, additional_length):
"""Create nice horizontal separator."""
- ver_sep = '.join(['-' for i in range(pv_length)])
# +1 required for additional trailing space
- arch_sep = '.join(['-' for i in range(keywords_length*2+1)])
+ ver_sep = '.ljust(pv_length+1, '-')
+ arch_sep = '.ljust(keywords_length*2+1, '-')
# -1 because it is already covered by additional_len
- add_sep = '.join(['-' for i in range(additional_length*2+slots_length-1)])
+ add_sep = '.ljust(additional_length*2+slots_length-1, '-')
return '%s+%s+%s
' % (ver_sep, arch_sep, add_sep)

def __init__(self, pkg_versions, pkg_keywords, pkg_slots, pkg_redundant, keywords_list, keywords_count, additional_count, pv_length, imp_arch, bold):
@@ -429,8 +418,7 @@
Accessable:
class.getKeywords()
"""
- slots_length = reduce(lambda x, y: (x, y)[x < y],
- [len(str) for str in pkg_slots])
+ slots_length = len(max(pkg_slots))
keywords = self.__convertKeywords(keywords_list, pkg_keywords, imp_arch, bold)
self.__horizontal_separator = self.__getHorizontalSeparator(slots_length, pv_length, keywords_count, additional_count)
self.__formated_keywords = self.__formatKeywords(pkg_versions, keywords, pkg_redundant, pkg_slots)
 
Old 10-27-2010, 10:12 AM
Duncan
 
Default New eshowkw

Krzysztof Pawlik posted on Tue, 26 Oct 2010 21:00:05 +0200 as excerpted:

> But I'm guessing - portage 2.2_rc<something_huge>, right?

Not a dev so no idea on the other, but addressing this bit...

After rc99 (AFAIK), portage-2.2_rc* series became 2.2.0_alpha* .

I have 2.2.0_alpha1 installed now, but I've not synced in a day or so.

So it might not be 2.2_rc<something_huge>,
but rather 2.2.0_alpha<something_small>.

=:^)

--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
 
Old 10-28-2010, 12:33 AM
Tomáš Chvátal
 
Default New eshowkw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok i finished my separation as i said yesterday in some of the mails so
here is the 0.5.0 version with self install script and so on

New features:
* sorting based on user decision, version or keywords can be on top
* filtering archs

Implementing additional functions should be really simple now

The package:
http://dev.gentooexperimental.org/~scarabeus/eshowkw-0.5.0.tar.xz

Please test and let me know how you like it

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzIxMUACgkQHB6c3gNBRYcwegCgp2mRlCgB5C odWQ/PssBtKLYd
iT8AniqwlSQjqHNbwCGbL4NYgjnJqQ1O
=fChi
-----END PGP SIGNATURE-----
 
Old 10-28-2010, 06:30 AM
justin
 
Default New eshowkw

On 28/10/10 02:33, Tomáš Chvátal wrote:
> Ok i finished my separation as i said yesterday in some of the mails so
> here is the 0.5.0 version with self install script and so on
>
> New features:
> * sorting based on user decision, version or keywords can be on top
> * filtering archs
>
> Implementing additional functions should be really simple now
>
> The package:
> http://dev.gentooexperimental.org/~scarabeus/eshowkw-0.5.0.tar.xz
>
> Please test and let me know how you like it
>

~/tree/sys-devel/gcc $ eshowkw
Traceback (most recent call last):
File "/usr/bin/eshowkw", line 9, in <module>
emain(sys.argv)
File "/usr/lib64/python2.6/site-packages/eshowkw/__init__.py", line
95, in main
map(lambda x: process_display(x, keywords, portdir), package)
File "/usr/lib64/python2.6/site-packages/eshowkw/__init__.py", line
95, in <lambda>
map(lambda x: process_display(x, keywords, portdir), package)
File "/usr/lib64/python2.6/site-packages/eshowkw/__init__.py", line
18, in process_display
portdata = keywords_content(package, keywords.keywords, portdir,
use_overlays, ignore_slots, order, bold, topper)
File "/usr/lib64/python2.6/site-packages/eshowkw/keywords_content.py",
line 264, in __init__
porttree = port.db[portage_root]['porttree'].dbapi
KeyError: '/home/justin/tree'
 
Old 10-28-2010, 05:25 PM
Jeroen Roovers
 
Default New eshowkw

On Thu, 28 Oct 2010 02:33:09 +0200
Tomáš Chvátal <scarabeus@gentoo.org> wrote:

> http://dev.gentooexperimental.org/~scarabeus/eshowkw-0.5.0.tar.xz

Ebuild attached.


You may want to make this slight change:

$ eshowkw-ng --help
[...]
< -P, --prefix Do not display prefix keywords in output.
(default: False)
> -P, --prefix Display prefix keywords in output.


jer
 
Old 10-28-2010, 09:33 PM
Tomáš Chvátal
 
Default New eshowkw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So now on the eshowkw is part of gentoolkit (in svn, and in next release).
If you want to test it and suggest more features/report bugs you can use
it as follows:

eshowkw [something]
equery keywords something

Cheers
Tomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzJ7BUACgkQHB6c3gNBRYfGnwCcCbCOV2LKWM tHxrd/luicjLLr
TDcAnj2xwouJjyxgh4Js6umTgeRrtIew
=rseL
-----END PGP SIGNATURE-----
 
Old 10-29-2010, 03:51 AM
Jeroen Roovers
 
Default New eshowkw

On Thu, 28 Oct 2010 23:33:09 +0200
Tomáš Chvátal <scarabeus@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> So now on the eshowkw is part of gentoolkit (in svn, and in next
> release). If you want to test it and suggest more features/report
> bugs you can use it as follows:
>
> eshowkw [something]
> equery keywords something

gentoo-x86/sci-visualization/gnuplot $ eshowkw
('%s%s', ('Ambiguous package name "gnuplot".
', "Possibilities:
[u'dev-ruby/gnuplot', u'sci-visualization/gnuplot']"))

And there's this:

gentoo-x86/mail-client/thunderbird $ cvs up
jer@bastiaan gentoo-x86/mail-client/thunderbird $ echo jerwashere >> thunderbird-3.1.6.ebuild
jer@bastiaan gentoo-x86/mail-client/thunderbird $ eshowkw
* Digest verification failed:
* gentoo-x86/mail-client/thunderbird/thunderbird-3.1.6.ebuild
* Reason: Filesize does not match recorded size
* Got: 7688
* Expected: 7677
Failed to obtain metadata
(paths abbreviated)

I can work around this problem by running repoman manifest or similar,
only I don't see why that should be required.


jer
 
Old 10-29-2010, 07:55 AM
Tomáš Chvátal
 
Default New eshowkw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 29.10.2010 05:51, Jeroen Roovers napsal(a):
> On Thu, 28 Oct 2010 23:33:09 +0200
> Tomáš Chvátal <scarabeus@gentoo.org> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> So now on the eshowkw is part of gentoolkit (in svn, and in next
>> release). If you want to test it and suggest more features/report
>> bugs you can use it as follows:
>>
>> eshowkw [something]
>> equery keywords something
>
> gentoo-x86/sci-visualization/gnuplot $ eshowkw
> ('%s%s', ('Ambiguous package name "gnuplot".
', "Possibilities:
> [u'dev-ruby/gnuplot', u'sci-visualization/gnuplot']"))
>
> And there's this:
>
> gentoo-x86/mail-client/thunderbird $ cvs up
> jer@bastiaan gentoo-x86/mail-client/thunderbird $ echo jerwashere >> thunderbird-3.1.6.ebuild
> jer@bastiaan gentoo-x86/mail-client/thunderbird $ eshowkw
> * Digest verification failed:
> * gentoo-x86/mail-client/thunderbird/thunderbird-3.1.6.ebuild
> * Reason: Filesize does not match recorded size
> * Got: 7688
> * Expected: 7677
> Failed to obtain metadata
> (paths abbreviated)
>
> I can work around this problem by running repoman manifest or similar,
> only I don't see why that should be required.
>
>
> jer
>
It uses portage porttree.dbapi, so it generates metadata cache if not
availible -> It requires proper manifest to do so

Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzKfdcACgkQHB6c3gNBRYcnFwCgqWim1aherG 0E2ykyzWWuMT+B
NZIAoKkTUUc05VB94frhtKOMLvXLBCgc
=aCSv
-----END PGP SIGNATURE-----
 

Thread Tools




All times are GMT. The time now is 06:58 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org