Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 671936 - app-eselect/eselect-timezone Improvement
Summary: app-eselect/eselect-timezone Improvement
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Lowest enhancement (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-26 08:49 UTC by Ethan Kiang
Modified: 2023-03-05 06:26 UTC (History)
2 users (show)

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


Attachments
The eselect file I wrote (timezone.eselect,5.48 KB, text/plain)
2018-11-26 08:49 UTC, Ethan Kiang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ethan Kiang 2018-11-26 08:49:59 UTC
Created attachment 556276 [details]
The eselect file I wrote

Hi,

I have recently written an eselect timezone module.
https://github.com/zyklotomic/gentoo-utils
I had thought there were none that existed since during the timezone configuration process of my installs, it was not mentioned in the handbook. However, I learned app-eselect/eselect-timezone-0.2 already exists.

Nonetheless, I think my version is a slight improvement featurewise. However, it is definitely lacking in code quality due to my inexperience with bash. My version does work in its current from though.

The biggest improvement is nested-index selection.

In the existing eselect-timezone, eselect timezone list outputs all 500+ available timezones.
In my version, you navigate with nested-indices. For example, 2 refers to America/ and within
America/, 95 refers to New_York, so eselect timezone set 2-95 sets America/New_York as the timezone. You can also list all available timezones with eselect timezone list all if desired.

Furthermore, in the existing version, indices don't show if you narrow down with
eselect timezone list <literal-directory>. My version does though.


Thank you!
Best,
Ethan Kiang
Comment 1 Ethan Kiang 2018-12-15 07:00:07 UTC
Hi,

I'm not sure what are the next steps to move along in this improvement bug.
What should I do? I know that my current code is not up to quality, it merely works.

Best,
Ethan
Comment 2 Ulrich Müller gentoo-dev 2018-12-15 10:04:52 UTC
Let's not bypass the maintainer of the package, but give him some more time to reply.

I have set a deadline at end of December (i.e., one month after filing of this bug). If there's no reply until then, we can see how to proceed.
Comment 3 Christoph Junghans (RETIRED) gentoo-dev 2018-12-15 13:10:07 UTC
Sorry for the delay, I forgot I wrote eselect-timezone.

Regarding nested indexing, you can do "eselect timezone list America/" in the current version as well and then use the name e.g. "eselect timezone set America/Virgin".
Comment 4 Ethan Kiang 2018-12-15 18:14:53 UTC
Ah, sorry, I wasn't aware we were waiting for the maintainer. I thought I had done something wrong.

Yeah, the only minor improvement is that you can access via index, for directories too, with my version.
Comment 5 Ethan Kiang 2018-12-15 18:16:01 UTC
Edit: I meant numerical indexing, for example

$ eselect timezone list 40
Available timezone selections:
Directory: /usr/share/zoneinfo/Mexico
  [40-1]   BajaNorte
  [40-2]   BajaSur
  [40-3]   General

# eselect timezone set 40-1
Comment 6 Christoph Junghans (RETIRED) gentoo-dev 2018-12-16 00:54:02 UTC
(In reply to Ethan Kiang from comment #5)
> Edit: I meant numerical indexing, for example
> 
> $ eselect timezone list 40
> Available timezone selections:
> Directory: /usr/share/zoneinfo/Mexico
>   [40-1]   BajaNorte
>   [40-2]   BajaSur
>   [40-3]   General
> 
> # eselect timezone set 40-1

I don't have any time to maintain an enhanced version of eselect-timezone, so either you try to promote this as a different package, e.g. eselect-timezone-ng or take over the maintainership of eselect-timezone (with proxy maintainer).
Comment 7 Ulrich Müller gentoo-dev 2018-12-16 10:52:41 UTC
(In reply to Ethan Kiang from comment #5)
> Edit: I meant numerical indexing, for example
> 
> $ eselect timezone list 40
> Available timezone selections:
> Directory: /usr/share/zoneinfo/Mexico
>   [40-1]   BajaNorte
>   [40-2]   BajaSur
>   [40-3]   General
> 
> # eselect timezone set 40-1

These combined indexes are inconsistent with what is used throughout the rest of eselect, and they break backwards compatibility with the existing module.

Since the existing module already has the filter functionality, it should be relatively easy to modify it to output something like this:

# eselect timezone list Mexico
Available timezones:
  [516] Mexico/BajaNorte
  [517] Mexico/BajaSur
  [518] Mexico/General
# eselect timezone set 516

AFAICS, find_targets() would always have to return the full list for that, and do_list() would only output those entries that match the base dir.
Comment 8 Christoph Junghans (RETIRED) gentoo-dev 2018-12-16 20:15:36 UTC
Basically we need apply the filter after write_numbered_list() generated the numbered target list output. Back when I wrote this module, I couldn't think of a non-hackish way to do that and as selection by name is always possible I thought the index feature wasn't very important.
Comment 9 Ethan Kiang 2018-12-16 21:48:33 UTC
Yup, handling the indices were a challenge when I was writing the module. I was unaware of Christoph's module when I wrote mine. I will look into his first too.
Comment 10 Ulrich Müller gentoo-dev 2018-12-17 11:00:59 UTC
(In reply to Christoph Junghans from comment #8)
> Basically we need apply the filter after write_numbered_list() generated the
> numbered target list output. Back when I wrote this module, I couldn't think
> of a non-hackish way to do that

Yeah, you cannot do this in any sane way with write_numbered_list(). You could call write_numbered_list_entry() directly, though.

> and as selection by name is always possible I thought the index feature
> wasn't very important.

I agree, it would be nice to have but it is not essential.