Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 771075 - app-admin/eselect: news module should be able to list only unread news
Summary: app-admin/eselect: news module should be able to list only unread news
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2021-02-17 09:22 UTC by Till Schäfer
Modified: 2021-12-28 09:44 UTC (History)
1 user (show)

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


Attachments
eselect-news.patch (eselect-news.patch,1.40 KB, patch)
2021-02-17 12:13 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Till Schäfer 2021-02-17 09:22:55 UTC
The count and read action of the news module of app-admin/eselect already support parameters to distinguish between all and new news items. I propose to add this ability to the list action as well.

For example, this is useful when showing the news items in an update script or on shell login. 

I also think, that most ppl are only interested in the actual new news when calling the list action. Thus, the new parameter might also be set as default. 

Reproducible: Always
Comment 1 Ulrich Müller gentoo-dev 2021-02-17 12:13:26 UTC
Created attachment 687252 [details, diff]
eselect-news.patch

That's a simple change. Please test attached patch.
Comment 2 Ulrich Müller gentoo-dev 2021-02-17 12:19:56 UTC
(In reply to Till Schäfer from comment #0)
> I also think, that most ppl are only interested in the actual new news when
> calling the list action. Thus, the new parameter might also be set as
> default. 

That's not going to happen, for reasons of consistency between modules. By the eselect developer guide, the list action lists all available items.
Comment 3 Till Schäfer 2021-02-19 08:25:59 UTC
The patch works as expected. Thanks for the fast solution!

I was wondering if instead of skipping unread items in the loop the line 
  set -- $(find_items unread read)
could be just adjusted to only find unread items in the first place. Am I missing something here? Is the numbering a problem in this case?
Comment 4 Larry the Git Cow gentoo-dev 2021-02-19 13:33:11 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/eselect.git/commit/?id=74aa11482d3ab7cdbe44b85027e5b8c20ce82bb4

commit 74aa11482d3ab7cdbe44b85027e5b8c20ce82bb4
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-02-19 13:31:07 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-02-19 13:31:07 +0000

    news.eselect: Support "new" and "all" options in list action
    
    * modules/news.eselect (do_list): Recognise "new" and "all"
    options, bug 771075.
    (describe_list_options): New function.
    
    Bug: https://bugs.gentoo.org/771075
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 ChangeLog            |  6 ++++++
 modules/news.eselect | 21 +++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)
Comment 5 Ulrich Müller gentoo-dev 2021-02-19 13:40:33 UTC
(In reply to Till Schäfer from comment #3)
> The patch works as expected. Thanks for the fast solution!

Pushed to git. It may take some time until I'll make a new release. Feel free to ping again if that won't have happened by mid of March.

> I was wondering if instead of skipping unread items in the loop the line 
>   set -- $(find_items unread read)
> could be just adjusted to only find unread items in the first place. Am I
> missing something here? Is the numbering a problem in this case?

That would list the first unread item as 1, and so on. The problem is that the read action doesn't know if the preceding list action was for all items or only for the new items (because eselect is stateless). Therefore we need the address in the complete list.
Comment 6 Ulrich Müller gentoo-dev 2021-12-28 09:44:28 UTC
Fixed in eselect-1.4.18.