Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b516286ce6 | ||
|
|
adf3f1fed4 |
19 changed files with 3 additions and 4234 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,7 +0,0 @@
|
|||
/*.src.rpm
|
||||
/*~
|
||||
/otp-OTP-*.tar.gz
|
||||
/otp_doc_html_R*.tar.gz
|
||||
/otp_doc_man_R*.tar.gz
|
||||
/otp_src_R*.readme
|
||||
/otp_src_R*.tar.gz
|
||||
3
dead.package
Normal file
3
dead.package
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
2014-12-18: Retired orphaned package, because it was orphaned for more than six weeks.
|
||||
Reference: https://fedorahosted.org/epel/ticket/7
|
||||
|
||||
25
epmd.service
25
epmd.service
|
|
@ -1,25 +0,0 @@
|
|||
[Unit]
|
||||
Description=Erlang Port Mapper Daemon
|
||||
After=network.target
|
||||
Requires=epmd.socket
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/epmd -systemd
|
||||
#ExecStop=/usr/bin/epmd -kill
|
||||
Type=notify
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
DeviceAllow=/dev/null rw
|
||||
PrivateTmp=true
|
||||
#CapabilityBoundingSet=
|
||||
NoNewPrivileges=true
|
||||
Restart=always
|
||||
LimitNPROC=1
|
||||
LimitFSIZE=0
|
||||
User=epmd
|
||||
Group=epmd
|
||||
|
||||
[Install]
|
||||
Also=epmd.socket
|
||||
WantedBy=multi-user.target
|
||||
|
||||
10
epmd.socket
10
epmd.socket
|
|
@ -1,10 +0,0 @@
|
|||
[Unit]
|
||||
Description=Erlang Port Mapper Daemon Activation Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=4369
|
||||
Accept=false
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
[Unit]
|
||||
Description=Erlang Port Mapper Daemon
|
||||
After=network.target
|
||||
Requires=epmd@.socket
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/epmd -systemd
|
||||
#ExecStop=/usr/bin/epmd -kill
|
||||
Type=notify
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
DeviceAllow=/dev/null rw
|
||||
PrivateTmp=true
|
||||
#CapabilityBoundingSet=
|
||||
NoNewPrivileges=true
|
||||
Restart=always
|
||||
LimitNPROC=1
|
||||
LimitFSIZE=0
|
||||
User=epmd
|
||||
Group=epmd
|
||||
|
||||
[Install]
|
||||
Also=epmd@.socket
|
||||
WantedBy=multi-user.target
|
||||
|
||||
10
epmd@.socket
10
epmd@.socket
|
|
@ -1,10 +0,0 @@
|
|||
[Unit]
|
||||
Description=Erlang Port Mapper Daemon Activation Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=%I
|
||||
Accept=false
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
||||
3132
erlang.spec
3132
erlang.spec
File diff suppressed because it is too large
Load diff
|
|
@ -1,41 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 25 Feb 2010 16:45:28 +0300
|
||||
Subject: [PATCH] Do not format man-pages and do not install miscellaneous
|
||||
utilities for dealing with man-pages.
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
|
||||
index 42af9c87dc..c017e0a4ed 100644
|
||||
--- a/erts/etc/common/Makefile.in
|
||||
+++ b/erts/etc/common/Makefile.in
|
||||
@@ -552,10 +552,6 @@ endif
|
||||
ifneq ($(INSTALL_TOP_BIN),)
|
||||
$(INSTALL_PROGRAM) $(INSTALL_TOP_BIN) "$(RELEASE_PATH)"
|
||||
endif
|
||||
-ifneq ($(INSTALL_MISC),)
|
||||
- $(INSTALL_DIR) "$(RELEASE_PATH)/misc"
|
||||
- $(INSTALL_SCRIPT) $(INSTALL_MISC) "$(RELEASE_PATH)/misc"
|
||||
-endif
|
||||
ifneq ($(INSTALL_SRC),)
|
||||
$(INSTALL_DIR) "$(RELEASE_PATH)/erts-$(VSN)/src"
|
||||
$(INSTALL_DATA) $(INSTALL_SRC) "$(RELEASE_PATH)/erts-$(VSN)/src"
|
||||
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
|
||||
index b00dd09f1a..2147774f50 100644
|
||||
--- a/erts/etc/unix/Install.src
|
||||
+++ b/erts/etc/unix/Install.src
|
||||
@@ -143,14 +143,5 @@ cp -p ../releases/%I_SYSTEM_VSN%/start_*.boot .
|
||||
cp -p ../releases/%I_SYSTEM_VSN%/no_dot_erlang.boot .
|
||||
cp -p $Name.boot start.boot
|
||||
cp -p ../releases/%I_SYSTEM_VSN%/$Name.script start.script
|
||||
-#
|
||||
-# Fixing the man pages
|
||||
-#
|
||||
-
|
||||
-if [ -d "$ERL_ROOT/man" ]
|
||||
-then
|
||||
- cd "$ERL_ROOT"
|
||||
- ./misc/format_man_pages "$ERL_ROOT"
|
||||
-fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 25 Feb 2010 16:57:43 +0300
|
||||
Subject: [PATCH] Remove rpath
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in
|
||||
index aedc9e7a13..b27c2aa01b 100644
|
||||
--- a/lib/crypto/c_src/Makefile.in
|
||||
+++ b/lib/crypto/c_src/Makefile.in
|
||||
@@ -147,7 +147,7 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(DYNAMIC_OR_WIN_CRYPTO_LIB),yes)
|
||||
-SSL_DED_LD_RUNTIME_LIBRARY_PATH = @SSL_DED_LD_RUNTIME_LIBRARY_PATH@
|
||||
+SSL_DED_LD_RUNTIME_LIBRARY_PATH =
|
||||
CRYPTO_LINK_LIB=$(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) -l$(SSL_CRYPTO_LIBNAME)
|
||||
EXTRA_FLAGS = -DHAVE_DYNAMIC_CRYPTO_LIB
|
||||
else
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Fri, 18 Jun 2010 23:41:33 +0400
|
||||
Subject: [PATCH] Do not install C sources
|
||||
|
||||
Don't install *.c and *.o files.
|
||||
|
||||
Excepts ones from the internal erl_interface. These
|
||||
API headers are necessary. See rhbz #818419 for the
|
||||
explanation why they're necessary for the low-level
|
||||
interaction with the Erlang nodes:
|
||||
|
||||
https://bugzilla.redhat.com/818419
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile
|
||||
index 82a6b6e87a..5f2fe8ba7d 100644
|
||||
--- a/lib/asn1/c_src/Makefile
|
||||
+++ b/lib/asn1/c_src/Makefile
|
||||
@@ -137,8 +137,6 @@ include $(ERL_TOP)/make/otp_release_targets.mk
|
||||
release_spec: opt
|
||||
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
|
||||
$(INSTALL_PROGRAM) $(NIF_SHARED_OBJ_FILE) "$(RELSYSDIR)/priv/lib"
|
||||
- $(INSTALL_DIR) "$(RELSYSDIR)/c_src"
|
||||
- $(INSTALL_DATA) *.c "$(RELSYSDIR)/c_src"
|
||||
|
||||
release_docs_spec:
|
||||
|
||||
diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in
|
||||
index fa1ea3cd39..b977b6afe5 100644
|
||||
--- a/lib/erl_interface/src/Makefile.in
|
||||
+++ b/lib/erl_interface/src/Makefile.in
|
||||
@@ -715,13 +715,11 @@ ifeq (@DYNAMIC_LIB@, yes)
|
||||
endif
|
||||
$(INSTALL_PROGRAM) $(EXE_TARGETS) "$(RELSYSDIR)/bin"
|
||||
$(INSTALL_DATA) $(EXTRA) "$(RELSYSDIR)/src"
|
||||
- $(INSTALL_DATA) connect/*.[ch] "$(RELSYSDIR)/src/connect"
|
||||
- $(INSTALL_DATA) decode/*.[ch] "$(RELSYSDIR)/src/decode"
|
||||
- $(INSTALL_DATA) encode/*.[ch] "$(RELSYSDIR)/src/encode"
|
||||
- $(INSTALL_DATA) epmd/*.[ch] "$(RELSYSDIR)/src/epmd"
|
||||
- $(INSTALL_DATA) misc/*.[ch] "$(RELSYSDIR)/src/misc"
|
||||
- $(INSTALL_DATA) global/*.[ch] "$(RELSYSDIR)/src/global"
|
||||
- $(INSTALL_DATA) prog/*.[ch] "$(RELSYSDIR)/src/prog"
|
||||
+ $(INSTALL_DATA) connect/*.h "$(RELSYSDIR)/src/connect"
|
||||
+ $(INSTALL_DATA) decode/*.h "$(RELSYSDIR)/src/decode"
|
||||
+ $(INSTALL_DATA) encode/*.h "$(RELSYSDIR)/src/encode"
|
||||
+ $(INSTALL_DATA) epmd/*.h "$(RELSYSDIR)/src/epmd"
|
||||
+ $(INSTALL_DATA) misc/*.h "$(RELSYSDIR)/src/misc"
|
||||
|
||||
release_docs:
|
||||
|
||||
diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in
|
||||
index 3649e2c392..d8c5c68b99 100644
|
||||
--- a/lib/megaco/src/flex/Makefile.in
|
||||
+++ b/lib/megaco/src/flex/Makefile.in
|
||||
@@ -251,7 +251,7 @@ release_spec: opt
|
||||
$(INSTALL_DATA) $(ERL_FILES) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src/flex"
|
||||
$(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin"
|
||||
ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),true)
|
||||
- $(INSTALL_DATA) $(FLEX_FILES) $(C_TARGETS) "$(RELSYSDIR)/src/flex"
|
||||
+ $(INSTALL_DATA) $(FLEX_FILES) "$(RELSYSDIR)/src/flex"
|
||||
$(INSTALL_PROGRAM) $(SOLIBS) "$(RELSYSDIR)/priv/lib"
|
||||
endif
|
||||
|
||||
diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in
|
||||
index d1b26743a6..cf8faae1f5 100644
|
||||
--- a/lib/odbc/c_src/Makefile.in
|
||||
+++ b/lib/odbc/c_src/Makefile.in
|
||||
@@ -129,11 +129,8 @@ include $(ERL_TOP)/make/otp_release_targets.mk
|
||||
|
||||
release_spec: opt
|
||||
ifdef EXE_TARGET
|
||||
- $(INSTALL_DIR) "$(RELSYSDIR)/c_src"
|
||||
- $(INSTALL_DATA) $(C_FILES) $(H_FILES) "$(RELSYSDIR)/c_src"
|
||||
$(INSTALL_DIR) "$(RELSYSDIR)/priv"
|
||||
$(INSTALL_DIR) "$(RELSYSDIR)/priv/bin"
|
||||
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/obj"
|
||||
$(INSTALL_PROGRAM) $(EXE_TARGET) "$(RELSYSDIR)/priv/bin"
|
||||
endif
|
||||
|
||||
diff --git a/lib/os_mon/c_src/Makefile.in b/lib/os_mon/c_src/Makefile.in
|
||||
index 27b156a2c9..f11ff303b6 100644
|
||||
--- a/lib/os_mon/c_src/Makefile.in
|
||||
+++ b/lib/os_mon/c_src/Makefile.in
|
||||
@@ -126,8 +126,6 @@ $(OBJDIR)/memsup.o: memsup.h
|
||||
include $(ERL_TOP)/make/otp_release_targets.mk
|
||||
|
||||
release_spec: opt
|
||||
- $(INSTALL_DIR) "$(RELSYSDIR)/src"
|
||||
- $(INSTALL_DATA) $(C_FILES) "$(RELSYSDIR)/src"
|
||||
$(INSTALL_DIR) "$(RELSYSDIR)/priv/bin"
|
||||
$(INSTALL_PROGRAM) $(TARGET_FILES) "$(RELSYSDIR)/priv/bin"
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Sat, 19 Jun 2010 09:25:18 +0400
|
||||
Subject: [PATCH] Do not install Java sources
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile
|
||||
index 089cf4ab1a..404654a437 100644
|
||||
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile
|
||||
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile
|
||||
@@ -123,8 +123,6 @@ release release_docs release_tests release_html:
|
||||
$(V_at)$(MAKE) $(MFLAGS) RELEASE_PATH="$(RELEASE_PATH)" $(TARGET_MAKEFILE) $@_spec
|
||||
|
||||
release_spec: opt
|
||||
- $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang"
|
||||
- $(V_at)$(INSTALL_DATA) $(JAVA_SRC) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang"
|
||||
$(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/priv"
|
||||
$(V_at)$(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv"
|
||||
$(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/ebin"
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Sat, 19 Jun 2010 09:59:39 +0400
|
||||
Subject: [PATCH] Do not install nteventlog and related doc-files on non-win32
|
||||
systems
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/lib/os_mon/doc/src/Makefile b/lib/os_mon/doc/src/Makefile
|
||||
index 8e3882bfdc..ea999cf9c7 100644
|
||||
--- a/lib/os_mon/doc/src/Makefile
|
||||
+++ b/lib/os_mon/doc/src/Makefile
|
||||
@@ -31,11 +31,16 @@ APPLICATION=os_mon
|
||||
# Target Specs
|
||||
# ----------------------------------------------------
|
||||
XML_APPLICATION_FILES = ref_man.xml
|
||||
+ifeq ($(findstring win32,$(TARGET)),win32)
|
||||
+NTEVENTLOG_DOCFILE=nteventlog.xml
|
||||
+else
|
||||
+NTEVENTLOG_DOCFILE=
|
||||
+endif
|
||||
XML_REF3_FILES = cpu_sup.xml \
|
||||
disksup.xml \
|
||||
memsup.xml \
|
||||
os_sup.xml \
|
||||
- nteventlog.xml
|
||||
+ $(NTEVENTLOG_DOCFILE)
|
||||
|
||||
XML_REF6_FILES = os_mon_app.xml
|
||||
|
||||
diff --git a/lib/os_mon/src/Makefile b/lib/os_mon/src/Makefile
|
||||
index e28fb12548..ee32f3946f 100644
|
||||
--- a/lib/os_mon/src/Makefile
|
||||
+++ b/lib/os_mon/src/Makefile
|
||||
@@ -34,7 +34,13 @@ RELSYSDIR = $(RELEASE_PATH)/lib/os_mon-$(VSN)
|
||||
# ----------------------------------------------------
|
||||
# Target Specs
|
||||
# ----------------------------------------------------
|
||||
-MODULES= disksup memsup cpu_sup os_mon os_mon_mib os_sup os_mon_sysinfo nteventlog
|
||||
+ifeq ($(findstring win32,$(TARGET)),win32)
|
||||
+NTEVENTLOG=nteventlog
|
||||
+else
|
||||
+NTEVENTLOG=
|
||||
+endif
|
||||
+MODULES= disksup memsup cpu_sup os_mon os_mon_mib os_sup os_mon_sysinfo \
|
||||
+ $(NTEVENTLOG)
|
||||
|
||||
INCLUDE=../include
|
||||
CSRC=../c_src
|
||||
@@ -78,7 +84,11 @@ docs:
|
||||
# ----------------------------------------------------
|
||||
|
||||
$(APP_TARGET): $(APP_SRC) ../vsn.mk
|
||||
+ifeq ($(findstring win32,$(TARGET)),win32)
|
||||
$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
|
||||
+else
|
||||
+ $(vsn_verbose)sed -e 's;%VSN%;$(VSN);;s;,\s*nteventlog;;' $< > $@
|
||||
+endif
|
||||
|
||||
$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
|
||||
$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Wed, 2 Aug 2017 16:12:19 +0300
|
||||
Subject: [PATCH] Add extra search directory
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
|
||||
index 7327636751..2e92e77598 100644
|
||||
--- a/lib/kernel/src/code_server.erl
|
||||
+++ b/lib/kernel/src/code_server.erl
|
||||
@@ -90,11 +90,17 @@ init(Ref, Parent, [Root,Mode]) ->
|
||||
IPath =
|
||||
case Mode of
|
||||
interactive ->
|
||||
- LibDir = filename:append(Root, "lib"),
|
||||
- {ok,Dirs} = erl_prim_loader:list_dir(LibDir),
|
||||
- Paths = make_path(LibDir, Dirs),
|
||||
+ F = fun(R) ->
|
||||
+ LD = filename:append(R, "lib"),
|
||||
+ case erl_prim_loader:list_dir(LD) of
|
||||
+ error -> [];
|
||||
+ {ok, D} -> make_path(LD, D)
|
||||
+ end
|
||||
+ end,
|
||||
+ Paths = F(Root),
|
||||
+ SharedPaths = F("/usr/share/erlang"),
|
||||
UserLibPaths = get_user_lib_dirs(),
|
||||
- ["."] ++ UserLibPaths ++ Paths;
|
||||
+ ["."] ++ UserLibPaths ++ Paths ++ SharedPaths;
|
||||
_ ->
|
||||
[]
|
||||
end,
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
From: Jan Pazdziora <jpazdziora@redhat.com>
|
||||
Date: Thu, 10 May 2018 18:35:02 +0200
|
||||
Subject: [PATCH] Avoid forking sed to get basename.
|
||||
|
||||
|
||||
diff --git a/erts/etc/unix/erl.src.src b/erts/etc/unix/erl.src.src
|
||||
index 536fa139d9..4dcffbc4c8 100644
|
||||
--- a/erts/etc/unix/erl.src.src
|
||||
+++ b/erts/etc/unix/erl.src.src
|
||||
@@ -49,7 +49,7 @@ else
|
||||
fi
|
||||
BINDIR="$ROOTDIR/erts-%VSN%/bin"
|
||||
EMU=%EMULATOR%%EMULATOR_NUMBER%
|
||||
-PROGNAME=`basename "$0"`
|
||||
+PROGNAME=${0##*/}
|
||||
export EMU
|
||||
export ROOTDIR
|
||||
export BINDIR
|
||||
diff --git a/erts/etc/unix/start_erl.src b/erts/etc/unix/start_erl.src
|
||||
index 34e0369710..62e613bba1 100644
|
||||
--- a/erts/etc/unix/start_erl.src
|
||||
+++ b/erts/etc/unix/start_erl.src
|
||||
@@ -37,7 +37,7 @@ VSN=`awk '{print $2}' $DataFile`
|
||||
|
||||
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
|
||||
EMU=beam
|
||||
-PROGNAME=`echo $0 | sed 's/.*\///'`
|
||||
+PROGNAME=${0##*/}
|
||||
export EMU
|
||||
export ROOTDIR
|
||||
export BINDIR
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
From: Francois-Denis Gonthier <neumann@lostwebsite.net>
|
||||
Date: Thu, 20 Sep 2018 15:01:18 +0300
|
||||
Subject: [PATCH] Load man-pages from system-wide directory
|
||||
|
||||
Patch allows one to use standard man path with erl -man command.
|
||||
(Erlang manual pages are placed to /usr/share/man/ hierarchy
|
||||
as required by Debian policy.)
|
||||
|
||||
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
|
||||
index 888df87e35..14272f06c6 100644
|
||||
--- a/erts/etc/common/erlexec.c
|
||||
+++ b/erts/etc/common/erlexec.c
|
||||
@@ -716,8 +716,10 @@ int main(int argc, char **argv)
|
||||
error("-man not supported on Windows");
|
||||
#else
|
||||
argv[i] = "man";
|
||||
- erts_snprintf(tmpStr, sizeof(tmpStr), "%s/man", rootdir);
|
||||
- set_env("MANPATH", tmpStr);
|
||||
+ /*
|
||||
+ * Conform to erlang-manpages content.
|
||||
+ */
|
||||
+ putenv(strsave("MANSECT=3erl:1:5:7"));
|
||||
execvp("man", argv+i);
|
||||
error("Could not execute the 'man' command.");
|
||||
#endif
|
||||
|
|
@ -1,464 +0,0 @@
|
|||
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||
Date: Thu, 19 Jun 2025 13:17:52 +0200
|
||||
Subject: [PATCH] Add GDB tools
|
||||
|
||||
* https://github.com/erlang/otp-gdb-tools
|
||||
* Commit 7b864f58c534699e4124e31ecfda86041b941037.
|
||||
|
||||
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||
|
||||
diff --git a/erts/etc/unix/gdb-tools/README.md b/erts/etc/unix/gdb-tools/README.md
|
||||
new file mode 100644
|
||||
index 0000000000..8a6cf92b1d
|
||||
--- /dev/null
|
||||
+++ b/erts/etc/unix/gdb-tools/README.md
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Erlang/OTP GDB Tools
|
||||
+
|
||||
+This repository contains GDB tools that cannot
|
||||
+be part of the main Erlang/OTP repository for licensing
|
||||
+reasons. The tools are used when building and debugging
|
||||
+Erlang/OTP with gdb and are installed as needed by the
|
||||
+Erlang/OTP build system.
|
||||
+
|
||||
+Right now the only tool in this repository is the jit-reader
|
||||
+which is a plugin to gdb that allows it to read the stack of
|
||||
+Erlang processes when using the JIT. This allows commands
|
||||
+such as `backtrace` to show Erlang stackframes. For example:
|
||||
+
|
||||
+```
|
||||
+(gdb) bt
|
||||
+#0 0x00007fffa40005ee in global::call_bif_shared ()
|
||||
+#1 0x00007fffa411eaac in erl_eval:eval_lc1/7 () at erl_eval.erl:929
|
||||
+#2 0x00007fffa411e7bc in erl_eval:eval_lc/7 () at erl_eval.erl:917
|
||||
+#3 0x00007fffa4296528 in lists:map_1/2 () at lists.erl:2082
|
||||
+#4 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
|
||||
+#5 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
|
||||
+#6 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
|
||||
+.....
|
||||
+#98 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
|
||||
+#99 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
|
||||
+#100 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
|
||||
+#101 0x00007fffa42963d4 in lists:map/2 () at lists.erl:2077
|
||||
+#102 0x00007fffa411e45c in erl_eval:do_apply/7 () at erl_eval.erl:904
|
||||
+#103 0x00007fffa45f4c58 in shell:exprs/7 () at shell.erl:893
|
||||
+#104 0x00007fffa45f42c4 in shell:eval_exprs/7 () at shell.erl:849
|
||||
+#105 0x00007fffa45f3dac in shell:eval_loop/4 () at shell.erl:834
|
||||
+#106 0x00007fffa40024b8 in erts_beamasm:normal_exit/0-CodeInfoPrologue ()
|
||||
+Backtrace stopped: previous frame inner to this frame (corrupt stack?)
|
||||
+(gdb)
|
||||
+```
|
||||
+
|
||||
+## Updates of jit-reader
|
||||
+
|
||||
+When updating jit-reader you first need to update this repository
|
||||
+and push the new version here. Then you need to run
|
||||
+`./otp_build update_gdb_tools` in the Erlang/OTP repo for
|
||||
+it to use the correct commit.
|
||||
diff --git a/erts/etc/unix/gdb-tools/jit-reader.c b/erts/etc/unix/gdb-tools/jit-reader.c
|
||||
new file mode 100644
|
||||
index 0000000000..3c39c5540d
|
||||
--- /dev/null
|
||||
+++ b/erts/etc/unix/gdb-tools/jit-reader.c
|
||||
@@ -0,0 +1,386 @@
|
||||
+#include <gdb/jit-reader.h>
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdint.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+/* Useful links
|
||||
+ * - https://pwparchive.wordpress.com/2011/11/20/new-jit-interface-for-gdb/
|
||||
+ * - https://sourceware.org/gdb/current/onlinedocs/gdb/Custom-Debug-Info.html
|
||||
+ * - https://github.com/tetzank/asmjit-utilities
|
||||
+ * - https://github.com/bminor/binutils-gdb/blob/master/gdb/testsuite/gdb.base/jitreader.c
|
||||
+ */
|
||||
+
|
||||
+GDB_DECLARE_GPL_COMPATIBLE_READER
|
||||
+
|
||||
+#if 0
|
||||
+#define HARD_DEBUG
|
||||
+static FILE *log = NULL;
|
||||
+#define LOG(...) do { fprintf(log, ##__VA_ARGS__); fflush(log); } while(0)
|
||||
+#else
|
||||
+#define LOG(...)
|
||||
+#endif
|
||||
+
|
||||
+typedef enum {
|
||||
+ X64_RBP = 6, /* Frame pointer iff native frames are enabled */
|
||||
+ X64_RSP = 7, /* Stack pointer when using native stack */
|
||||
+ X64_R12 = 12, /* Stack pointer when using non-native stack */
|
||||
+ X64_R13 = 13, /* Current process */
|
||||
+ X64_RIP = 16
|
||||
+} X64Register;
|
||||
+
|
||||
+typedef enum {
|
||||
+ /* Return address only */
|
||||
+ ERTS_FRAME_LAYOUT_RA,
|
||||
+ /* Frame pointer, return address */
|
||||
+ ERTS_FRAME_LAYOUT_FP_RA
|
||||
+} ErtsFrameLayout;
|
||||
+
|
||||
+struct emulator_info {
|
||||
+ /* 0 = regular, 1 = frame pointers */
|
||||
+ int frame_layout;
|
||||
+ const void *normal_exit;
|
||||
+};
|
||||
+
|
||||
+struct erlang_module_info {
|
||||
+ uint64_t base_address;
|
||||
+ uint32_t range_count;
|
||||
+ uint32_t code_size;
|
||||
+ /* Module name, including null terminator. */
|
||||
+ uint16_t name_length;
|
||||
+ char name[];
|
||||
+ /* array of range_info structures */
|
||||
+};
|
||||
+
|
||||
+struct range_info {
|
||||
+ uint32_t start_offset;
|
||||
+ uint32_t end_offset;
|
||||
+ uint32_t line_count;
|
||||
+ /* Range name, including null terminator. */
|
||||
+ uint16_t name_length;
|
||||
+ char name[];
|
||||
+ /* array of line_info structures */
|
||||
+};
|
||||
+
|
||||
+struct line_info {
|
||||
+ uint32_t start_offset;
|
||||
+ uint32_t line_number;
|
||||
+ /* File name, including null terminator. */
|
||||
+ uint16_t file_length;
|
||||
+ char file[];
|
||||
+};
|
||||
+
|
||||
+enum debug_info_header {
|
||||
+ DEBUG_INFO_HEADER_EMULATOR = 0,
|
||||
+ DEBUG_INFO_HEADER_MODULE = 1,
|
||||
+};
|
||||
+
|
||||
+struct debug_info {
|
||||
+ enum debug_info_header header;
|
||||
+ union {
|
||||
+ struct emulator_info emu;
|
||||
+ struct erlang_module_info mod;
|
||||
+ } payload;
|
||||
+};
|
||||
+
|
||||
+typedef struct range {
|
||||
+ GDB_CORE_ADDR start;
|
||||
+ GDB_CORE_ADDR end;
|
||||
+#ifdef HARD_DEBUG
|
||||
+ char *name;
|
||||
+#endif
|
||||
+} range;
|
||||
+
|
||||
+typedef struct priv {
|
||||
+ range *ranges;
|
||||
+ int num_ranges;
|
||||
+ ErtsFrameLayout frame_layout;
|
||||
+ const void *normal_exit;
|
||||
+} priv;
|
||||
+
|
||||
+static enum gdb_status read_module_info(struct gdb_reader_funcs *self,
|
||||
+ struct gdb_symbol_callbacks *cb,
|
||||
+ struct erlang_module_info *module_info) {
|
||||
+ struct gdb_object *obj = cb->object_open(cb);
|
||||
+ GDB_CORE_ADDR mod_start, mod_end;
|
||||
+ char *symfile = (char*)module_info;
|
||||
+ priv *priv = self->priv_data;
|
||||
+
|
||||
+ symfile += sizeof(*module_info) + module_info->name_length;
|
||||
+
|
||||
+ mod_start = module_info->base_address;
|
||||
+ mod_end = mod_start + module_info->code_size;
|
||||
+
|
||||
+ priv->ranges = realloc(priv->ranges, (priv->num_ranges + 1) * sizeof(range));
|
||||
+ priv->ranges[priv->num_ranges].start = mod_start;
|
||||
+ priv->ranges[priv->num_ranges].end = mod_end;
|
||||
+#ifdef HARD_DEBUG
|
||||
+ priv->ranges[priv->num_ranges].name = strdup(module_info->name);
|
||||
+#endif
|
||||
+ priv->num_ranges += 1;
|
||||
+
|
||||
+ LOG("Add module `%s` (0x%lx, 0x%lx)\r\n",
|
||||
+ module_info->name, mod_start, mod_end);
|
||||
+
|
||||
+ for (int range = 0; range < module_info->range_count; range++) {
|
||||
+ struct range_info *range_info;
|
||||
+ struct gdb_symtab *symtab;
|
||||
+ GDB_CORE_ADDR begin, end;
|
||||
+
|
||||
+ range_info = (struct range_info *)symfile;
|
||||
+ symfile += sizeof(*range_info) + range_info->name_length;
|
||||
+
|
||||
+ begin = mod_start + range_info->start_offset;
|
||||
+ end = mod_start + range_info->end_offset;
|
||||
+
|
||||
+ LOG("Add range `%s` (0x%lx, 0x%lx), %u lines\r\n",
|
||||
+ range_info->name,
|
||||
+ begin, end,
|
||||
+ range_info->line_count);
|
||||
+
|
||||
+ /* A bug in GDB < 9 forces us to open and close the symtab for each
|
||||
+ * iteration. */
|
||||
+ symtab = cb->symtab_open(cb, obj, module_info->name);
|
||||
+ cb->block_open(cb, symtab, NULL, begin, end, range_info->name);
|
||||
+ cb->symtab_close(cb, symtab);
|
||||
+
|
||||
+ for (int line = 0; line < range_info->line_count; line++) {
|
||||
+ struct gdb_line_mapping line_mapping;
|
||||
+ struct line_info *line_info;
|
||||
+
|
||||
+ line_info = (struct line_info *)symfile;
|
||||
+ symfile += sizeof(*line_info) + line_info->file_length;
|
||||
+
|
||||
+ line_mapping.pc = mod_start + line_info->start_offset;
|
||||
+ line_mapping.line = line_info->line_number;
|
||||
+
|
||||
+ LOG("\t%s:%u\r\n", line_info->file, line_info->line_number);
|
||||
+
|
||||
+ /* The symbol table must be opened and closed on every single line
|
||||
+ * for file names to work properly, as there is no other way to
|
||||
+ * tell GDB that a certain line belongs to a different file than
|
||||
+ * the rest of the table. Sigh. */
|
||||
+ symtab = cb->symtab_open(cb, obj, line_info->file);
|
||||
+
|
||||
+ cb->block_open(cb, symtab, NULL, line_mapping.pc, end,
|
||||
+ range_info->name);
|
||||
+ cb->line_mapping_add(cb, symtab, 1, &line_mapping);
|
||||
+ cb->symtab_close(cb, symtab);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ cb->object_close(cb, obj);
|
||||
+
|
||||
+ return GDB_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static enum gdb_status read_emulator_info(struct gdb_reader_funcs *self,
|
||||
+ struct gdb_symbol_callbacks *cb,
|
||||
+ struct emulator_info *emulator_info) {
|
||||
+ priv *priv = self->priv_data;
|
||||
+
|
||||
+ priv->frame_layout = emulator_info->frame_layout;
|
||||
+ priv->normal_exit = emulator_info->normal_exit;
|
||||
+
|
||||
+ LOG("initialize: frame layout = %i\r\n", priv->frame_layout);
|
||||
+
|
||||
+ return GDB_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static enum gdb_status read_debug_info(struct gdb_reader_funcs *self,
|
||||
+ struct gdb_symbol_callbacks *cb,
|
||||
+ void *memory, long memory_sz) {
|
||||
+ struct debug_info *debug_info = memory;
|
||||
+
|
||||
+ (void)memory_sz;
|
||||
+
|
||||
+ switch (debug_info->header) {
|
||||
+ case DEBUG_INFO_HEADER_EMULATOR:
|
||||
+ return read_emulator_info(self, cb, &debug_info->payload.emu);
|
||||
+ case DEBUG_INFO_HEADER_MODULE:
|
||||
+ return read_module_info(self, cb, &debug_info->payload.mod);
|
||||
+ }
|
||||
+
|
||||
+ return GDB_FAIL;
|
||||
+}
|
||||
+
|
||||
+static void regfree(struct gdb_reg_value *reg) {
|
||||
+ free(reg);
|
||||
+}
|
||||
+
|
||||
+static struct range *get_range(priv *priv, GDB_CORE_ADDR rip) {
|
||||
+ for (int i = 0; i < priv->num_ranges; i++) {
|
||||
+ if (rip >= priv->ranges[i].start && rip < priv->ranges[i].end) {
|
||||
+ return &priv->ranges[i];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static enum gdb_status unwind(struct gdb_reader_funcs *self,
|
||||
+ struct gdb_unwind_callbacks *cb) {
|
||||
+ GDB_CORE_ADDR rbp, rsp, rip;
|
||||
+ struct range *range;
|
||||
+ priv *priv;
|
||||
+
|
||||
+ rbp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RBP)->value;
|
||||
+ rsp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RSP)->value;
|
||||
+ rip = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RIP)->value;
|
||||
+
|
||||
+ priv = self->priv_data;
|
||||
+ range = get_range(priv, rip);
|
||||
+
|
||||
+ /* Check that rip points to one of the addresses that we handle */
|
||||
+ if (range) {
|
||||
+ struct gdb_reg_value *prev_rbp, *prev_rsp, *prev_rip;
|
||||
+
|
||||
+ prev_rbp = malloc(sizeof(struct gdb_reg_value) + sizeof(char*));
|
||||
+ prev_rsp = malloc(sizeof(struct gdb_reg_value) + sizeof(char*));
|
||||
+ prev_rip = malloc(sizeof(struct gdb_reg_value) + sizeof(char*));
|
||||
+
|
||||
+ LOG("UNWIND match %s: rbp: 0x%lx rsp: 0x%lx rip: 0x%lx \r\n",
|
||||
+ range->name, rbp, rsp, rip);
|
||||
+
|
||||
+ prev_rbp->free = ®free;
|
||||
+ prev_rbp->defined = 1;
|
||||
+ prev_rbp->size = sizeof(char*);
|
||||
+ prev_rsp->free = ®free;
|
||||
+ prev_rsp->defined = 1;
|
||||
+ prev_rsp->size = sizeof(char*);
|
||||
+ prev_rip->free = ®free;
|
||||
+ prev_rip->defined = 1;
|
||||
+ prev_rip->size = sizeof(char*);
|
||||
+
|
||||
+ if (priv->frame_layout == ERTS_FRAME_LAYOUT_FP_RA) {
|
||||
+ /* Frame pointers are enabled, which means that rbp will point to
|
||||
+ * where we stored the previous frames rbp. Also the previous
|
||||
+ * frames address will be at rbp + 8 and the previous frames rsp
|
||||
+ * will be rbp + 16.
|
||||
+ *
|
||||
+ * 0x00: <- prev_rsp
|
||||
+ * 0x08: prev call addr
|
||||
+ * 0x10: prev rbp <- curr rbp
|
||||
+ * 0x18: current frame
|
||||
+ * 0x20: <- curr rip */
|
||||
+ cb->target_read(rbp + 1 * sizeof(char*), &prev_rip->value,
|
||||
+ sizeof(char*));
|
||||
+ cb->target_read(rbp + 0 * sizeof(char*), &prev_rbp->value,
|
||||
+ sizeof(char*));
|
||||
+ *(GDB_CORE_ADDR*)prev_rsp->value = rbp + sizeof(char*[2]);
|
||||
+ } else {
|
||||
+ /* Normal frame layout, we need to scan the stack. */
|
||||
+ cb->target_read(rsp, &prev_rip->value, sizeof(char*));
|
||||
+
|
||||
+ for (rsp += sizeof(char*); ; rsp += sizeof(char*)) {
|
||||
+ cb->target_read(rsp, &prev_rip->value, sizeof(char*));
|
||||
+
|
||||
+ LOG("rsp: 0x%lx rip: 0x%lx\r\n",
|
||||
+ rsp, *(GDB_CORE_ADDR*)prev_rip->value);
|
||||
+
|
||||
+ /* Check if it is a cp */
|
||||
+ if ((*(GDB_CORE_ADDR*)prev_rip->value & 0x3) == 0) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ *(GDB_CORE_ADDR*)prev_rsp->value = rsp;
|
||||
+ *(GDB_CORE_ADDR*)prev_rbp->value = rsp - sizeof(char*);
|
||||
+ }
|
||||
+
|
||||
+ if (*(GDB_CORE_ADDR*)prev_rip->value == (uintptr_t)priv->normal_exit) {
|
||||
+ LOG("Normal exit\r\n");
|
||||
+ *(GDB_CORE_ADDR*)prev_rsp->value = 0;
|
||||
+ *(GDB_CORE_ADDR*)prev_rbp->value = 0;
|
||||
+ } else {
|
||||
+ LOG("UNWIND prev: rbp: 0x%lx rsp: 0x%lx rip: 0x%lx\r\n",
|
||||
+ *(GDB_CORE_ADDR*)prev_rbp->value,
|
||||
+ *(GDB_CORE_ADDR*)prev_rsp->value,
|
||||
+ *(GDB_CORE_ADDR*)prev_rip->value);
|
||||
+ }
|
||||
+
|
||||
+ cb->reg_set(cb, X64_RIP, prev_rip);
|
||||
+ cb->reg_set(cb, X64_RSP, prev_rsp);
|
||||
+ cb->reg_set(cb, X64_RBP, prev_rbp);
|
||||
+
|
||||
+ return GDB_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ LOG("UNWIND no match: rbp: 0x%lx rsp: 0x%lx rip: 0x%lx\r\n", rbp, rsp, rip);
|
||||
+ return GDB_FAIL;
|
||||
+}
|
||||
+
|
||||
+static struct gdb_frame_id get_frame_id(struct gdb_reader_funcs *self,
|
||||
+ struct gdb_unwind_callbacks *cb){
|
||||
+ struct gdb_frame_id frame = {0, 0};
|
||||
+ GDB_CORE_ADDR rbp, rsp, rip;
|
||||
+ struct range *range;
|
||||
+ priv *priv;
|
||||
+
|
||||
+ rbp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RBP)->value;
|
||||
+ rsp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RSP)->value;
|
||||
+ rip = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RIP)->value;
|
||||
+
|
||||
+ priv = self->priv_data;
|
||||
+ range = get_range(priv, rip);
|
||||
+
|
||||
+ LOG("FRAME: rip: 0x%lx rsp: 0x%lx rbp: 0x%lx \r\n", rip, rsp, rbp);
|
||||
+
|
||||
+ if (range) {
|
||||
+ frame.code_address = rip;
|
||||
+
|
||||
+ if (priv->frame_layout == ERTS_FRAME_LAYOUT_FP_RA) {
|
||||
+ frame.stack_address = rbp + sizeof(char*);
|
||||
+ } else {
|
||||
+ GDB_CORE_ADDR prev_rip;
|
||||
+
|
||||
+ for (rsp += sizeof(char*); ; rsp += sizeof(char*)) {
|
||||
+ cb->target_read(rsp, &prev_rip, sizeof(char*));
|
||||
+
|
||||
+ LOG("rsp: 0x%lx rip: 0x%lx\r\n", rsp, prev_rip);
|
||||
+
|
||||
+ /* Check if it is a cp */
|
||||
+ if ((prev_rip & 0x3) == 0) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ frame.stack_address = rsp;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ LOG("FRAME: code_address: 0x%lx stack_address: 0x%lx\r\n",
|
||||
+ frame.code_address, frame.stack_address);
|
||||
+
|
||||
+ return frame;
|
||||
+}
|
||||
+
|
||||
+static void destroy(struct gdb_reader_funcs *self){
|
||||
+ free(self);
|
||||
+}
|
||||
+
|
||||
+struct gdb_reader_funcs *gdb_init_reader(void){
|
||||
+ struct gdb_reader_funcs *funcs = malloc(sizeof(struct gdb_reader_funcs));
|
||||
+ priv *priv_data = malloc(sizeof(priv));
|
||||
+
|
||||
+ priv_data->num_ranges = 1;
|
||||
+ priv_data->ranges = malloc(sizeof(range));
|
||||
+ priv_data->ranges[0].start = 0;
|
||||
+ priv_data->ranges[0].end = 0;
|
||||
+
|
||||
+ funcs->reader_version = GDB_READER_INTERFACE_VERSION;
|
||||
+ funcs->priv_data = priv_data;
|
||||
+
|
||||
+ funcs->read = read_debug_info;
|
||||
+ funcs->unwind = unwind;
|
||||
+ funcs->get_frame_id = get_frame_id;
|
||||
+ funcs->destroy = destroy;
|
||||
+
|
||||
+#ifdef HARD_DEBUG
|
||||
+ log = fopen("/tmp/jit-reader.log","w+");
|
||||
+ if (!log) fprintf(stderr,"Could not open /tmp/jit-reader.log");
|
||||
+#endif
|
||||
+
|
||||
+ return funcs;
|
||||
+}
|
||||
diff --git a/erts/etc/unix/gdb-tools/jit-reader.mk b/erts/etc/unix/gdb-tools/jit-reader.mk
|
||||
new file mode 100644
|
||||
index 0000000000..8ef0bccec2
|
||||
--- /dev/null
|
||||
+++ b/erts/etc/unix/gdb-tools/jit-reader.mk
|
||||
@@ -0,0 +1,9 @@
|
||||
+EXTRA_LIBS = $(BINDIR)/jit-reader.so
|
||||
+
|
||||
+jit-reader: $(EXTRA_LIBS)
|
||||
+
|
||||
+$(OBJDIR)/jit-reader.o: $(GDB_TOOLS)/jit-reader.c $(GDB_TOOLS)/jit-reader.h
|
||||
+ $(V_CC) $(DED_CFLAGS) -I$(ETC) -o $@ -c $<
|
||||
+
|
||||
+$(BINDIR)/jit-reader.so: $(OBJDIR)/jit-reader.o
|
||||
+ $(V_LD) $(DED_LDFLAGS) -o $@ $^
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Usage:
|
||||
# ./otp-get-patches.sh /path/to/otp OTP_R14B02 fedora-R14B02
|
||||
#
|
||||
# otp-get-patches.sh - update erlang.spec and otp-00*.patch files
|
||||
#
|
||||
# otp-get-patches.sh updates the erlang.spec and otp-00*.patch
|
||||
# files in the git index. After an otp-get-patches.sh run, you
|
||||
# will need to review the staged git changes, possibly adapt the
|
||||
# 'Release:' and '%changelog' parts of erlang.spec, and can then
|
||||
# "git commit" everything.
|
||||
#
|
||||
# Caution: Leave the four special comment lines untouched in the
|
||||
# spec file, as otp-get-patches.sh requires them and will only
|
||||
# touch the parts of erlang.spec between the respective start/end
|
||||
# comment pair:
|
||||
#
|
||||
# # start of autogenerated patch tag list
|
||||
# # end of autogenerated patch tag list
|
||||
|
||||
# Command line parsing
|
||||
otp_dir="${1:?'Fatal: otp git repo dir required'}"
|
||||
otp_upstream="${2:?'Fatal: git ref to upstream release required'}"
|
||||
otp_fedora="${3:?'Fatal: git ref to branch with fedora patches required'}"
|
||||
|
||||
# Setup
|
||||
set -e
|
||||
# set -x
|
||||
tmpdir="$(mktemp -d --tmpdir="$PWD")"
|
||||
|
||||
# Generate patch files
|
||||
pushd "$otp_dir"
|
||||
git format-patch -N --no-signature --no-stat -o "$tmpdir" "${otp_upstream}..${otp_fedora}" > "$tmpdir/patch-list.txt"
|
||||
popd
|
||||
|
||||
test -s "$tmpdir/patch-list.txt"
|
||||
|
||||
# Process patch files
|
||||
echo "# start of autogenerated patch tag list" > "$tmpdir/patch-list-tags.txt"
|
||||
n=1
|
||||
while read patch
|
||||
do
|
||||
otppatch="$(dirname "$patch")/otp-$(basename "$patch")"
|
||||
${SED-sed} -e '1d' -e '/^-- $/,$d' "$patch" > "$otppatch"
|
||||
rm -f "$patch"
|
||||
echo "Patch$n: $(basename "$otppatch")" >> "$tmpdir/patch-list-tags.txt"
|
||||
n=$(($n + 1))
|
||||
done < "$tmpdir/patch-list.txt"
|
||||
echo "# end of autogenerated patch tag list" >> "$tmpdir/patch-list-tags.txt"
|
||||
|
||||
# Create updated spec file
|
||||
specfile="erlang.spec"
|
||||
newspec1="${tmpdir}/${specfile}.new1"
|
||||
sed '/^# start of autogenerated patch tag list$/,$d' "$specfile" > "$newspec1"
|
||||
cat "$tmpdir/patch-list-tags.txt" >> "$newspec1"
|
||||
sed '1,/^# end of autogenerated patch tag list/d' "$specfile" >> "$newspec1"
|
||||
|
||||
# Actually put all changes into git index
|
||||
git rm -f otp-00*.patch
|
||||
mv "$tmpdir/otp-00"*.patch .
|
||||
git add otp-00*.patch
|
||||
mv -f "$newspec1" "$specfile"
|
||||
git add "$specfile"
|
||||
|
||||
rm -rf "$tmpdir"
|
||||
# End of file.
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
import glob
|
||||
import os
|
||||
import re
|
||||
import rpm
|
||||
import sys
|
||||
|
||||
ts = rpm.TransactionSet()
|
||||
|
||||
packages = []
|
||||
for arg in sys.argv[1:]:
|
||||
packages += glob.glob(arg)
|
||||
|
||||
erlang_provides = {}
|
||||
erlang_requires = {}
|
||||
|
||||
package_names = []
|
||||
package_headers = {}
|
||||
|
||||
##
|
||||
## Custom tweaks begins here
|
||||
##
|
||||
|
||||
# These packages should be marked as noarch
|
||||
package_noarch = [
|
||||
"emacs-erlang",
|
||||
"emacs-erlang-el",
|
||||
"erlang-doc"]
|
||||
|
||||
# These are additional Requires which cannot be picked up automatically (yet).
|
||||
# TODO these should be added automatically
|
||||
package_additional_requires = {
|
||||
"emacs-erlang": ["emacs-common-erlang = %{version}-%{release}", "emacs(bin) >= %{_emacs_version}" ],
|
||||
"emacs-erlang-el": ["emacs-erlang = %{version}-%{release}"],
|
||||
"erlang-dialyzer": ["graphviz"],
|
||||
"erlang-erl_interface": ["%{name}-erts%{?_isa} = %{version}-%{release}"],
|
||||
# This library (lksctp-tools) is dlopened so it can't be picked
|
||||
# up automatically by the RPM dependency checker
|
||||
"erlang-erts": ["lksctp-tools"],
|
||||
"erlang-gs": ["tk"],
|
||||
# Stores files/links in /usr/share/java so has to depend on jpackage-utils
|
||||
"erlang-ic": ["jpackage-utils"],
|
||||
# Stores files/links in /usr/share/java so has to depend on jpackage-utils
|
||||
"erlang-jinterface": ["%{name}-erts%{?_isa} = %{version}-%{release}", "jpackage-utils"],
|
||||
"erlang-wx": ["mesa-libGL", "mesa-libGLU"],
|
||||
}
|
||||
|
||||
package_additional_buildrequires = {
|
||||
"emacs-erlang": ["emacs", "emacs-el"],
|
||||
"erlang-crypto": ["openssl-devel"],
|
||||
"erlang-diameter": ["ed"],
|
||||
|
||||
# BEWARE. No fop for EPEL5, and only for x86/x86_64 in EPEL6,
|
||||
# so we cannot regenerate docs here. (Un)Fortunately we dropped
|
||||
# support for EPEL6 and older versions.
|
||||
# FIXME add bootstrap condition first.
|
||||
"erlang-doc": ["fop", "libxslt"],
|
||||
|
||||
"erlang-erts": ["lksctp-tools-devel", "m4", "ncurses-devel", "zlib-devel"],
|
||||
"erlang-gs": ["tcl-devel", "tk-devel"],
|
||||
|
||||
# in EPEL6 on arches different from %{ix86} x86_64 we have to
|
||||
# use java-devel-gcj, so technically this requirement makes it
|
||||
# impossible to build Java support there. (Un)Fortunately we
|
||||
# already dropped full support for EPEL6 and older versions.
|
||||
"erlang-ic": ["java-devel"],
|
||||
"erlang-jinterface": ["java-devel"],
|
||||
|
||||
"erlang-odbc": ["unixODBC-devel"],
|
||||
}
|
||||
|
||||
package_additional_obsoletes = {
|
||||
"erlang-erts": [
|
||||
"erlang-appmon",
|
||||
"erlang-docbuilder",
|
||||
"erlang-inviso",
|
||||
"erlang-pman",
|
||||
"erlang-toolbar",
|
||||
"erlang-tv"],
|
||||
}
|
||||
|
||||
##
|
||||
## Custom tweaks ends here
|
||||
##
|
||||
|
||||
# To match 'erlang(asn1ct_eval_ext:transform_to_EXTERNAL1994/1)'
|
||||
prog = re.compile("^erlang(.*:.*/\d+)")
|
||||
rpmmask = re.compile(".*\.rpm")
|
||||
|
||||
# iterate over all rpms
|
||||
for package in sorted([p for p in packages if rpmmask.match(p)]):
|
||||
|
||||
# A tricky part. We are processing packages, rebuilt with
|
||||
# %{__erlang_provides_requires}. Otherwise we won't get information
|
||||
# about imports/exports (until we learn how to parse Erlang BEAM file
|
||||
# headers with Python.
|
||||
fd = os.open(package, os.O_RDONLY)
|
||||
h = ts.hdrFromFdno(fd)
|
||||
os.close(fd)
|
||||
|
||||
rpm_name = h[rpm.RPMTAG_NAME]
|
||||
|
||||
# Let's calculate provides
|
||||
# We'll create dictionary to speedup future use
|
||||
# FIXME duplicate provides
|
||||
local_provides = [p for p in h[rpm.RPMTAG_PROVIDENAME] if prog.match(p)]
|
||||
erlang_provides.update({k: rpm_name for k in local_provides})
|
||||
|
||||
# Let's calculate requires
|
||||
erlang_requires.update({rpm_name: [r for r in h[rpm.RPMTAG_REQUIRENAME] if prog.match(r) and not r in local_provides]})
|
||||
|
||||
package_headers.update({rpm_name: h})
|
||||
|
||||
package_names.append(rpm_name)
|
||||
|
||||
namemask = re.compile("^erlang-[a-zA-Z0-9_]*$")
|
||||
|
||||
print "### BEGIN OF AUTOGENERATED LIST ###"
|
||||
print ""
|
||||
|
||||
for name in package_names:
|
||||
h = package_headers[name]
|
||||
|
||||
if name == "erlang-doc":
|
||||
# Additional ifdef just for this sub-package (see below)
|
||||
print "%if %{with doc}"
|
||||
|
||||
if namemask.match(name):
|
||||
print "%%package %s" % name.replace("erlang-", "")
|
||||
else:
|
||||
print "%%package -n %s" % name
|
||||
|
||||
print "Summary: %s" % h[rpm.RPMTAG_SUMMARY]
|
||||
print "Group: %s" % h[rpm.RPMTAG_GROUP]
|
||||
|
||||
rawdeps = [erlang_provides.get(r, "Error: missing requires: %s" % r) for r in erlang_requires[name]]
|
||||
|
||||
deps = set()
|
||||
dependency_add = deps.add
|
||||
[x for x in rawdeps if not (x in deps or dependency_add(x))]
|
||||
|
||||
# Additional BuildRequires (if any):
|
||||
for br in package_additional_buildrequires.get(name, []):
|
||||
print "BuildRequires: %s" % br
|
||||
|
||||
# Add basic autogenerated Requires:
|
||||
for r in sorted(deps):
|
||||
#Requires: %{name}-stdlib%{?_isa} = %{version}-%{release}
|
||||
print "Requires: %s%%{?_isa} = %%{version}-%%{release}" % r.replace("erlang-", "%{name}-")
|
||||
|
||||
# Add custom additional Requires (if any):
|
||||
for r in package_additional_requires.get(name, []):
|
||||
print "Requires: %s" % r
|
||||
|
||||
# Add custom additional Obsoletes (if any):
|
||||
for os in package_additional_obsoletes.get(name, []):
|
||||
print "Obsoletes: %s" % os
|
||||
|
||||
if name in package_noarch:
|
||||
print "BuildArch: noarch"
|
||||
|
||||
print ""
|
||||
if namemask.match(name):
|
||||
print "%%description %s" % name.replace("erlang-", "")
|
||||
else:
|
||||
print "%%description -n %s" % name
|
||||
print "%s" % h[rpm.RPMTAG_DESCRIPTION]
|
||||
|
||||
if name == "erlang-doc":
|
||||
# Additional ifdef just for this sub-package (see above)
|
||||
print "%endif"
|
||||
|
||||
print ""
|
||||
|
||||
print "### END OF AUTOGENERATED LIST ###"
|
||||
1
sources
1
sources
|
|
@ -1 +0,0 @@
|
|||
SHA512 (otp-OTP-26.2.5.16.tar.gz) = 4e973be7e8ccad196d59759108a521535b0f046268eb0406f789a50f411fa27c9c11fcfb61a7218605bf1b32921bb52c52fc7c99917e1acfc0d3ed09437129b2
|
||||
Loading…
Add table
Add a link
Reference in a new issue