diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:35 +0000 |
commit | f09848204fa5283d21ea43e262ee41aa578e1808 (patch) | |
tree | c62385d7adf209fa6a798635954d887f718fb3fb /packaging/utils | |
parent | Releasing debian version 1.46.3-2. (diff) | |
download | netdata-f09848204fa5283d21ea43e262ee41aa578e1808.tar.xz netdata-f09848204fa5283d21ea43e262ee41aa578e1808.zip |
Merging upstream version 1.47.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/utils')
-rw-r--r-- | packaging/utils/bash_execute.sh | 19 | ||||
-rw-r--r-- | packaging/utils/clion-msys-mingw64-environment.bat | 17 | ||||
-rw-r--r-- | packaging/utils/clion-msys-msys-environment.bat | 20 | ||||
-rw-r--r-- | packaging/utils/compile-on-windows.sh | 71 | ||||
-rwxr-xr-x | packaging/utils/coverity-scan.sh | 33 | ||||
-rw-r--r-- | packaging/utils/find-dll-deps.sh | 16 | ||||
-rw-r--r-- | packaging/utils/installer.nsi | 34 | ||||
-rw-r--r-- | packaging/utils/package-windows.sh | 27 | ||||
-rw-r--r-- | packaging/utils/protoc.bat | 9 | ||||
-rw-r--r-- | packaging/utils/windows-openssh-to-msys.bat | 118 |
10 files changed, 30 insertions, 334 deletions
diff --git a/packaging/utils/bash_execute.sh b/packaging/utils/bash_execute.sh deleted file mode 100644 index 4092db966..000000000 --- a/packaging/utils/bash_execute.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/bash - -convert_path() { - local ARG="$1" - ARG="${ARG//C:\\//c/}" - ARG="${ARG//c:\\//c/}" - ARG="${ARG//C:\///c/}" - ARG="${ARG//c:\///c/}" - - echo "$ARG" -} - -declare params=() -for x in "${@}" -do - params+=("$(convert_path "${x}")") -done - -"${params[@]}" diff --git a/packaging/utils/clion-msys-mingw64-environment.bat b/packaging/utils/clion-msys-mingw64-environment.bat deleted file mode 100644 index 19035d8eb..000000000 --- a/packaging/utils/clion-msys-mingw64-environment.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -:: In Clion Toolchains -:: 1. Add a MinGW profile -:: 2. Set Toolset to C:\msys64\mingw64 -:: 3. Add environment and set the full path to this file, like: -:: C:\msys64\home\costa\src\netdata-ktsaou.git\packaging\utils\clion-mingw64-environment.bat -:: 4. Let everything else to Bundled and auto-detected -:: -set "batch_dir=%~dp0" -set "batch_dir=%batch_dir:\=/%" -set MSYSTEM=MINGW64 -set GOROOT=C:\msys64\mingw64 -set PATH="%PATH%;C:\msys64\mingw64\bin;C:\msys64\usr\bin;C:\msys64\bin" -::set PKG_CONFIG_EXECUTABLE=C:\msys64\mingw64\bin\pkg-config.exe -::set CMAKE_C_COMPILER=C:\msys64\mingw64\bin\gcc.exe -::set CMAKE_CC_COMPILER=C:\msys64\mingw64\bin\g++.exe -set PROTOBUF_PROTOC_EXECUTABLE=C:/msys64/mingw64/bin/protoc.exe diff --git a/packaging/utils/clion-msys-msys-environment.bat b/packaging/utils/clion-msys-msys-environment.bat deleted file mode 100644 index 9f0c095d3..000000000 --- a/packaging/utils/clion-msys-msys-environment.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off
-:: In Clion Toolchains
-:: 1. Add a MinGW profile
-:: 2. Set Toolset to C:\msys64\mingw64
-:: 3. Add environment and set the full path to this file, like:
-:: C:\msys64\home\costa\src\netdata-ktsaou.git\packaging\utils\clion-mingw64-environment.bat
-:: 4. Let everything else to Bundled and auto-detected
-::
-set "batch_dir=%~dp0"
-set "batch_dir=%batch_dir:\=/%"
-set MSYSTEM=MSYS
-
-:: go exists only mingw64 / ucrt64 / etc, not under msys profile
-set GOROOT=C:\msys64\mingw64
-
-set PATH="%PATH%;C:\msys64\usr\bin;C:\msys64\bin;C:\msys64\mingw64\bin"
-::set PKG_CONFIG_EXECUTABLE=C:\msys64\mingw64\bin\pkg-config.exe
-::set CMAKE_C_COMPILER=C:\msys64\mingw64\bin\gcc.exe
-::set CMAKE_CC_COMPILER=C:\msys64\mingw64\bin\g++.exe
-set PROTOBUF_PROTOC_EXECUTABLE=%batch_dir%/protoc.bat
diff --git a/packaging/utils/compile-on-windows.sh b/packaging/utils/compile-on-windows.sh deleted file mode 100644 index aa44771b8..000000000 --- a/packaging/utils/compile-on-windows.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -# On MSYS2, install these dependencies to build netdata: -install_dependencies() { - pacman -S \ - git cmake ninja base-devel msys2-devel \ - libyaml-devel libzstd-devel libutil-linux libutil-linux-devel \ - mingw-w64-x86_64-toolchain mingw-w64-ucrt-x86_64-toolchain \ - mingw64/mingw-w64-x86_64-mold ucrt64/mingw-w64-ucrt-x86_64-mold \ - msys/gdb ucrt64/mingw-w64-ucrt-x86_64-gdb mingw64/mingw-w64-x86_64-gdb \ - msys/zlib-devel mingw64/mingw-w64-x86_64-zlib ucrt64/mingw-w64-ucrt-x86_64-zlib \ - msys/libuv-devel ucrt64/mingw-w64-ucrt-x86_64-libuv mingw64/mingw-w64-x86_64-libuv \ - liblz4-devel mingw64/mingw-w64-x86_64-lz4 ucrt64/mingw-w64-ucrt-x86_64-lz4 \ - openssl-devel mingw64/mingw-w64-x86_64-openssl ucrt64/mingw-w64-ucrt-x86_64-openssl \ - protobuf-devel mingw64/mingw-w64-x86_64-protobuf ucrt64/mingw-w64-ucrt-x86_64-protobuf \ - msys/pcre2-devel mingw64/mingw-w64-x86_64-pcre2 ucrt64/mingw-w64-ucrt-x86_64-pcre2 \ - msys/brotli-devel mingw64/mingw-w64-x86_64-brotli ucrt64/mingw-w64-ucrt-x86_64-brotli \ - msys/ccache ucrt64/mingw-w64-ucrt-x86_64-ccache mingw64/mingw-w64-x86_64-ccache \ - mingw64/mingw-w64-x86_64-go ucrt64/mingw-w64-ucrt-x86_64-go -} - -if [ "${1}" = "install" ] -then - install_dependencies || exit 1 - exit 0 -fi - -export PATH="/usr/local/bin:${PATH}" - -WT_ROOT="$(pwd)" -BUILD_TYPE="Debug" -NULL="" - -if [ -z "${MSYSTEM}" ]; then - build="${WT_ROOT}/build-${OSTYPE}" -else - build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}" -fi - -if [ "$USER" = "vk" ]; then - build="${WT_ROOT}/build" -fi - -set -exu -o pipefail - -if [ -d "${build}" ] -then - rm -rf "${build}" -fi - -/usr/bin/cmake -S "${WT_ROOT}" -B "${build}" \ - -G Ninja \ - -DCMAKE_INSTALL_PREFIX="/opt/netdata" \ - -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ - -DCMAKE_C_FLAGS="-O0 -ggdb -Wall -Wextra -Wno-char-subscripts -Wa,-mbig-obj -pipe -DNETDATA_INTERNAL_CHECKS=1 -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" \ - -DNETDATA_USER="${USER}" \ - -DDEFAULT_FEATURE_STATE=Off \ - -DENABLE_H2O=Off \ - -DENABLE_LOGS_MANAGEMENT_TESTS=Off \ - -DENABLE_ACLK=On \ - -DENABLE_CLOUD=On \ - -DENABLE_ML=On \ - -DENABLE_BUNDLED_JSONC=On \ - -DENABLE_BUNDLED_PROTOBUF=Off \ - ${NULL} - -ninja -v -C "${build}" || ninja -v -C "${build}" -j 1 - -echo -echo "Compile with:" -echo "ninja -v -C \"${build}\" || ninja -v -C \"${build}\" -j 1" diff --git a/packaging/utils/coverity-scan.sh b/packaging/utils/coverity-scan.sh index b69fea561..ebb82102d 100755 --- a/packaging/utils/coverity-scan.sh +++ b/packaging/utils/coverity-scan.sh @@ -27,9 +27,6 @@ # this includes the token, so the default is not to print it. # COVERITY_SUBMIT_DEBUG=1 # -# Override the standard coverity build version we know is supported -# COVERITY_BUILD_VERSION="cov-analysis-linux64-2019.03" -# # All these variables can also be exported before running this script. # # If the first parameter of this script is "install", @@ -37,10 +34,12 @@ set -e -INSTALL_DIR="/opt" +if [ "$(uname -s)" != "Linux" ] || [ "$(uname -m)" != "x86_64" ]; then + echo "This script can only be used on a 64-bit x86 Linux system." + exit 1 +fi -# the version of coverity to use -COVERITY_BUILD_VERSION="${COVERITY_BUILD_VERSION:-cov-analysis-linux64-2023.6.2}" +INSTALL_DIR="/opt" SCRIPT_SOURCE="$( self=${0} @@ -158,24 +157,21 @@ scanit() { } installit() { - ORIGINAL_DIR="${PWD}" TMP_DIR="$(mktemp -d /tmp/netdata-coverity-scan-XXXXX)" progress "Downloading coverity in ${TMP_DIR}..." - cd "${TMP_DIR}" + (cd "${TMP_DIR}" && debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64) - debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64 + COVERITY_ARCHIVE="$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -name 'cov-analysis-linux64-*.tar.gz')" - if [ -f "${COVERITY_BUILD_VERSION}.tar.gz" ]; then + if [ -n "${COVERITY_ARCHIVE}" ] && [ -f "${COVERITY_ARCHIVE}" ]; then progress "Installing coverity..." - cd "${INSTALL_DIR}" - - run sudo tar -z -x -f "${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz" || exit 1 - rm "${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz" + run sudo tar -z -x -f "${COVERITY_ARCHIVE}" -C "${INSTALL_DIR}" + rm -f "${COVERITY_ARCHIVE}" COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*') - export PATH=${PATH}:${COVERITY_PATH}/bin/ - elif find . -name "*.tar.gz" > /dev/null 2>&1; then - ls ./*.tar.gz - fatal "Downloaded coverity tool tarball does not appear to be the version we were expecting, exiting." + export PATH="${PATH}:${COVERITY_PATH}/bin/" + elif find "${TMP_DIR}" -name "*.tar.gz" > /dev/null 2>&1; then + ls "${TMP_DIR}"/*.tar.gz + fatal "Downloaded coverity tool tarball does not appear to be the file-name we were expecting, exiting." else fatal "Failed to download coverity tool tarball!" fi @@ -187,7 +183,6 @@ installit() { fi progress "Coverity scan tools are installed." - cd "$ORIGINAL_DIR" # Clean temp directory [ -n "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" diff --git a/packaging/utils/find-dll-deps.sh b/packaging/utils/find-dll-deps.sh new file mode 100644 index 000000000..9f4fe3847 --- /dev/null +++ b/packaging/utils/find-dll-deps.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +if [ "$#" -lt 1 ]; then + echo "Usage: $0 <command1> <command2> ... <commandN>" + exit 1 +fi + +results=() + +for arg in "$@"; do + while IFS= read -r line; do + results+=("$line") + done < <(ldd "$arg" | grep /usr/bin | awk '{ print $3 }') +done + +printf "%s\n" "${results[@]}" | sort | uniq diff --git a/packaging/utils/installer.nsi b/packaging/utils/installer.nsi deleted file mode 100644 index b78f52ffe..000000000 --- a/packaging/utils/installer.nsi +++ /dev/null @@ -1,34 +0,0 @@ -Outfile "netdata-installer.exe" -InstallDir "C:\netdata" - -RequestExecutionLevel admin - -Section - SetOutPath $INSTDIR - WriteUninstaller $INSTDIR\uninstaller.exe -SectionEnd - -Section "Install MSYS2 environment" - SetOutPath $TEMP - - SetCompress off - File "C:\msys64\msys2-installer.exe" - nsExec::ExecToLog 'cmd.exe /C "$TEMP\msys2-installer.exe" in --confirm-command --accept-messages --root $INSTDIR' - - Delete "$TEMP\msys2-installer.exe" -SectionEnd - -Section "Install MSYS2 packages" - ExecWait '"$INSTDIR\usr\bin\bash.exe" -lc "pacman -S --noconfirm msys/libuv msys/protobuf"' -SectionEnd - -Section "Install Netdata" - SetOutPath $INSTDIR\opt\netdata - - SetCompress off - File /r "C:\msys64\opt\netdata\*.*" -SectionEnd - -Section "Uninstall" - nsExec::ExecToLog 'cmd.exe /C "$INSTDIR\uninstall.exe" pr --confirm-command' -SectionEnd diff --git a/packaging/utils/package-windows.sh b/packaging/utils/package-windows.sh deleted file mode 100644 index b6996b9ec..000000000 --- a/packaging/utils/package-windows.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -export PATH="/usr/local/bin:${PATH}" - -WT_ROOT="$(pwd)" -NULL="" - -if [ -z "${MSYSTEM}" ]; then - build="${WT_ROOT}/build-${OSTYPE}" -else - build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}" -fi - -if [ "$USER" = "vk" ]; then - build="${WT_ROOT}/build" -fi - -set -exu -o pipefail - -ninja -v -C "${build}" install - -if [ ! -f "/msys2-installer.exe" ]; then - wget -O /msys2-installer.exe \ - "https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-x86_64-20240507.exe" -fi - -makensis "${WT_ROOT}/packaging/utils/installer.nsi" diff --git a/packaging/utils/protoc.bat b/packaging/utils/protoc.bat deleted file mode 100644 index fe7a76f27..000000000 --- a/packaging/utils/protoc.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -:: -:: The problem with /usr/bin/protoc is that it accepts colon separated (:) paths at its parameters. -:: This makes C:/ being parsed as 2 paths: C and /, which of course both fail. -:: To overcome this problem, we use bash_execute.sh, which replaces all occurences of C: with /c. -:: -set "batch_dir=%~dp0" -set "batch_dir=%batch_dir:\=/%" -C:\msys64\usr\bin\bash.exe %batch_dir%/bash_execute.sh protoc %* diff --git a/packaging/utils/windows-openssh-to-msys.bat b/packaging/utils/windows-openssh-to-msys.bat deleted file mode 100644 index 829cb4845..000000000 --- a/packaging/utils/windows-openssh-to-msys.bat +++ /dev/null @@ -1,118 +0,0 @@ -@echo off -:: -:: This script will: -:: -:: 1. install the windows OpenSSH server (either via dsim or download it) -:: 2. activate the windows OpenSSH service -:: 3. open OpenSSH TCP port at windows firewall -:: 4. create a small batch file to start an MSYS session -:: 5. Set the default OpenSSH startup script to start the MSYS session -:: -:: Problems: -:: On older windows versions, terminal emulation is broken. -:: So, on windows 10 or windows server before 2019, the ssh session -:: will not have proper terminal emulation and will be not be able to -:: be used for editing files. -:: For more info check: -:: https://github.com/PowerShell/Win32-OpenSSH/issues/1260 -:: - -:: Check if OpenSSH Server is already installed -sc query sshd >nul 2>&1 -if %errorlevel% neq 0 ( - echo "OpenSSH Server not found. Attempting to install via dism..." - goto :install_openssh_dism -) else ( - echo "OpenSSH Server is already installed." - goto :configure_openssh -) - -:: Install OpenSSH using dism -:install_openssh_dism -dism /online /Enable-Feature /FeatureName:OpenSSH-Client /All >nul 2>&1 -dism /online /Enable-Feature /FeatureName:OpenSSH-Server /All >nul 2>&1 - -:: Check if dism succeeded in installing OpenSSH -sc query sshd >nul 2>&1 -if %errorlevel% neq 0 ( - echo "OpenSSH installation via dism failed or is unavailable." - goto :install_openssh_manual -) else ( - echo "OpenSSH installed successfully using dism." - goto :configure_openssh -) - -:: Function to Install OpenSSH manually if dism fails -:install_openssh_manual -echo "Installing OpenSSH manually..." - -:: Download the latest OpenSSH release -set DOWNLOAD_URL=https://github.com/PowerShell/Win32-OpenSSH/releases/download/v9.5.0.0p1-Beta/OpenSSH-Win64.zip -set DOWNLOAD_FILE=%temp%\OpenSSH-Win64.zip -set INSTALL_DIR=C:\Program Files\OpenSSH-Win64 - -:: Create the installation directory if it doesn't exist -if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%" - -:: Attempt to download OpenSSH using Invoke-WebRequest and TLS configuration -powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; try { Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%DOWNLOAD_FILE%' -UseBasicParsing; exit 0 } catch { exit 1 }" -if %errorlevel% neq 0 ( - echo "Invoke-WebRequest download failed. Attempting to download using curl..." - curl -L -o "%DOWNLOAD_FILE%" "%DOWNLOAD_URL%" - if %errorlevel% neq 0 ( - echo "Failed to download OpenSSH using curl. Exiting..." - exit /b 1 - ) -) - -:: Unzip directly to INSTALL_DIR (flatten the folder structure) -powershell -Command "Expand-Archive -Path '%DOWNLOAD_FILE%' -DestinationPath '%INSTALL_DIR%' -Force" -if %errorlevel% neq 0 ( - echo "Failed to unzip OpenSSH package." - exit /b 1 -) - -:: Move inner contents to INSTALL_DIR if nested OpenSSH-Win64 folder exists -if exist "%INSTALL_DIR%\OpenSSH-Win64" ( - xcopy "%INSTALL_DIR%\OpenSSH-Win64\*" "%INSTALL_DIR%\" /s /e /y - rmdir "%INSTALL_DIR%\OpenSSH-Win64" /s /q -) - -:: Add the OpenSSH binaries to the system PATH -setx /M PATH "%INSTALL_DIR%;%PATH%" - -:: Register OpenSSH utilities as services using PowerShell -powershell -ExecutionPolicy Bypass -Command "& '%INSTALL_DIR%\install-sshd.ps1'" - -:: Verify if manual installation succeeded -sc query sshd >nul 2>&1 -if %errorlevel% neq 0 ( - echo "Manual OpenSSH installation failed. Exiting..." - exit /b 1 -) else ( - echo "OpenSSH installed successfully manually." - goto :configure_openssh -) - -:configure_openssh -:: Ensure OpenSSH Server service is set to start automatically and start the service -sc config sshd start= auto -net start sshd - -:: Create msys2.bat file with specific content -set MSYS2_PATH=C:\msys64 -if not exist "%MSYS2_PATH%" ( - echo "Error: %MSYS2_PATH% does not exist." - exit /b 1 -) - -echo @%MSYS2_PATH%\msys2_shell.cmd -defterm -here -no-start -msys > %MSYS2_PATH%\msys2.bat - -:: Run PowerShell command to set default shell -powershell -Command "New-ItemProperty -Path 'HKLM:\SOFTWARE\OpenSSH' -Name 'DefaultShell' -Value '%MSYS2_PATH%\msys2.bat' -PropertyType String -Force" - -:: Open the Windows Firewall for sshd (using PowerShell) -powershell -Command "New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd) Incoming' -Description 'Allow incoming SSH traffic via OpenSSH server' -Enabled True -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow" - -echo "OpenSSH has been successfully configured with MSYS2 as the default shell, and the firewall has been opened for sshd." -pause |