summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* meson.build: prepare for gentoo-functions-1.7.3HEADgentoo-functions-1.7.3masterSam James2024-10-051-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meosn.build: prepare for gentoo-functions-1.7.2gentoo-functions-1.7.2Sam James2024-08-111-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: avoid passing an absolute path to install_subdir()Kerin Millar2024-08-111-1/+1
| | | | | | | | | | Otherwise, some of the files end up outside of EPREFIX. Fixes: 2a58c0e462538b7fb2d12cd95157a9aaf2b7f7ff Bug: https://bugs.gentoo.org/937463 Reported-by: Fabian Groffen <grobian@gentoo.org> Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.7.1gentoo-functions-1.7.1Sam James2024-08-051-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.7gentoo-functions-1.7Sam James2024-08-051-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* Render gentoo-functions modular in natureKerin Millar2024-06-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For many years, the implied purpose of gentoo-functions has been to provided parallel implementations of utilities provided by OpenRC, along with a handful of peripheral functions. It is probably also fair to say that it has not seen much in the way of maintenance until comparatively recently. As of the present day, the status quo is not ideal. For one thing, the library has never been particularly useful beyond this definition. It is my hope that some of the recently added functions will be well received by those needing to write effective shell scripts in Gentoo for a number of relevant tasks. Certainly, there remains ample room for improvement in that regard. For another thing, the implementation of gentoo-functions is presently inflexible. For instance, it is impossible to source the functions from an OpenRC runscript without overriding the OpenRC implementations. Nor may one source the functions from an ebuild or eclass without overriding the Portage implementations. Indeed, it is has become something of a mess. Not only does gentoo-functions implement a number of functions that shadow the OpenRC implementations but so does Portage, owing to the existence of its "isolated-functions.sh" unit. What's more, the various implementations are of varying quality and do not necessarily behave in the same manner. This commit aims to address some of these issues by rendering gentoo-functions modular in nature. It establishes the premise of having a core library, with collections of additional functions being optionally declarable. As such, all of the functions that shadow OpenRC have been relocated to a unit named "rc.sh". This first change encompasses the following public functions: - ebegin - eend - eerrorn - eindent - einfon - eoutdent - esyslog - ewarnn - ewend - get_bootparam - is_older_than - veend - vewend - yesno Similarly, all of the functions that exclusively shadow Portage have been relocated to a unit named "portage.sh". This second change encompasses the following public functions: - die - edo - eqatag - eqawarn The functions that remain in the "functions.sh" unit may now be considered as core functions. To accommodate all of this, a new GENFUN_MODULES variable is supported, whose behaviour is described herewith. If GENFUN_MODULES is found to be set at the time of "functions.sh" being sourced, it shall be taken as a list of zero or more blank-separated words. In turn, these words shall be taken as the basenames of potentially available modules - not including the .sh suffix. Presently, the only supported module names are "rc" and "portage". Should either or both of these names be present, their respective units shall be automatically sourced. If neither are present, no additional units shall be sourced. Consequently, it becomes possible for a consumer of gentoo-functions to request that only the core functions be declared by writing: GENFUN_MODULES= . /lib/gentoo/functions.sh If, on the other hand, GENFUN_MODULES is found not to be set then heuristics shall be employed to determine which of the additional units should be sourced. The intent of these heuristics is twofold. Firstly, to maintain an adequate degree of backward-compatibility and, secondly, to act as is appropriate based on the characteristics of the operating environment. The exact behaviour of these heuristics is as follows. If the present shell is neither executing a runscript nor a subprocess of one, the ensuing behaviour shall be as if "rc" had initially been among the names defined by the GENFUN_MODULES variable. If the present shell is not a subprocess of portage, the ensuing behaviour shall be as if "portage" had initially been among the names defined by the GENFUN_MODULES variable. Signed-off-by: Kerin Millar <kfm@plushkava.net>
* meson.build: prepare for gentoo-functions-1.6gentoo-functions-1.6Sam James2024-05-241-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.5gentoo-functions-1.5Sam James2024-05-181-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.4gentoo-functions-1.4Sam James2024-05-181-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.3gentoo-functions-1.3Sam James2024-05-181-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.2gentoo-functions-1.2Sam James2024-05-151-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: prepare for gentoo-functions-1.1gentoo-functions-1.1Sam James2024-05-141-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: fix testsSam James2024-05-141-1/+1
| | | | | Fixes: ea4fb2a1e34900635d0db7bd1d8e5e1bea06ced0 Signed-off-by: Sam James <sam@gentoo.org>
* Drop ecma48-cprSam James2024-05-141-7/+0
| | | | | | | Obsolete as of bfd5710de9b14712c4a621259b951bd10489d0c0. A neat tool, but it ended up not being a good fit for the reasons described in that commit. Signed-off-by: Sam James <sam@gentoo.org>
* Cleanup functions.sh.in templateSam James2024-05-141-12/+2
| | | | | | No longer needed since bfd5710de9b14712c4a621259b951bd10489d0c0. Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: add TODO wrt cleaning up functions.sh templateSam James2024-05-141-0/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: crank version to 1.0gentoo-functions-1.0Sam James2024-02-161-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* test-functions: Really fix non-conforming TAP outputKerin Millar2023-06-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | The previous "fix" was an experimental patch that was not yet intended for inclusion. This supplemental commit does as little as is necessary to render the test suite properly functional under meson, given that meson.build has been configured to expect the use of the TAP protocol. It also configures meson to be verbose while executing the test suite. As far as I can gather, the TAP support in meson is weak. Subtests do not appear to be supported. For that reason, I have dropped the TAP version from 14 to 13. While meson recognises "# SKIP" as a directive, it does not report the reason that may follow the text. Another issue is that no controlling terminal is present under meson. Therefore, test_update_cursor_coords() is rendered useless, for it will always be skipped. I have left the test in for the time being, in the hope that there may yet be a solution. In any case, this should be enough to render the -9999 ebuild both testable and usable. Signed-off-by: Kerin Millar <kfm@plushkava.net>
* meson.build: Use the TAP protocol for running the testsKerin Millar2023-06-101-0/+1
| | | | Signed-off-by: Kerin Millar <kfm@plushkava.net>
* meson.build: drop libexecdir for nowSam James2023-06-091-2/+4
| | | | | | | | | | Right now, I don't think there's much benefit for putting the ecma tool in libexecdir given it's in /usr and everything assumes functions.sh is at /lib/gentoo/functions.sh - i.e. it unnecessarily breaks split-usr. Maybe we can just add some symlinks later though. Signed-off-by: Sam James <sam@gentoo.org>
* meson.build: fix running tests out of sourceSam James2023-06-091-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* Port to MesonSam James2023-06-091-0/+48
... yielding ``` /tmp/destdir └── usr └── local ├── bin │   └── consoletype ├── lib │   └── gentoo │   └── functions.sh ├── libexec │   └── gentoo │   └── ecma48-cpr └── share └── man └── man1 └── consoletype.1 11 directories, 4 files ``` Signed-off-by: Sam James <sam@gentoo.org>