File 0224-Scan-SKIP-files-in-addition-to-scanning-SKIP-APPLICA.patch of Package erlang

From b0d8a9e0d7d4cf77540184d63291ac5a09c86971 Mon Sep 17 00:00:00 2001
From: Dmytro Lytovchenko <dima.lytovchenko@ericsson.com>
Date: Tue, 13 Jan 2026 11:32:52 +0100
Subject: [PATCH] Scan SKIP files in addition to scanning SKIP-APPLICATIONS
 Update Makefile.in with the new 'clean_docs' target

---
 Makefile.in             |  4 ++++
 system/doc/top/Makefile | 10 ++++++++--
 system/doc/top/docs.exs | 26 +++++++++++++++++++++++---
 3 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index dc20f98583..49d2b8f42f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -994,3 +994,7 @@ APPS_TEST=$(patsubst %, %_test,$(APPS))
 $(NO_DIALYZER_APPS): $$(patsubst %,%_build,$$@)
 $(APPS_TEST): $$(patsubst %_test,%_build,$$@)
 	ERL_TOP=$(ERL_TOP) TYPE=$(TYPE) $(MAKE) -C lib/$(patsubst %_test,%,$@) test
+
+.PHONY: clean_docs
+clean_docs:
+	rm -rf $(ERL_TOP)/doc $(ERL_TOP)/make/otp_doc_built
diff --git a/system/doc/top/Makefile b/system/doc/top/Makefile
index 1b8bd56552..5250b73909 100644
--- a/system/doc/top/Makefile
+++ b/system/doc/top/Makefile
@@ -28,8 +28,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
 # ----------------------------------------------------
 APPLICATION=Erlang/OTP
 VSN=$(shell cat $(ERL_TOP)/OTP_VERSION)
-SKIP_FILE := $(wildcard $(ERL_TOP)/lib/SKIP_APPLICATIONS)
-SKIP_APPLICATIONS=$(if $(SKIP_FILE),$(shell cat $(ERL_TOP)/lib/SKIP-APPLICATIONS),)
+
 APP_DIR=../../../lib/erl_interface
 INDEX_DIR=.
 HTMLDIR=../../../doc
@@ -45,6 +44,13 @@ TESTING=common_test eunit
 DOCUMENTATION=edoc
 SYSTEM:=$(shell awk -F: '{print $$1}' ../guides)
 
+# The applications skipped by $(ERL_TOP)/configure are not added SKIP-APPLICATIONS.
+# Solution: read both SKIP-APPLICATIONS and names of libraries which contain a lib/*/SKIP file.
+# $(pathsubst %/,%,_) clears trailing slash, $(dir _) = directory name, $(notdir _) = last component of the path
+SKIP_FILE := $(wildcard $(ERL_TOP)/lib/SKIP-APPLICATIONS)
+SKIP_APPLICATIONS=$(if $(SKIP_FILE),$(shell cat $(ERL_TOP)/lib/SKIP-APPLICATIONS),) \
+                  $(foreach f,$(wildcard $(ERL_TOP)/lib/*/SKIP),$(notdir $(patsubst %/,%,$(dir $(f)))))
+
 REDIRECTS=$(foreach guide,$(SYSTEM),system/$(guide).md) \
 	$(foreach app, $(filter-out $(SKIP_APPLICATIONS),$(CORE)),          core/$(app).md) \
 	$(foreach app, $(filter-out $(SKIP_APPLICATIONS),$(DATABASE)),      database/$(app).md) \
diff --git a/system/doc/top/docs.exs b/system/doc/top/docs.exs
index e6b1aa3e38..18e616df41 100644
--- a/system/doc/top/docs.exs
+++ b/system/doc/top/docs.exs
@@ -25,8 +25,8 @@ system_guides =
     line |> String.split(":") |> Enum.at(0)
   end)
 
-# Root /configure creates artifact /lib/SKIP-APPLICATIONS containing all apps
-# not built for various reasons. We can't build documentation for them either.
+# $ERL_TOP/configure creates artifact lib/SKIP-APPLICATIONS containing all apps
+# skipped by user request (via command line). We can't build documentation for them.
 skipped_apps_from_file =
   with erl_top when is_binary(erl_top) <- System.get_env("ERL_TOP"),
        skip_path <- Path.join([erl_top, "lib", "SKIP-APPLICATIONS"]),
@@ -40,11 +40,31 @@ skipped_apps_from_file =
     _ -> MapSet.new()
   end
 
+# Failed lib/*/configure writes a file called 'SKIP', find names of such apps.
+skipped_apps_from_SKIP = fn ->
+  with erl_top when is_binary(erl_top) <- System.get_env("ERL_TOP"),
+       lib_path <- Path.join([erl_top, "lib"]) do
+    Path.wildcard(Path.join([lib_path, "*", "SKIP"]))
+    |> Enum.map(fn skip_file ->
+      skip_file
+      |> Path.dirname()
+      |> Path.basename()
+      |> String.downcase()
+    end)
+    |> MapSet.new()
+  else
+    _ -> MapSet.new()
+  end
+end
+
 apps =
   Path.wildcard("{core,database,oam,interfaces,tools,testing,documentation}/*.md")
   |> Enum.map(&Path.basename/1)
   |> Enum.map(&Path.rootname/1)
-  |> Enum.reject(fn app -> skipped_apps_from_file |> MapSet.member?(app) end)
+  |> Enum.reject(fn app ->
+    MapSet.member?(skipped_apps_from_file, app) or
+      MapSet.member?(skipped_apps_from_SKIP.(), app)
+  end)
 
 redirects =
   Enum.map(apps, fn
-- 
2.51.0

openSUSE Build Service is sponsored by