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: Provide erlang(APP) = VSN for every OTP application
Date: Thu, 05 Nov 2026 23:53:45 GMT [thread overview]
Message-ID: <179392282589.1.3602030669499217224.rpms-erlang-841343f9dc2d@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/erlang
Branch : rawhide
Commit : 841343f9dc2df6aaf26c7bd670425035acd167bf
Author : Peter Lemenkov <lemenkov@gmail.com>
Date : 2026-11-06T00:52:09+01:00
Stats : +54/-5 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/erlang/c/841343f9dc2df6aaf26c7bd670425035acd167bf?branch=rawhide
Log:
Provide erlang(APP) = VSN for every OTP application
The escript gets an --app mode, hooked as the Provides side of the otp file
attribute on the application resource files. Every OTP subpackage now
provides erlang(APP) = VSN for the applications it ships, with VSN the
application version read with file:consult/1, in the same form as
erlang-find-provides of erlang-rpm-macros gives other Erlang packages
(checked byte for byte against it on all 37 .app files of OTP 26). No
erlang(APP) Requires are generated.
Against 27.3.4.19-5 (scratch build 151995218) the only changes are the 36
new erlang(APP) Provides; all other Provides and Requires are the same.
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 838544d..97abd70 100644
--- a/erlang.spec
+++ b/erlang.spec
@@ -68,7 +68,7 @@
Name: erlang
Version: 27.3.4.19
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: General-purpose programming language and runtime environment
License: Apache-2.0
@@ -80,12 +80,14 @@ Source6: epmd.socket
Source7: epmd@.service
Source8: epmd@.socket
# The Requires of the subpackages on each other, generated from the calls
-# of their BEAM files. Runs on the escript of the build tree, as the
-# Erlang being built is not installed yet.
+# of their BEAM files, and erlang(APP) = VSN for every application resource
+# file. 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: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_provides %{builddir}/otp-OTP-%{version}/bin/escript %{SOURCE998} --app
+%global __otp_path ^%{_libdir}/erlang/lib/[^/]+/ebin/[^/]+\\.(beam|app)$
%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
@@ -1771,6 +1773,10 @@ ERL_TOP=${ERL_TOP} make TARGET=${TARGET} release_tests
%changelog
+* Fri Nov 06 2026 Peter Lemenkov <lemenkov@gmail.com> - 27.3.4.19-6
+- Provide erlang(APP) = VSN for every OTP application, as erlang-rpm-macros
+ does for other Erlang packages
+
* 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
diff --git a/otp-find-requires.escript b/otp-find-requires.escript
index 0309402..337b5ad 100755
--- a/otp-find-requires.escript
+++ b/otp-find-requires.escript
@@ -18,15 +18,21 @@
%% Usage: otp-find-requires.escript LIBDIR NAME VERSION-RELEASE [ISA]
%% otp-find-requires.escript --spec ROOT
%% otp-find-requires.escript --abi
+%% otp-find-requires.escript --app
%% 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.
+%% The fourth form is a multifile Provides generator: every application
+%% resource file APP/ebin/NAME.app provides erlang(NAME) = VSN, in the same
+%% form as erlang-find-provides of erlang-rpm-macros.
-mode(compile).
+main(["--app"]) ->
+ app_provides();
main(["--abi"]) ->
drain(),
io:format("erlang(erl_drv_version) = ~s~n", [erlang:system_info(driver_version)]),
@@ -55,9 +61,46 @@ main(_) ->
io:format(standard_error,
"Usage: ~s LIBDIR NAME VERSION-RELEASE [ISA]~n"
" ~s --spec ROOT~n"
- " ~s --abi~n", [Self, Self, Self]),
+ " ~s --abi~n"
+ " ~s --app~n", [Self, Self, Self, Self]),
halt(1).
+app_provides() ->
+ case io:get_line(standard_io, "") of
+ eof ->
+ ok;
+ Line ->
+ File = string:trim(Line, trailing, "\n"),
+ case lists:reverse(filename:split(File)) of
+ [AppFile, "ebin" | _] when length(AppFile) > 4 ->
+ case filename:extension(AppFile) of
+ ".app" ->
+ Name = filename:basename(AppFile, ".app"),
+ {ok, [{application, _, Props}]} = file:consult(File),
+ io:format(";~s~n", [File]),
+ case proplists:get_value(vsn, Props) of
+ undefined -> io:format("erlang(~s)~n", [Name]);
+ Vsn -> io:format("erlang(~s) = ~s~n", [Name, rpm_version(Vsn)])
+ end;
+ _ ->
+ ok
+ end;
+ _ ->
+ ok
+ end,
+ app_provides()
+ end.
+
+%% An application version as an RPM version, as erlang-find-provides does:
+%% '-' starts a pre-release in semantic versioning and '~' sorts the same way
+%% in RPM; other characters RPM doesn't allow become '_'.
+rpm_version(Vsn) ->
+ [case C of
+ $- -> $~;
+ _ when C >= $a, C =< $z; C >= $A, C =< $Z; C >= $0, C =< $9 -> C;
+ _ -> case lists:member(C, "._+~^") of true -> C; false -> $_ end
+ end || C <- Vsn].
+
%% rpm writes the file name to the generator's stdin, so read it all.
drain() ->
case io:get_line(standard_io, "") of
reply other threads:[~2026-11-05 23:53 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=179392282589.1.3602030669499217224.rpms-erlang-841343f9dc2d@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