Gentoo Archives: gentoo-soc

From: "Yuan Liao (Leo)" <liaoyuan@×××××.com>
To: gentoo-soc@l.g.o
Subject: [gentoo-soc] Week 7 Report for Big Data Infrastructure and H2O ebuilds Project
Date: Mon, 26 Jul 2021 07:17:47
Message-Id: CACk4dks1cFHEt-MidXBMxB3=_sYa8M0Mj685-DVZeUixdfrL+A@mail.gmail.com
1 Hi folks,
2
3 Another week has just passed. I have been gradually moving on to the next
4 part of my project where I would fix the ebuilds in the Spark overlay that
5 are no longer installable, most of which are caused by changes to ebuilds
6 in the Gentoo repository since last year's GSoC concluded. At the same
7 time, a few additional utilities supporting Kotlin on Gentoo have been
8 created, including an eselect module for Kotlin [1] and some new Kotlin
9 eclasses.
10
11 Many ebuilds in the Spark overlay depend on packages in ::gentoo, but some
12 dependencies have been broken due to removal of old slots or even deletion
13 of packages that were really too old. In the former case, the dependency
14 could be quickly fixed by updating the slot, although the dependee package
15 would require some integration tests with the dependency's new slot. In
16 the latter case, I would restore the removed ebuild from the Git history of
17 ::gentoo and add it to the Spark overlay. This is probably not the best
18 resolution, but as the number of packages in the Spark overlay may suggest,
19 Apache Spark is a complicated program whose dependency graph spans hundreds
20 of libraries, so recreating each ebuild removed from ::gentoo from scratch
21 might take too much time. However, the ebuilds were not restored
22 willy-nilly. ebuilds that used EAPI 5 were ported to EAPI 7, the latest
23 EAPI supported by the Java eclasses in ::gentoo. There was an ebuild whose
24 upstream had been gone and whose SRC_URI was no longer accessible, and I
25 managed to find a source JAR containing the package's source code on Maven
26 Central and updated the ebuild to use it instead.
27
28 At this point, the next package that needs to be fixed is dev-java/okio,
29 which is a package containing Kotlin sources and thus should be built with
30 a Kotlin compiler. Although my knowledge on Kotlin version compatibility
31 is limited, I believe there can be situations where a package must be built
32 by certain versions of the Kotlin compiler. This, plus fordfrog's interest
33 in allowing users to keep multiple Kotlin versions in parallel, motivated
34 me to think about how to implement support for multiple Kotlin compilers.
35 On Gentoo, the obvious solution to this problem is to create an eselect
36 module, but that would only allow coarse-grained system-wide control;
37 chances are some packages require Kotlin 1.4 whereas others need Kotlin
38 1.5, thus the Kotlin version must be set independently for each individual
39 package. For many other programming languages supported by Gentoo,
40 including Lua, PHP, Python and Ruby, there are USE_EXPAND variables that
41 can be used for this purpose, but such an approach would not work for
42 Kotlin yet because USE_EXPAND is defined in Portage profiles, which I have
43 no power to influence. As a workaround, I created a new
44 kotlin-utils.eclass, added a variable that would allow ebuild developers to
45 define either a single Kotlin version or an open interval of versions
46 required by the package, and declared another variable for the order of
47 preference on the accepted versions. The eclass can search for all Kotlin
48 versions installed on the system and pick the best one according to the
49 preference which satisfies any hard requirement. This would still
50 compromise the end users' ability to select the Kotlin version used to
51 build a package, but at least it could allow the ebuild developers to make
52 a sensible choice for the users.
53
54 Support for selecting a Kotlin version from ebuilds is provided by
55 kotlin-utils.eclass, and the functionality to choose a Kotlin compiler for
56 the user-space is shipped with the Kotlin eselect module. The module has a
57 superset of features offered by the java-vm eselect module. It implements
58 not only the notion of user and system compiler but also compiler
59 preference settings for each Kotlin feature release version. This feature
60 is provisioned for any alternative Kotlin compiler packages in the future,
61 like dev-lang/kotlin with the "-bin" suffix dropped. For instance, if
62 users have installed both dev-lang/kotlin:1.5 and dev-lang/kotlin-bin:1.5,
63 then by using the Kotlin eselect module, they can control whether they want
64 to use dev-lang/kotlin or dev-lang/kotlin-bin for Kotlin 1.5. It will be
65 possible to use different Kotlin compiler packages for different feature
66 releases too, so users can select dev-lang/kotlin:1.4 and
67 dev-lang/kotlin-bin:1.5 at the same time.
68
69 The version-specific Kotlin compiler preferences are recognized by both
70 kotlin-utils.eclass and a set of versioned executables for Kotlin tools.
71 Similar to commands like lua5.4, python3.9 and ruby26, versioned Kotlin
72 commands like kotlin1.4 and kotlinc1.5 are installed with the Kotlin
73 compiler packages and supported by the Kotlin eselect module. With these
74 versioned commands, users can quickly switch to another Kotlin version
75 without even invoking eselect. The versioned commands are not standard in
76 the Kotlin compiler Zip archive distributed by the upstream (which is what
77 other distributions' Kotlin packages usually depend on): they are exclusive
78 on Gentoo, so I hope they will convince any GNU/Linux users who would like
79 to install multiple Kotlin versions via the system package manager to
80 consider using Gentoo.
81
82 The new kotlin-utils.eclass, the Kotlin eselect module and some additional
83 Kotlin eclasses are still being tested. They are working delightfully as
84 of now, and I am trying to capture more issues and bugs before announcing
85 and releasing them to more users. I sincerely hope that these utilities
86 can form a robust framework for Kotlin packages and programs on Gentoo.
87
88 Best regards,
89 Leo
90
91 [1]: https://github.com/Leo3418/eselect-kotlin