public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Peter Lemenkov <lemenkov@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/erlang] rawhide: Generate erlang(erl_drv_version) and erlang(erl_nif_version)
Date: Thu, 05 Nov 2026 23:02:15 GMT	[thread overview]
Message-ID: <179391973525.1.14947839886984978679.rpms-erlang-2ebcf3f3d332@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/erlang
            Branch : rawhide
            Commit : 2ebcf3f3d332c3a32f28fdf2297aeb5ab09132ea
            Author : Peter Lemenkov <lemenkov@gmail.com>
            Date   : 2026-11-05T23:59:44+01:00
            Stats  : +29/-9 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/erlang/c/2ebcf3f3d332c3a32f28fdf2297aeb5ab09132ea?branch=rawhide

            Log:
            Generate erlang(erl_drv_version) and erlang(erl_nif_version)

The escript gets an --abi mode that prints both versions from
erlang:system_info/1. Hooked to beam.smp as a second spec-local file
attribute, it runs on the build tree's emulator, so erlang-erts provides
the driver and NIF API versions of the emulator being packaged rather than
numbers updated by hand.

All Provides and Requires are the same as those of 27.3.4.19-4 (scratch
build 151994705).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>

---
diff --git a/erlang.spec b/erlang.spec
index e293db3..838544d 100644
--- a/erlang.spec
+++ b/erlang.spec
@@ -68,7 +68,7 @@
 
 Name:		erlang
 Version:	27.3.4.19
-Release:	4%{?dist}
+Release:	5%{?dist}
 Summary:	General-purpose programming language and runtime environment
 
 License:	Apache-2.0
@@ -83,10 +83,14 @@ Source8:	epmd@.socket
 # of their BEAM files. Runs on the escript of the build tree, as the
 # Erlang being built is not installed yet.
 Source998:	otp-find-requires.escript
-%global _local_file_attrs otp
+%global _local_file_attrs otp:otpabi
 %global __otp_requires %{builddir}/otp-OTP-%{version}/bin/escript %{SOURCE998} %{_libdir}/erlang/lib %{name} %{version}-%{release} %{?_isa}
 %global __otp_path ^%{_libdir}/erlang/lib/[^/]+/ebin/[^/]+\\.beam$
 %global __otp_protocol multifile
+# erlang(erl_drv_version) and erlang(erl_nif_version) of erlang-erts, taken
+# from erlang:system_info/1 of the emulator being built
+%global __otpabi_provides %{builddir}/otp-OTP-%{version}/bin/escript %{SOURCE998} --abi
+%global __otpabi_path ^%{_libdir}/erlang/erts-[^/]+/bin/beam\\.smp$
 # This file is intended for Fedora package maintainers only.
 Source999:	otp-get-patches.sh
 
@@ -290,12 +294,8 @@ BuildRequires: ncurses-devel
 BuildRequires: zlib-devel
 # epmd user, epmd group
 Requires: lksctp-tools
-# See erts/emulator/beam/erl_driver.h or call erlang:system_info(driver_version).
-#Provides: erlang(erl_drv_version) = %%(%%{buildroot}/bin/erl -noshell -eval 'io:format(erlang:system_info(driver_version)).' -s erlang halt)
-Provides: erlang(erl_drv_version) = 3.3
-# See erts/emulator/beam/erl_nif.h or call erlang:system_info(nif_version).
-#Provides: erlang(erl_nif_version) = %%(%%{buildroot}/bin/erl -noshell -eval 'io:format(erlang:system_info(nif_version)).' -s erlang halt)
-Provides: erlang(erl_nif_version) = 2.17
+# erlang(erl_drv_version) and erlang(erl_nif_version) are generated, see
+# __otpabi_provides
 # git commit a465fe71ab3d0e224b2b4bd0fac69ae68ab9239d, see erts/emulator/asmjit.version
 Provides: bundled(asmjit)
 # Bundled parts of openssl in commit 609a562ff60e5456739dfd62bb395b9083a78cba
@@ -1771,6 +1771,10 @@ ERL_TOP=${ERL_TOP} make TARGET=${TARGET} release_tests
 
 
 %changelog
+* Thu Nov 05 2026 Peter Lemenkov <lemenkov@gmail.com> - 27.3.4.19-5
+- Generate erlang(erl_drv_version) and erlang(erl_nif_version) of
+  erlang-erts from the emulator being built
+
 * Thu Nov 05 2026 Peter Lemenkov <lemenkov@gmail.com> - 27.3.4.19-4
 - Rewrite the subpackage Requires generator as an escript, so the build
   no longer needs Python

diff --git a/otp-find-requires.escript b/otp-find-requires.escript
index 0359ca4..0309402 100755
--- a/otp-find-requires.escript
+++ b/otp-find-requires.escript
@@ -17,12 +17,20 @@
 %%
 %% Usage: otp-find-requires.escript LIBDIR NAME VERSION-RELEASE [ISA]
 %%        otp-find-requires.escript --spec ROOT
+%%        otp-find-requires.escript --abi
 %% The second form prints the Requires lines for the spec file, from an
 %% unpacked tree (a buildroot, or the RPMs extracted into ROOT).
 %%   LIBDIR is %{_libdir}/erlang/lib, NAME is %{name}, ISA is %{?_isa}
+%% The third form is a Provides generator for the emulator binary: it prints
+%% the driver and NIF API versions of the runtime it runs on, which during the
+%% build is the emulator being packaged.
 
 -mode(compile).
 
+main(["--abi"]) ->
+    drain(),
+    io:format("erlang(erl_drv_version) = ~s~n", [erlang:system_info(driver_version)]),
+    io:format("erlang(erl_nif_version) = ~s~n", [erlang:system_info(nif_version)]);
 main(["--spec", Root]) ->
     [LibDir | _] = filelib:wildcard(Root ++ "/usr/lib*/erlang/lib"),
     Modules = index(LibDir),
@@ -46,9 +54,17 @@ main(_) ->
     Self = escript:script_name(),
     io:format(standard_error,
               "Usage: ~s LIBDIR NAME VERSION-RELEASE [ISA]~n"
-              "       ~s --spec ROOT~n", [Self, Self]),
+              "       ~s --spec ROOT~n"
+              "       ~s --abi~n", [Self, Self, Self]),
     halt(1).
 
+%% rpm writes the file name to the generator's stdin, so read it all.
+drain() ->
+    case io:get_line(standard_io, "") of
+        eof -> ok;
+        _ -> drain()
+    end.
+
 generate(Modules, Name, EVR, ISA) ->
     case io:get_line(standard_io, "") of
         eof ->

                 reply	other threads:[~2026-11-05 23:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179391973525.1.14947839886984978679.rpms-erlang-2ebcf3f3d332@fedoraproject.org \
    --to=lemenkov@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox