• [gentoo-dev] [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_d

    From Sam James@21:1/5 to All on Fri Jul 14 10:40:02 2023
    From: konsolebox <konsolebox@gmail.com>

    Closes: https://bugs.gentoo.org/909529
    Signed-off-by: Sam James <sam@gentoo.org>
    ---
    eclass/ruby-utils.eclass | 52 ++--------------------------------------
    1 file changed, 2 insertions(+), 50 deletions(-)

    diff --git a/eclass/ruby-utils.eclass b/eclass/ruby-utils.eclass
    index c4b6f1502f8a9..8a2b7720c951a 100644
    --- a/eclass/ruby-utils.eclass
    +++ b/eclass/ruby-utils.eclass
    @@ -44,57 +44,9 @@ _ruby_implementation_depend() {
    local rubyslot=

    case $1 in
    - ruby18)
    + ruby1[89]|ruby2[0-7]|ruby3[0-2])
    rubypn="dev-lang/ruby"
    - rubyslot=":1.8"
    - ;;
    - ruby19)
    - rubypn="dev-lang/ruby"
    - rubyslot=":1.9"
    - ;;
    - ruby20)
    - rubypn="dev-lang/ruby"
    - rubyslot=":2.0"
    - ;;
    - ruby21)
    - rubypn="dev-lang/ruby"
    - rubyslot=":2.1"
    - ;;
    - ruby22)
    - rubypn="dev-lang/ruby"
    - rubyslot=":2.2"
    - ;;
    - ruby23)
    - rubypn="dev-lang/ruby"
    - rubyslot=":2.3"
    - ;;
    - ruby24)
    - rubypn="dev-lang/ruby"
    - rubyslot=":2.4"
    - ;;
    - ruby25)
    - rubypn="dev-lang/ruby"
    - rubyslot=":2.5"
    - ;;
    - ruby26)
    - rubypn="dev-lang/ruby"
    -
  • From Sam James@21:1/5 to Sam James on Fri Jul 14 10:40:02 2023
    Sam James <sam@gentoo.org> writes:

    From: konsolebox <konsolebox@gmail.com>

    Closes: https://bugs.gentoo.org/909529
    Signed-off-by: Sam James <sam@gentoo.org>

    ftr, while I find the case really repetitive, I'm not sure if this
    crosses the line into unreadable bash or not, so I feel on the fence.

    But I wanted it reviewed on ML in any case, rather than us forgetting
    it on BZ.


    -----BEGIN PGP SIGNATURE-----

    iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZLEJkl8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZCPoAD+I9Px7+2/FSzbrZ7I5fwzHav+6pjGL1tzRHZE rVd3QOkBAJSbi9xlheTSh6DuhF7OsRALB2f+ZAyUPf59KkJ8+hgF
    =sSGE
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans de Graaff@21:1/5 to Sam James on Fri Jul 14 18:20:01 2023
    On Thu, 1970-01-01 at 00:00 +0000, Sam James wrote:

    Sam James <sam@gentoo.org> writes:

    From: konsolebox <konsolebox@gmail.com>

    Closes: https://bugs.gentoo.org/909529
    Signed-off-by: Sam James <sam@gentoo.org>

    ftr, while I find the case really repetitive, I'm not sure if this
    crosses the line into unreadable bash or not, so I feel on the fence.

    I don't have a strong preference either way. We only need to change
    this once a year anyway.

    Perhaps not having the large case statement makes the whole file a bit
    more readable at the expense of a more difficult expression.

    Hans

    -----BEGIN PGP SIGNATURE-----

    iQEzBAABCAAdFiEEIggVRmJzp0YePtgn2zR/k4ZU+jQFAmSxdOcACgkQ2zR/k4ZU +jSwmggAn5FcahnuB1nhjVWCbQtH3WMa/lyXhDJOEWuIGifibBi04xjinf3cVQq7 PbPVyKENNXRgPDgHYHjNc3rYtiUFxXzYEQxY5iCM5jLKeOmnqhYEH6sHYMokVC73 JAPLhbMBd4KIRq5BhlEW/d6jr/2Gey5CtRBPaOVEXE+93SGcCmfyoABM5PO/6Rc+ ttQ00kIl4AZKVul+uovfLdDEUpRvO5sn5PQ/6xbLIRkmFvPUD1KgzlcT0h+keJ8f dEbRxdrT9dC1LpnSlvzWarbnpedYv1VP2h7ESX7op9c7SlAY6lD3FIeuTm3+0v74 fzOhtvMpeswAs/ilnvOv6e35XJKSJw==
    =aSnr
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arthur Zamarin@21:1/5 to Sam James on Fri Jul 14 18:20:01 2023
    To: sam@gentoo.org (Sam James)

    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------8vzbZVxoNfjH1X5oVldiWIN9
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: quoted-printable

    On 14/07/2023 11.37, Sam James wrote:

    Sam James <sam@gentoo.org> writes:

    From: konsolebox <konsolebox@gmail.com>

    Closes: https://bugs.gentoo.org/909529
    Signed-off-by: Sam James <sam@gentoo.org>

    ftr, while I find the case really repetitive, I'm not sure if this
    crosses the line into unreadable bash or not, so I feel on the fence.

    But I wanted it reviewed on ML in any case, rather than us forgetting
    it on BZ.


    I agree the code isn't easy to read, but it isn't too hard. I do want to suggest you add a simple comment on the same line bringing an example
    value for the rubyslot. With an example comment, it becomes trivial to understand (and if someone needs to change it, he know beforehand what
    format to expect).

    --
    Arthur Zamarin
    arthurzam@gentoo.org
    Gentoo Linux developer (Python, pkgcore stack, Arch Teams, GURU)


    --------------8vzbZVxoNfjH1X5oVldiWIN9--

    -----BEGIN PGP SIGNATURE-----

    iQEzBAEBCgAdFiEE/axFlFuH2ptjtO5EAqCvUD0SBQQFAmSxdYYACgkQAqCvUD0S BQTnfwf/ZsmdV6dvs0oEHTpYc/Vrk67YIGUZTa55fqZNCplcvujdobwegFCBTsGJ VoJ8Py2VPLuHXlAIX/PO9vHSvwsBxFKG4Stm0tdmVtyfC0N8RzK/zpvE9qsnACbQ CPE6u+oADa5r9aVSrQZ7wz7dcD2atappdPHaANPzxRDsixNKbWo/4Jgg6+WE58AF HnMCEbOv8YUFuMm8lumZwv1NmbdPrFls/sqW0C4TyZatLkUaX/E+ud6MBGLyLcaH Bqw+58iKHJoyDsK1p4YB4ufMt7lhYMuuARxIcil+ZI5dF8Yo+j/NP4ZLhJyDH7kO a6GKIkYn6BDb1mkcXKiW1ybMBGghsg==
    =xGF0
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)