logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: 1be8deda73add2dde23127be1f4da802dcb25b45
parent 0e53cb494038b45d8281b9daba11a4a9dae2115b
Author: Phantasm <phantasm@centrum.cz>
Date:   Tue,  3 Jun 2025 23:17:39 +0200

Remove Pleroma.OTPVersion module

Its last use was a check in lib/application.ex that was removed in
commit 0e53cb494038b45d8281b9daba11a4a9dae2115b

Major OTP version can be fetched with System.otp_release/0.
If checking against minor versions and patch levels is needed,
revert this commit since it uses the recommended way of getting
a full OTP version string.

Diffstat:

Dlib/pleroma/otp_version.ex28----------------------------
Dtest/fixtures/warnings/otp_version/21.12--
Dtest/fixtures/warnings/otp_version/22.12--
Dtest/fixtures/warnings/otp_version/22.42--
Dtest/fixtures/warnings/otp_version/23.02--
Dtest/pleroma/otp_version_test.exs42------------------------------------------
6 files changed, 0 insertions(+), 78 deletions(-)

diff --git a/lib/pleroma/otp_version.ex b/lib/pleroma/otp_version.ex @@ -1,28 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.OTPVersion do - @spec version() :: String.t() | nil - def version do - # OTP Version https://erlang.org/doc/system_principles/versions.html#otp-version - [ - Path.join(:code.root_dir(), "OTP_VERSION"), - Path.join([:code.root_dir(), "releases", :erlang.system_info(:otp_release), "OTP_VERSION"]) - ] - |> get_version_from_files() - end - - @spec get_version_from_files([Path.t()]) :: String.t() | nil - def get_version_from_files([]), do: nil - - def get_version_from_files([path | paths]) do - if File.exists?(path) do - path - |> File.read!() - |> String.replace(~r/\r|\n|\s/, "") - else - get_version_from_files(paths) - end - end -end diff --git a/test/fixtures/warnings/otp_version/21.1 b/test/fixtures/warnings/otp_version/21.1 @@ -1 +0,0 @@ -21.1 -\ No newline at end of file diff --git a/test/fixtures/warnings/otp_version/22.1 b/test/fixtures/warnings/otp_version/22.1 @@ -1 +0,0 @@ -22.1 -\ No newline at end of file diff --git a/test/fixtures/warnings/otp_version/22.4 b/test/fixtures/warnings/otp_version/22.4 @@ -1 +0,0 @@ -22.4 -\ No newline at end of file diff --git a/test/fixtures/warnings/otp_version/23.0 b/test/fixtures/warnings/otp_version/23.0 @@ -1 +0,0 @@ -23.0 -\ No newline at end of file diff --git a/test/pleroma/otp_version_test.exs b/test/pleroma/otp_version_test.exs @@ -1,42 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.OTPVersionTest do - use ExUnit.Case, async: true - - alias Pleroma.OTPVersion - - describe "check/1" do - test "22.4" do - assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/22.4"]) == - "22.4" - end - - test "22.1" do - assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/22.1"]) == - "22.1" - end - - test "21.1" do - assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/21.1"]) == - "21.1" - end - - test "23.0" do - assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/23.0"]) == - "23.0" - end - - test "with nonexistent file" do - assert OTPVersion.get_version_from_files([ - "test/fixtures/warnings/otp_version/non-exising", - "test/fixtures/warnings/otp_version/22.4" - ]) == "22.4" - end - - test "empty paths" do - assert OTPVersion.get_version_from_files([]) == nil - end - end -end