Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 413577

Summary: app-portage/gentoolkit: eread - provide basic sorting options
Product: Portage Development Reporter: Sławomir Nizio <slawomir.nizio>
Component: ToolsAssignee: Portage Tools Team <tools-portage>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: PATCH
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 346443    
Attachments: patch for eread (script and manual page)
patch for eread (script and manual page)
patch for eread (script and manual page)

Description Sławomir Nizio 2012-04-25 22:50:17 UTC
The fact that eread displays elog files unsorted makes it less friendly to use. I will attach a patch proposal to fix it.
In fact, eread is a simple script which can be extended virtually to infinity and made bloated, but what I propose are only small changes that provide a way to sort its output: by alphabet or by date. I think it improves its usability quite much.
The commands/keys are 'a' and 't' which is similar to elogv.
Sorting order can be changed from environment. I'm not sure it'd be fine and not sure the name EREAD_SORT_ORDER obeys some convention, but it can be changed easily.
Sorting relies on two additional utilities: sort and awk. By default no sorting is performed, so the script will work without error even if for some reason any of the mentioned tools aren't available. No default sorting also means no additional CPU processing by default. :)

Sorting by date relies on how file name is made. I suppose it's "standardized", won't be changed easily so I think it's OK (otherwise a few other tools would break…).

If you find it useful I'll be happy to see it included. If you think the added "Updated by" field isn't appropriate, feel free to rm -rf it.

Reproducible: Always
Comment 1 Sławomir Nizio 2012-04-25 22:52:59 UTC
Created attachment 310121 [details, diff]
patch for eread (script and manual page)
Comment 2 Sławomir Nizio 2012-04-25 23:01:59 UTC
Created attachment 310123 [details, diff]
patch for eread (script and manual page)

better wording
Comment 3 Sławomir Nizio 2012-04-25 23:13:18 UTC
Hmm, files whose names don't follow the convention c:p:date* are skipped in sort by time is selected. I think it's unexpected and bad and I'll fix it.
Comment 4 Sławomir Nizio 2012-04-26 01:19:07 UTC
Created attachment 310131 [details, diff]
patch for eread (script and manual page)

Now the requirement on awk is gone. Uses -k and -t options with sort which seems to be portable.
Comment 5 Paul Varner (RETIRED) gentoo-dev 2012-04-26 03:35:18 UTC
eread is intended to be simple.  However, I do like the changes and they have been committed and pushed to the repository.

http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=a6a159cd3f8c8a89eccbba57689623a747fea73f
Comment 6 Paul Varner (RETIRED) gentoo-dev 2012-05-09 20:46:31 UTC
Released in gentoolkit-0.3.0.6-r1