Name: janet-wrk Version: 0.1.0 # janet/ has no version of its own, so a cli/ or systemd.janet change needs a # manual Release bump here or master's NVR-skip publishes nothing. Release: 1%{?dist} Summary: Janet modules shared by this monorepo's tools License: AGPL-3.0-or-later URL: https://github.com/kalkin/monorepo # In-repo source (janet/): pkgs/rpm/source-archive snapshots the tracked tree # into this tarball at srpm time — see the `source-dir` marker. Source0: %{name}-%{version}.tar.gz # Pure janet, but %%{_libdir}/janet is arch-specific, so this cannot be noarch. %global debug_package %{nil} # The floor is what selects the COPR janet: Fedora's own is 1.35, older than # the source these modules are written against. No ceiling, unlike # janet-spork, which needs one because it ships natives janet refuses to load # outside a one-release window. Plain source modules have no such window. BuildRequires: janet >= 1.42.0 BuildRequires: janet-spork Requires: janet%{?_isa} >= 1.42.0 # cli/init.janet imports spork/path, so this is direct, not transitive. Requires: janet-spork%{?_isa} %description Two janet modules used by the command-line tools in this monorepo. `cli` declares a command's arguments, options and help text, and answers zsh's completion requests for it at runtime. `systemd` builds the systemd-run and sd_notify calls a daemon needs. Both install into janet's module search path and are imported by their bare names. %prep %autosetup -n %{name}-%{version} %build # Pure janet — nothing to compile. # # A janet that moved the syspath must red the build rather than ship a # package its own loader cannot find. janet -e '(def p (dyn :syspath)) (assert (= p "%{_libdir}/janet") (string "janet syspath moved to " p))' %install install -d %{buildroot}%{_libdir}/janet/cli install -pm0644 cli/*.janet %{buildroot}%{_libdir}/janet/cli/ install -Dpm0644 systemd.janet %{buildroot}%{_libdir}/janet/systemd.janet # project.janet is a janet-pm manifest that only evaluates inside janet-pm's # own environment. The glob above installs it, so it is removed here rather # than excluded from the glob. rm %{buildroot}%{_libdir}/janet/cli/project.janet # The only importer of cli/zsh.janet. Without it the shipped zsh module is # unreachable and an installed user has no way to generate a completion. Its # ./init and ./zsh imports resolve beside it here. install -pm0755 cli/completion %{buildroot}%{_libdir}/janet/cli/completion %check # Proves the %%files set is complete, which `rpm -qlp` cannot: a missing # cli/parser.janet would list fine and still fail to import. # # The staged tree is prepended to module/paths rather than pinned with # JANET_PATH, because JANET_PATH replaces the syspath outright and # cli/init.janet imports spork/path, which lives there. Measured: pinning # reds with "could not find module spork/path". # # Each module's resolved path is checked before the import, so an incomplete # payload cannot fall through to a janet-wrk already installed on the build # host and pass without reading what was just built. # # cli/zsh is named separately because importing cli does not reach it: its # only importer is cli/completion, which is a script rather than a module and # so is never imported by the probe. Drop it from the list and a broken # zsh.janet ships green again. # The filter matters here for the same reason it does in # werker/shared/modpath.janet: an unfiltered entry is consulted ahead of every # default for RELATIVE imports too, so cli/init.janet's own (import ./parser) # would resolve to /parser.janet. Measured. janet -e '(def root "%{buildroot}%{_libdir}/janet") (defn- bare? [name] (not (or (string/has-prefix? "." name) (string/has-prefix? "/" name)))) (array/insert module/paths 0 [(string root "/:all:/init.janet") :source bare?]) (array/insert module/paths 0 [(string root "/:all:.janet") :source bare?]) (each m ["cli" "cli/zsh" "systemd"] (def found (module/find m)) (def p (and found (first found))) (unless (and p (string/has-prefix? (string root "/") p)) (error (string m " did not resolve from the staged tree, got: " p)))) (import cli) (import cli/zsh) (import systemd)' # The probe above imports modules only. Rendering the generator's own # completion from the staged tree, with the cwd outside it, proves the script # itself loads and spawns its child. test "$(cd / && janet %{buildroot}%{_libdir}/janet/cli/completion \ %{buildroot}%{_libdir}/janet/cli/completion | head -n 1)" \ = "#compdef completion" %files %license COPYING %doc cli/README.md %{_libdir}/janet/cli/ %{_libdir}/janet/systemd.janet %changelog * Wed Sep 30 2026 Bahtiar `kalkin-` Gadimov - 0.1.0-1 - Initial package of the in-repo janet cli and systemd modules