mirror of
https://github.com/radareorg/r2xsql.git
synced 2026-11-07 06:36:02 -10:00
Add source user installs and verify released r2pm binaries
This commit is contained in:
1 parent
9df012ee10
commit
5417ccc164
9 files changed
+135
-5
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Test the public release through r2pm using radare2's official distribution.
|
||||
set -euo pipefail
|
||||
mkdir -p build-r2-runtime
|
||||
base="https://github.com/radareorg/radare2/releases/download/${R2_REF}"
|
||||
case "$RUNNER_OS" in
|
||||
Linux)
|
||||
curl -fsSL -o build-r2-runtime/radare2.deb "$base/radare2_${R2_REF}_amd64.deb"
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y ./build-r2-runtime/radare2.deb
|
||||
;;
|
||||
Windows)
|
||||
curl -fsSL -o build-r2-runtime/radare2.zip "$base/radare2-${R2_REF}-w64.zip"
|
||||
unzip -q build-r2-runtime/radare2.zip -d build-r2-runtime
|
||||
r2=$(find "$PWD/build-r2-runtime" -name radare2.exe -type f -print -quit)
|
||||
[[ -n "$r2" ]]
|
||||
export PATH="$(dirname "$r2"):$PATH"
|
||||
;;
|
||||
*) echo "Unsupported runner: $RUNNER_OS" >&2; exit 1 ;;
|
||||
esac
|
||||
r2pm -U
|
||||
r2pm -bi r2xsql
|
||||
python3 tests/smoke.py "$(command -v radare2)"
|
||||
r2pm -u r2xsql
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Exercise the source installation paths used outside the release archives.
|
||||
set -euo pipefail
|
||||
export PATH="$PWD/r2prefix/bin:$PATH"
|
||||
export LD_LIBRARY_PATH="$PWD/r2prefix/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
export DYLD_LIBRARY_PATH="$PWD/r2prefix/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
|
||||
export PKG_CONFIG_PATH="$PWD/r2prefix/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||
|
||||
if [[ "$RUNNER_OS" == Windows ]]; then
|
||||
cmake --build build --config Release --target user-install
|
||||
else
|
||||
make -j2 user-install LIBXSQL_DIR="$PWD/build/_deps/libxsql-src"
|
||||
fi
|
||||
python3 tests/smoke.py ./r2prefix/bin/radare2
|
||||
if [[ "$RUNNER_OS" == Windows ]]; then
|
||||
cmake --build build --config Release --target user-uninstall
|
||||
else
|
||||
make user-uninstall
|
||||
fi
|
||||
@@ -64,6 +64,10 @@ jobs:
|
||||
export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/r2prefix/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
make -C tests R2XSQL_PLUGIN="$GITHUB_WORKSPACE/build/bin/core_r2xsql.so"
|
||||
|
||||
- name: Check source user installation
|
||||
shell: bash
|
||||
run: bash .github/scripts/check_user_install.sh
|
||||
|
||||
- name: Stage artifacts
|
||||
id: stage
|
||||
shell: bash
|
||||
@@ -128,6 +132,10 @@ jobs:
|
||||
-DRadare2_ROOT="$GITHUB_WORKSPACE/r2prefix"
|
||||
cmake --build build --config Release
|
||||
|
||||
- name: Check source user installation
|
||||
shell: bash
|
||||
run: bash .github/scripts/check_user_install.sh
|
||||
|
||||
- name: Stage artifacts
|
||||
id: stage
|
||||
shell: bash
|
||||
@@ -178,6 +186,10 @@ jobs:
|
||||
export DYLD_LIBRARY_PATH="$GITHUB_WORKSPACE/r2prefix/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
|
||||
make -C tests R2XSQL_PLUGIN="$GITHUB_WORKSPACE/build/bin/core_r2xsql.dylib"
|
||||
|
||||
- name: Check source user installation
|
||||
shell: bash
|
||||
run: bash .github/scripts/check_user_install.sh
|
||||
|
||||
- name: Stage artifacts
|
||||
id: stage
|
||||
shell: bash
|
||||
@@ -221,3 +233,18 @@ jobs:
|
||||
files: |
|
||||
r2xsql-*.zip
|
||||
generate_release_notes: true
|
||||
|
||||
verify-release:
|
||||
name: Install release (${{ matrix.os }})
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: publish-release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install and test the published r2pm binary
|
||||
shell: bash
|
||||
run: bash .github/scripts/check_binary_install.sh
|
||||
@@ -43,8 +43,11 @@ endif
|
||||
# $(1) is the included makefile stamp, refreshed after a managed checkout.
|
||||
define check_libxsql
|
||||
@mkdir -p $(dir $(1))
|
||||
@current=$$(git -C "$(LIBXSQL_DIR)" rev-parse --verify HEAD 2>/dev/null || echo unknown); \
|
||||
expected=$$(git -C "$(LIBXSQL_DIR)" rev-parse --verify "$(LIBXSQL_REF)^{commit}" 2>/dev/null); \
|
||||
@current=unknown; expected=unknown; \
|
||||
if [ -e "$(LIBXSQL_DIR)/.git" ]; then \
|
||||
current=$$(git -C "$(LIBXSQL_DIR)" rev-parse --verify HEAD 2>/dev/null || echo unknown); \
|
||||
expected=$$(git -C "$(LIBXSQL_DIR)" rev-parse --verify "$(LIBXSQL_REF)^{commit}" 2>/dev/null); \
|
||||
fi; \
|
||||
if [ "$$current" != "$$expected" ]; then \
|
||||
if [ "$(LIBXSQL_DIR)" = "$(BUILD)/libxsql" ]; then \
|
||||
git -C "$(LIBXSQL_DIR)" fetch origin tag "$(LIBXSQL_REF)" && \
|
||||
@@ -141,6 +144,7 @@ ifneq (,$(wildcard /usr/bin/codesign))
|
||||
endif
|
||||
|
||||
install: $(PLUGIN)
|
||||
@test -n "$(PLUGDIR)" || { echo "Cannot determine radare2 plugin directory; set PLUGDIR." >&2; exit 1; }
|
||||
mkdir -p "$(DESTDIR)$(PLUGDIR)"
|
||||
rm -f "$(DESTDIR)$(PLUGDIR)/core_r2xsql.$(R2_LIBEXT)"
|
||||
cp -f $(PLUGIN) "$(DESTDIR)$(PLUGDIR)/core_r2xsql.$(R2_LIBEXT)"
|
||||
|
||||
@@ -8,14 +8,18 @@ the host's live analysis as SQL tables, including writable annotations.
|
||||
|
||||
## Using the plugin
|
||||
|
||||
Install radare2 first, then build and install the matching plugin with r2pm:
|
||||
Install radare2 6.2.6, then install the matching release plugin with r2pm:
|
||||
|
||||
```sh
|
||||
r2pm -U
|
||||
r2pm -ci r2xsql
|
||||
r2pm -bi r2xsql
|
||||
r2 -A ./target
|
||||
```
|
||||
|
||||
To build from source on Linux/macOS, use `r2pm -ci r2xsql` or run
|
||||
`make user-install` in a checkout. Windows source builds use CMake's
|
||||
`user-install` target. See [build instructions](docs/development.md).
|
||||
|
||||
Installed plugins load automatically. Check `Lcj` and `sql?` at the r2 prompt.
|
||||
For an uninstalled build, use `r2 -i ./core_r2xsql.so -A ./target`; inside an
|
||||
existing session use `L ./core_r2xsql.so`. Substitute `.dylib` or `.dll` as
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# SPDX-License-Identifier: LicenseRef-Human-Origin-Source-1.0
|
||||
# Query at install time so cross builds can still configure without running r2.
|
||||
if(NOT PLUGIN_DIR)
|
||||
execute_process(COMMAND "${RADARE2}" -NN -H R2_USER_PLUGINS
|
||||
RESULT_VARIABLE _status OUTPUT_VARIABLE PLUGIN_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT _status STREQUAL "0" OR NOT PLUGIN_DIR)
|
||||
message(FATAL_ERROR "Cannot determine radare2 user plugin directory; set R2XSQL_USER_PLUGINS.")
|
||||
endif()
|
||||
endif()
|
||||
file(TO_CMAKE_PATH "${PLUGIN_DIR}" PLUGIN_DIR)
|
||||
get_filename_component(_name "${PLUGIN}" NAME)
|
||||
if(ACTION STREQUAL "user-install")
|
||||
file(INSTALL "${PLUGIN}" DESTINATION "${PLUGIN_DIR}" TYPE FILE)
|
||||
elseif(ACTION STREQUAL "user-uninstall")
|
||||
file(REMOVE "${PLUGIN_DIR}/${_name}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown install action: ${ACTION}")
|
||||
endif()
|
||||
message(STATUS "${ACTION}: ${PLUGIN_DIR}/${_name}")
|
||||
@@ -16,6 +16,7 @@ Windows (MSVC):
|
||||
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
|
||||
-DRadare2_ROOT=C:\path\to\radare2\prefix
|
||||
cmake --build build --config Release
|
||||
cmake --build build --config Release --target user-install
|
||||
```
|
||||
|
||||
`Radare2_ROOT` is a radare2 **install prefix** containing `include/libr/`
|
||||
@@ -23,6 +24,12 @@ and `lib/`. CMake requires radare2 and builds the libr backend and plugin by
|
||||
default; a missing radare2 installation is a configure error. The plugin is in
|
||||
`build/bin/` (`build/bin/Release/` for the MSVC Release configuration).
|
||||
|
||||
CMake's `user-install` target installs the plugin in the directory reported by
|
||||
the matching radare2's `-NN -H R2_USER_PLUGINS`, without administrator access.
|
||||
`user-uninstall` removes it. Override the destination at configure time with
|
||||
`-DR2XSQL_USER_PLUGINS=/path/to/plugins` if needed. Both targets also work on
|
||||
Linux/macOS; omit `--config Release` with a single-configuration generator.
|
||||
|
||||
`R2XSQL_BUILD_PLUGIN=OFF` disables the plugin target and
|
||||
`R2XSQL_BUILD_EXAMPLES=OFF` disables examples. C++ consumers can embed the
|
||||
library with `open_libr` and the `r2xsql_libr` target. The project also supports
|
||||
@@ -82,6 +89,11 @@ Tag the release as `v0.0.1` after the build workflow passes. Tag builds publish
|
||||
the three ZIPs only after every platform succeeds. CI tests automatic plugin
|
||||
discovery, JSON/CSV output, comment writes, error recovery, and normal/quick
|
||||
process exit on all three platforms, plus the r2r suite on Linux and macOS.
|
||||
CI also builds and checks `make user-install` on Linux/macOS and CMake's
|
||||
`user-install` target on Windows before publishing.
|
||||
After publication, CI installs the public binaries with `r2pm -bi r2xsql`
|
||||
against the official Linux and Windows radare2 distributions and runs the
|
||||
same smoke checks.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
+6
-1
@@ -10,9 +10,14 @@ Install radare2, then install a matching r2xsql plugin:
|
||||
|
||||
```sh
|
||||
r2pm -U
|
||||
r2pm -ci r2xsql
|
||||
r2pm -bi r2xsql
|
||||
```
|
||||
|
||||
Release `v0.0.1` targets radare2 6.2.6. For a source build on Linux/macOS,
|
||||
use `r2pm -ci r2xsql` or `make user-install`. Windows source builds use
|
||||
`cmake --build build --config Release --target user-install` after
|
||||
[configuring CMake](development.md).
|
||||
|
||||
Installed plugins load automatically on normal startup. `make user-install`
|
||||
does the same for a local build. Manual installation uses the directory
|
||||
reported by `r2 -NN -H R2_USER_PLUGINS`. Restart a host after installation.
|
||||
|
||||
@@ -51,3 +51,18 @@ xsql_add_versioninfo(core_r2xsql
|
||||
FILETYPE VFT_DLL
|
||||
DESCRIPTION "r2xsql in-r2 plugin (sql command)"
|
||||
ORIGINAL_FILENAME "core_r2xsql.dll")
|
||||
|
||||
if(R2XSQL_STANDALONE)
|
||||
set(R2XSQL_USER_PLUGINS "" CACHE PATH "Override the per-user radare2 plugin directory")
|
||||
foreach(_action user-install user-uninstall)
|
||||
add_custom_target(${_action}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DRADARE2=${Radare2_EXECUTABLE}"
|
||||
"-DPLUGIN=$<TARGET_FILE:core_r2xsql>"
|
||||
"-DPLUGIN_DIR=${R2XSQL_USER_PLUGINS}"
|
||||
"-DACTION=${_action}"
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/user-install.cmake"
|
||||
VERBATIM)
|
||||
endforeach()
|
||||
add_dependencies(user-install core_r2xsql)
|
||||
endif()
|
||||
Reference in new issue
Block a user