mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-04 11:02:39 +00:00
Compare commits
9 Commits
develop
...
legleux/li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bfc19d0e1 | ||
|
|
08a42f5d52 | ||
|
|
cf38fc54db | ||
|
|
9776d466ba | ||
|
|
b66178f6fc | ||
|
|
587f5d2f5e | ||
|
|
cb94f83c7f | ||
|
|
a9a4446674 | ||
|
|
c001f703dc |
14
.github/scripts/strategy-matrix/generate.py
vendored
14
.github/scripts/strategy-matrix/generate.py
vendored
@@ -99,14 +99,15 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# RHEL:
|
# RHEL:
|
||||||
# - 9 using GCC 12: Debug on linux/amd64.
|
# - 9 using GCC 12: Debug and Release on linux/amd64
|
||||||
|
# (Release is required for RPM packaging).
|
||||||
# - 10 using Clang: Release on linux/amd64.
|
# - 10 using Clang: Release on linux/amd64.
|
||||||
if os["distro_name"] == "rhel":
|
if os["distro_name"] == "rhel":
|
||||||
skip = True
|
skip = True
|
||||||
if os["distro_version"] == "9":
|
if os["distro_version"] == "9":
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
||||||
and build_type == "Debug"
|
and build_type in ["Debug", "Release"]
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
@@ -121,7 +122,8 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Ubuntu:
|
# Ubuntu:
|
||||||
# - Jammy using GCC 12: Debug on linux/arm64.
|
# - Jammy using GCC 12: Debug on linux/arm64, Release on
|
||||||
|
# linux/amd64 (Release is required for DEB packaging).
|
||||||
# - Noble using GCC 14: Release on linux/amd64.
|
# - Noble using GCC 14: Release on linux/amd64.
|
||||||
# - Noble using Clang 18: Debug on linux/amd64.
|
# - Noble using Clang 18: Debug on linux/amd64.
|
||||||
# - Noble using Clang 19: Release on linux/arm64.
|
# - Noble using Clang 19: Release on linux/arm64.
|
||||||
@@ -134,6 +136,12 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
and architecture["platform"] == "linux/arm64"
|
and architecture["platform"] == "linux/arm64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
|
if (
|
||||||
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
||||||
|
and build_type == "Release"
|
||||||
|
and architecture["platform"] == "linux/amd64"
|
||||||
|
):
|
||||||
|
skip = False
|
||||||
elif os["distro_version"] == "noble":
|
elif os["distro_version"] == "noble":
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-14"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-14"
|
||||||
|
|||||||
36
.github/workflows/on-pr.yml
vendored
36
.github/workflows/on-pr.yml
vendored
@@ -67,6 +67,7 @@ jobs:
|
|||||||
.github/workflows/reusable-build-test.yml
|
.github/workflows/reusable-build-test.yml
|
||||||
.github/workflows/reusable-clang-tidy.yml
|
.github/workflows/reusable-clang-tidy.yml
|
||||||
.github/workflows/reusable-clang-tidy-files.yml
|
.github/workflows/reusable-clang-tidy-files.yml
|
||||||
|
.github/workflows/reusable-package.yml
|
||||||
.github/workflows/reusable-strategy-matrix.yml
|
.github/workflows/reusable-strategy-matrix.yml
|
||||||
.github/workflows/reusable-test.yml
|
.github/workflows/reusable-test.yml
|
||||||
.github/workflows/reusable-upload-recipe.yml
|
.github/workflows/reusable-upload-recipe.yml
|
||||||
@@ -81,6 +82,8 @@ jobs:
|
|||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
conanfile.py
|
conanfile.py
|
||||||
conan.lock
|
conan.lock
|
||||||
|
package/**
|
||||||
|
|
||||||
- name: Check whether to run
|
- name: Check whether to run
|
||||||
# This step determines whether the rest of the workflow should
|
# This step determines whether the rest of the workflow should
|
||||||
# run. The rest of the workflow will run if this job runs AND at
|
# run. The rest of the workflow will run if this job runs AND at
|
||||||
@@ -137,6 +140,39 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
generate-version:
|
||||||
|
needs: should-run
|
||||||
|
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- name: Generate version
|
||||||
|
id: version
|
||||||
|
uses: ./.github/actions/generate-version
|
||||||
|
|
||||||
|
package-deb:
|
||||||
|
needs: [should-run, build-test, generate-version]
|
||||||
|
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||||
|
uses: ./.github/workflows/reusable-package.yml
|
||||||
|
with:
|
||||||
|
pkg_type: deb
|
||||||
|
artifact_name: xrpld-ubuntu-jammy-gcc-12-amd64-release
|
||||||
|
version: ${{ needs.generate-version.outputs.version }}
|
||||||
|
container_image: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
|
||||||
|
|
||||||
|
package-rpm:
|
||||||
|
needs: [should-run, build-test, generate-version]
|
||||||
|
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||||
|
uses: ./.github/workflows/reusable-package.yml
|
||||||
|
with:
|
||||||
|
pkg_type: rpm
|
||||||
|
artifact_name: xrpld-rhel-9-gcc-12-amd64-release
|
||||||
|
version: ${{ needs.generate-version.outputs.version }}
|
||||||
|
container_image: ghcr.io/xrplf/ci/rhel-9:gcc-12
|
||||||
|
|
||||||
upload-recipe:
|
upload-recipe:
|
||||||
needs:
|
needs:
|
||||||
- should-run
|
- should-run
|
||||||
|
|||||||
50
.github/workflows/on-tag.yml
vendored
50
.github/workflows/on-tag.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
# This workflow uploads the libxrpl recipe to the Conan remote when a versioned
|
# This workflow uploads the libxrpl recipe to the Conan remote and builds
|
||||||
# tag is pushed.
|
# release packages when a versioned tag is pushed.
|
||||||
name: Tag
|
name: Tag
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -22,3 +22,49 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||||
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||||
|
|
||||||
|
build-test:
|
||||||
|
if: ${{ github.repository == 'XRPLF/rippled' }}
|
||||||
|
uses: ./.github/workflows/reusable-build-test.yml
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
os: [linux]
|
||||||
|
with:
|
||||||
|
ccache_enabled: false
|
||||||
|
os: ${{ matrix.os }}
|
||||||
|
strategy_matrix: minimal
|
||||||
|
secrets:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
generate-version:
|
||||||
|
if: ${{ github.repository == 'XRPLF/rippled' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- name: Generate version
|
||||||
|
id: version
|
||||||
|
uses: ./.github/actions/generate-version
|
||||||
|
|
||||||
|
package-deb:
|
||||||
|
needs: [build-test, generate-version]
|
||||||
|
if: ${{ github.repository == 'XRPLF/rippled' }}
|
||||||
|
uses: ./.github/workflows/reusable-package.yml
|
||||||
|
with:
|
||||||
|
pkg_type: deb
|
||||||
|
artifact_name: xrpld-ubuntu-jammy-gcc-12-amd64-release
|
||||||
|
version: ${{ needs.generate-version.outputs.version }}
|
||||||
|
container_image: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
|
||||||
|
|
||||||
|
package-rpm:
|
||||||
|
needs: [build-test, generate-version]
|
||||||
|
if: ${{ github.repository == 'XRPLF/rippled' }}
|
||||||
|
uses: ./.github/workflows/reusable-package.yml
|
||||||
|
with:
|
||||||
|
pkg_type: rpm
|
||||||
|
artifact_name: xrpld-rhel-9-gcc-12-amd64-release
|
||||||
|
version: ${{ needs.generate-version.outputs.version }}
|
||||||
|
container_image: ghcr.io/xrplf/ci/rhel-9:gcc-12
|
||||||
|
|||||||
31
.github/workflows/on-trigger.yml
vendored
31
.github/workflows/on-trigger.yml
vendored
@@ -38,6 +38,8 @@ on:
|
|||||||
- "CMakeLists.txt"
|
- "CMakeLists.txt"
|
||||||
- "conanfile.py"
|
- "conanfile.py"
|
||||||
- "conan.lock"
|
- "conan.lock"
|
||||||
|
- "package/**"
|
||||||
|
- ".github/workflows/reusable-package.yml"
|
||||||
|
|
||||||
# Run at 06:32 UTC on every day of the week from Monday through Friday. This
|
# Run at 06:32 UTC on every day of the week from Monday through Friday. This
|
||||||
# will force all dependencies to be rebuilt, which is useful to verify that
|
# will force all dependencies to be rebuilt, which is useful to verify that
|
||||||
@@ -98,3 +100,32 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||||
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||||
|
|
||||||
|
generate-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- name: Generate version
|
||||||
|
id: version
|
||||||
|
uses: ./.github/actions/generate-version
|
||||||
|
|
||||||
|
package-deb:
|
||||||
|
needs: [build-test, generate-version]
|
||||||
|
uses: ./.github/workflows/reusable-package.yml
|
||||||
|
with:
|
||||||
|
pkg_type: deb
|
||||||
|
artifact_name: xrpld-ubuntu-jammy-gcc-12-amd64-release
|
||||||
|
version: ${{ needs.generate-version.outputs.version }}
|
||||||
|
container_image: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
|
||||||
|
|
||||||
|
package-rpm:
|
||||||
|
needs: [build-test, generate-version]
|
||||||
|
uses: ./.github/workflows/reusable-package.yml
|
||||||
|
with:
|
||||||
|
pkg_type: rpm
|
||||||
|
artifact_name: xrpld-rhel-9-gcc-12-amd64-release
|
||||||
|
version: ${{ needs.generate-version.outputs.version }}
|
||||||
|
container_image: ghcr.io/xrplf/ci/rhel-9:gcc-12
|
||||||
|
|||||||
83
.github/workflows/reusable-package.yml
vendored
Normal file
83
.github/workflows/reusable-package.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Build a Linux package (DEB or RPM) from a pre-built binary artifact.
|
||||||
|
name: Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
pkg_type:
|
||||||
|
description: "Package type to build: deb or rpm."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
artifact_name:
|
||||||
|
description: "Name of the pre-built binary artifact to download."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
version:
|
||||||
|
description: "Version string used for naming the output artifact."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
pkg_release:
|
||||||
|
description: "Package release number. Increment when repackaging the same executable."
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "1"
|
||||||
|
container_image:
|
||||||
|
description: "Container image to use for packaging."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILD_DIR: build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
package:
|
||||||
|
name: ${{ inputs.pkg_type }} (${{ inputs.version }})
|
||||||
|
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
|
||||||
|
container: ${{ inputs.container_image }}
|
||||||
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Download pre-built binary
|
||||||
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.artifact_name }}
|
||||||
|
path: ${{ env.BUILD_DIR }}
|
||||||
|
|
||||||
|
- name: Make binary executable
|
||||||
|
run: chmod +x "${BUILD_DIR}/xrpld"
|
||||||
|
|
||||||
|
- name: Generate RPM spec from template
|
||||||
|
if: ${{ inputs.pkg_type == 'rpm' }}
|
||||||
|
env:
|
||||||
|
PKG_VERSION: ${{ inputs.version }}
|
||||||
|
PKG_RELEASE: ${{ inputs.pkg_release }}
|
||||||
|
run: |
|
||||||
|
mkdir -p "${BUILD_DIR}/package/rpm"
|
||||||
|
sed -e "s/@xrpld_version@/${PKG_VERSION}/" \
|
||||||
|
-e "s/@pkg_release@/${PKG_RELEASE}/" \
|
||||||
|
package/rpm/xrpld.spec.in > "${BUILD_DIR}/package/rpm/xrpld.spec"
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
env:
|
||||||
|
PKG_TYPE: ${{ inputs.pkg_type }}
|
||||||
|
PKG_VERSION: ${{ inputs.version }}
|
||||||
|
PKG_RELEASE: ${{ inputs.pkg_release }}
|
||||||
|
run: |
|
||||||
|
./package/build_pkg.sh "$PKG_TYPE" . "$BUILD_DIR" "$PKG_VERSION" "$PKG_RELEASE"
|
||||||
|
|
||||||
|
- name: Upload package artifact
|
||||||
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
|
with:
|
||||||
|
name: xrpld-${{ inputs.pkg_type }}-${{ inputs.version }}
|
||||||
|
path: |
|
||||||
|
${{ env.BUILD_DIR }}/debbuild/*.deb
|
||||||
|
${{ env.BUILD_DIR }}/debbuild/*.ddeb
|
||||||
|
${{ env.BUILD_DIR }}/rpmbuild/RPMS/**/*.rpm
|
||||||
|
if-no-files-found: error
|
||||||
@@ -133,6 +133,7 @@ endif()
|
|||||||
|
|
||||||
include(XrplCore)
|
include(XrplCore)
|
||||||
include(XrplInstall)
|
include(XrplInstall)
|
||||||
|
include(XrplPackaging)
|
||||||
include(XrplValidatorKeys)
|
include(XrplValidatorKeys)
|
||||||
|
|
||||||
if(tests)
|
if(tests)
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ if(is_root_project AND TARGET xrpld)
|
|||||||
|
|
||||||
install(
|
install(
|
||||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/cfg/xrpld-example.cfg"
|
FILES "${CMAKE_CURRENT_SOURCE_DIR}/cfg/xrpld-example.cfg"
|
||||||
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/xrpld"
|
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}"
|
||||||
RENAME xrpld.cfg
|
RENAME xrpld.cfg
|
||||||
COMPONENT runtime
|
COMPONENT runtime
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt"
|
FILES "${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt"
|
||||||
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/xrpld"
|
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}"
|
||||||
RENAME validators.txt
|
RENAME validators.txt
|
||||||
COMPONENT runtime
|
COMPONENT runtime
|
||||||
)
|
)
|
||||||
|
|||||||
142
cmake/XrplPackaging.cmake
Normal file
142
cmake/XrplPackaging.cmake
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
#[===================================================================[
|
||||||
|
Linux packaging support: RPM and Debian targets + install tests
|
||||||
|
#]===================================================================]
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/opt/xrpld")
|
||||||
|
message(
|
||||||
|
STATUS
|
||||||
|
"Packaging targets require -DCMAKE_INSTALL_PREFIX=/opt/xrpld "
|
||||||
|
"(current: '${CMAKE_INSTALL_PREFIX}'); skipping."
|
||||||
|
)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED pkg_release)
|
||||||
|
set(pkg_release 1)
|
||||||
|
endif()
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_SOURCE_DIR}/package/rpm/xrpld.spec.in
|
||||||
|
${CMAKE_BINARY_DIR}/package/rpm/xrpld.spec
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
find_program(RPMBUILD_EXECUTABLE rpmbuild)
|
||||||
|
if(RPMBUILD_EXECUTABLE)
|
||||||
|
add_custom_target(
|
||||||
|
package-rpm
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_SOURCE_DIR}/package/build_pkg.sh rpm ${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
COMMENT "Building RPM package"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(STATUS "rpmbuild not found; 'package-rpm' target not available")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(DPKG_BUILDPACKAGE_EXECUTABLE dpkg-buildpackage)
|
||||||
|
if(DPKG_BUILDPACKAGE_EXECUTABLE)
|
||||||
|
add_custom_target(
|
||||||
|
package-deb
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_SOURCE_DIR}/package/build_pkg.sh deb ${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR} ${xrpld_version}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
COMMENT "Building Debian package"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(
|
||||||
|
STATUS
|
||||||
|
"dpkg-buildpackage not found; 'package-deb' target not available"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#[===================================================================[
|
||||||
|
CTest fixtures for package install verification (requires docker)
|
||||||
|
#]===================================================================]
|
||||||
|
|
||||||
|
find_program(DOCKER_EXECUTABLE docker)
|
||||||
|
if(NOT DOCKER_EXECUTABLE)
|
||||||
|
message(STATUS "docker not found; package install tests not available")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DEB_TEST_IMAGE "geerlingguy/docker-ubuntu2204-ansible:latest")
|
||||||
|
set(RPM_TEST_IMAGE "geerlingguy/docker-rockylinux9-ansible:latest")
|
||||||
|
|
||||||
|
foreach(PKG deb rpm)
|
||||||
|
if(PKG STREQUAL "deb")
|
||||||
|
set(IMAGE ${DEB_TEST_IMAGE})
|
||||||
|
else()
|
||||||
|
set(IMAGE ${RPM_TEST_IMAGE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This image runs systemd for full testing xrpld.service
|
||||||
|
add_test(
|
||||||
|
NAME ${PKG}_container_start
|
||||||
|
COMMAND
|
||||||
|
sh -c
|
||||||
|
"docker rm -f xrpld_${PKG}_install_test 2>/dev/null || true && \
|
||||||
|
docker run -d \
|
||||||
|
--name xrpld_${PKG}_install_test \
|
||||||
|
--cgroupns host \
|
||||||
|
--volume '${CMAKE_SOURCE_DIR}:/root:ro' \
|
||||||
|
--volume /sys/fs/cgroup:/sys/fs/cgroup:rw \
|
||||||
|
--tmpfs /tmp --tmpfs /run \
|
||||||
|
--tmpfs /run/lock \
|
||||||
|
${IMAGE} \
|
||||||
|
/usr/sbin/init"
|
||||||
|
)
|
||||||
|
set_tests_properties(
|
||||||
|
${PKG}_container_start
|
||||||
|
PROPERTIES FIXTURES_SETUP ${PKG}_container LABELS packaging
|
||||||
|
)
|
||||||
|
|
||||||
|
# On CI: always stop. Locally: leave running on failure for diagnosis.
|
||||||
|
add_test(
|
||||||
|
NAME ${PKG}_container_stop
|
||||||
|
COMMAND
|
||||||
|
sh -c
|
||||||
|
"if [ -n \"$CI\" ] || ! docker exec xrpld_${PKG}_install_test test -f /tmp/test_failed 2>/dev/null; then \
|
||||||
|
docker rm -f xrpld_${PKG}_install_test; \
|
||||||
|
else \
|
||||||
|
echo 'Tests failed — leaving xrpld_${PKG}_install_test running for diagnosis'; \
|
||||||
|
echo 'Clean up with: docker rm -f xrpld_${PKG}_install_test'; \
|
||||||
|
fi"
|
||||||
|
)
|
||||||
|
set_tests_properties(
|
||||||
|
${PKG}_container_stop
|
||||||
|
PROPERTIES FIXTURES_CLEANUP ${PKG}_container LABELS packaging
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME ${PKG}_install
|
||||||
|
COMMAND
|
||||||
|
docker exec -w /root xrpld_${PKG}_install_test bash
|
||||||
|
/root/package/test/smoketest.sh local
|
||||||
|
)
|
||||||
|
set_tests_properties(
|
||||||
|
${PKG}_install
|
||||||
|
PROPERTIES
|
||||||
|
FIXTURES_REQUIRED ${PKG}_container
|
||||||
|
FIXTURES_SETUP ${PKG}_installed
|
||||||
|
LABELS packaging
|
||||||
|
TIMEOUT 600
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME ${PKG}_install_paths
|
||||||
|
COMMAND
|
||||||
|
docker exec -w /root xrpld_${PKG}_install_test sh
|
||||||
|
/root/package/test/check_install_paths.sh
|
||||||
|
)
|
||||||
|
set_tests_properties(
|
||||||
|
${PKG}_install_paths
|
||||||
|
PROPERTIES
|
||||||
|
FIXTURES_REQUIRED "${PKG}_container;${PKG}_installed"
|
||||||
|
LABELS packaging
|
||||||
|
TIMEOUT 60
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
@@ -93,11 +93,14 @@ words:
|
|||||||
- desync
|
- desync
|
||||||
- desynced
|
- desynced
|
||||||
- determ
|
- determ
|
||||||
|
- disablerepo
|
||||||
- distro
|
- distro
|
||||||
- doxyfile
|
- doxyfile
|
||||||
- dxrpl
|
- dxrpl
|
||||||
|
- enablerepo
|
||||||
- endmacro
|
- endmacro
|
||||||
- exceptioned
|
- exceptioned
|
||||||
|
- EXPECT_STREQ
|
||||||
- Falco
|
- Falco
|
||||||
- fcontext
|
- fcontext
|
||||||
- finalizers
|
- finalizers
|
||||||
@@ -151,6 +154,7 @@ words:
|
|||||||
- Merkle
|
- Merkle
|
||||||
- Metafuncton
|
- Metafuncton
|
||||||
- misprediction
|
- misprediction
|
||||||
|
- missingok
|
||||||
- mptbalance
|
- mptbalance
|
||||||
- MPTDEX
|
- MPTDEX
|
||||||
- mptflags
|
- mptflags
|
||||||
@@ -181,7 +185,9 @@ words:
|
|||||||
- NOLINT
|
- NOLINT
|
||||||
- NOLINTNEXTLINE
|
- NOLINTNEXTLINE
|
||||||
- nonxrp
|
- nonxrp
|
||||||
|
- noreplace
|
||||||
- noripple
|
- noripple
|
||||||
|
- notifempty
|
||||||
- nudb
|
- nudb
|
||||||
- nullptr
|
- nullptr
|
||||||
- nunl
|
- nunl
|
||||||
@@ -201,6 +207,7 @@ words:
|
|||||||
- preauthorize
|
- preauthorize
|
||||||
- preauthorizes
|
- preauthorizes
|
||||||
- preclaim
|
- preclaim
|
||||||
|
- preun
|
||||||
- protobuf
|
- protobuf
|
||||||
- protos
|
- protos
|
||||||
- ptrs
|
- ptrs
|
||||||
@@ -235,12 +242,14 @@ words:
|
|||||||
- sfields
|
- sfields
|
||||||
- shamap
|
- shamap
|
||||||
- shamapitem
|
- shamapitem
|
||||||
|
- shlibs
|
||||||
- sidechain
|
- sidechain
|
||||||
- SIGGOOD
|
- SIGGOOD
|
||||||
- sle
|
- sle
|
||||||
- sles
|
- sles
|
||||||
- soci
|
- soci
|
||||||
- socidb
|
- socidb
|
||||||
|
- SRPMS
|
||||||
- sslws
|
- sslws
|
||||||
- statsd
|
- statsd
|
||||||
- STATSDCOLLECTOR
|
- STATSDCOLLECTOR
|
||||||
@@ -268,8 +277,8 @@ words:
|
|||||||
- txn
|
- txn
|
||||||
- txns
|
- txns
|
||||||
- txs
|
- txs
|
||||||
- UBSAN
|
|
||||||
- ubsan
|
- ubsan
|
||||||
|
- UBSAN
|
||||||
- umant
|
- umant
|
||||||
- unacquired
|
- unacquired
|
||||||
- unambiguity
|
- unambiguity
|
||||||
@@ -306,7 +315,6 @@ words:
|
|||||||
- xbridge
|
- xbridge
|
||||||
- xchain
|
- xchain
|
||||||
- ximinez
|
- ximinez
|
||||||
- EXPECT_STREQ
|
|
||||||
- XMACRO
|
- XMACRO
|
||||||
- xrpkuwait
|
- xrpkuwait
|
||||||
- xrpl
|
- xrpl
|
||||||
|
|||||||
118
package/README.md
Normal file
118
package/README.md
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
# Linux Packaging
|
||||||
|
|
||||||
|
This directory contains all files needed to build RPM and Debian packages for `xrpld`.
|
||||||
|
|
||||||
|
## Directory layout
|
||||||
|
|
||||||
|
```
|
||||||
|
package/
|
||||||
|
build_pkg.sh Staging and build script (called by CMake targets and CI)
|
||||||
|
rpm/
|
||||||
|
xrpld.spec.in RPM spec template (substitutes @xrpld_version@, @pkg_release@)
|
||||||
|
deb/
|
||||||
|
debian/ Debian control files (control, rules, install, links, conffiles, ...)
|
||||||
|
shared/
|
||||||
|
xrpld.service systemd unit file (used by both RPM and DEB)
|
||||||
|
xrpld.sysusers sysusers.d config (used by both RPM and DEB)
|
||||||
|
xrpld.tmpfiles tmpfiles.d config (used by both RPM and DEB)
|
||||||
|
xrpld.logrotate logrotate config (installed to /opt/xrpld/bin/, user activates)
|
||||||
|
update-xrpld.sh auto-update script (installed to /opt/xrpld/bin/)
|
||||||
|
update-xrpld-cron cron entry for auto-update (installed to /opt/xrpld/bin/)
|
||||||
|
test/
|
||||||
|
smoketest.sh Package install smoke test
|
||||||
|
check_install_paths.sh Verify install paths and compat symlinks
|
||||||
|
```
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
| Package type | Container | Tool required |
|
||||||
|
| ------------ | -------------------------------------- | --------------------------------------------------------------- |
|
||||||
|
| RPM | `ghcr.io/xrplf/ci/rhel-9:gcc-12` | `rpmbuild` |
|
||||||
|
| DEB | `ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12` | `dpkg-buildpackage`, `debhelper (>= 13)`, `dh-sequence-systemd` |
|
||||||
|
|
||||||
|
## Building packages
|
||||||
|
|
||||||
|
### Via CI (recommended)
|
||||||
|
|
||||||
|
The `reusable-package.yml` workflow downloads a pre-built `xrpld` binary artifact
|
||||||
|
and calls `build_pkg.sh` directly. No CMake configure or build step is needed in
|
||||||
|
the packaging job.
|
||||||
|
|
||||||
|
### Via CMake (local development)
|
||||||
|
|
||||||
|
Configure with the required install prefix, then invoke the target:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/opt/xrpld \
|
||||||
|
-Dxrpld=ON \
|
||||||
|
-Dtests=OFF \
|
||||||
|
..
|
||||||
|
|
||||||
|
# RPM (in RHEL container):
|
||||||
|
cmake --build . --target package-rpm
|
||||||
|
|
||||||
|
# DEB (in Debian/Ubuntu container):
|
||||||
|
cmake --build . --target package-deb
|
||||||
|
```
|
||||||
|
|
||||||
|
The `cmake/XrplPackaging.cmake` module gates each target on whether the required
|
||||||
|
tool (`rpmbuild` / `dpkg-buildpackage`) is present at configure time, so
|
||||||
|
configuring on a host that lacks one simply omits the corresponding target.
|
||||||
|
|
||||||
|
`CMAKE_INSTALL_PREFIX` must be `/opt/xrpld`; if it is not, both targets are
|
||||||
|
skipped with a `STATUS` message.
|
||||||
|
|
||||||
|
## How `build_pkg.sh` works
|
||||||
|
|
||||||
|
`build_pkg.sh <pkg_type> <src_dir> <build_dir> [version] [pkg_release]` stages
|
||||||
|
all files and invokes the platform build tool. It resolves `src_dir` and
|
||||||
|
`build_dir` to absolute paths, then calls `stage_common()` to copy the binary,
|
||||||
|
config files, and shared support files into the staging area.
|
||||||
|
|
||||||
|
### RPM
|
||||||
|
|
||||||
|
1. Creates the standard `rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}` tree inside the build directory.
|
||||||
|
2. Copies the generated `xrpld.spec` and all source files (binary, configs, service files) into `SOURCES/`.
|
||||||
|
3. Runs `rpmbuild -bb`. The spec uses manual `install` commands to place files.
|
||||||
|
4. Output: `rpmbuild/RPMS/x86_64/xrpld-*.rpm`
|
||||||
|
|
||||||
|
### DEB
|
||||||
|
|
||||||
|
1. Creates a staging source tree at `debbuild/source/` inside the build directory.
|
||||||
|
2. Stages the binary, configs, `README.md`, and `LICENSE.md`.
|
||||||
|
3. Copies `package/deb/debian/` control files into `debbuild/source/debian/`.
|
||||||
|
4. Copies shared service/sysusers/tmpfiles into `debian/` where `dh_installsystemd`, `dh_installsysusers`, and `dh_installtmpfiles` pick them up automatically.
|
||||||
|
5. Generates a minimal `debian/changelog` (pre-release versions use `~` instead of `-`).
|
||||||
|
6. Runs `dpkg-buildpackage -b --no-sign`. `debian/rules` uses manual `install` commands.
|
||||||
|
7. Output: `debbuild/*.deb` and `debbuild/*.ddeb` (dbgsym package)
|
||||||
|
|
||||||
|
## Post-build verification
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# DEB
|
||||||
|
dpkg-deb -c debbuild/*.deb | grep -E 'systemd|sysusers|tmpfiles'
|
||||||
|
lintian -I debbuild/*.deb
|
||||||
|
|
||||||
|
# RPM
|
||||||
|
rpm -qlp rpmbuild/RPMS/x86_64/*.rpm
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reproducibility
|
||||||
|
|
||||||
|
The following environment variables improve build reproducibility. They are not
|
||||||
|
set automatically by `build_pkg.sh`; set them manually if needed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
||||||
|
export TZ=UTC
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export GZIP=-n
|
||||||
|
export DEB_BUILD_OPTIONS="noautodbgsym reproducible=+fixfilepath"
|
||||||
|
```
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- Port debsigs signing instructions and integrate into CI.
|
||||||
|
- Port RPM GPG signing setup (key import + `%{?_gpg_sign}` in spec).
|
||||||
|
- Introduce a virtual package for key rotation.
|
||||||
92
package/build_pkg.sh
Executable file
92
package/build_pkg.sh
Executable file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build an RPM or Debian package from a pre-built xrpld binary.
|
||||||
|
#
|
||||||
|
# Usage: build_pkg.sh <pkg_type> <src_dir> <build_dir> [version] [pkg_release]
|
||||||
|
# pkg_type : rpm | deb
|
||||||
|
# src_dir : path to repository root
|
||||||
|
# build_dir : directory containing the pre-built xrpld binary
|
||||||
|
# version : package version string (e.g. 2.4.0-b1)
|
||||||
|
# pkg_release : package release number (default: 1)
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PKG_TYPE="${1:?pkg_type required}"
|
||||||
|
SRC_DIR="$(cd "${2:?src_dir required}" && pwd)"
|
||||||
|
BUILD_DIR="$(cd "${3:?build_dir required}" && pwd)"
|
||||||
|
VERSION="${4:-1.0.0}"
|
||||||
|
PKG_RELEASE="${5:-1}"
|
||||||
|
|
||||||
|
SHARED="${SRC_DIR}/package/shared"
|
||||||
|
|
||||||
|
# Stage files common to both package types into a target directory.
|
||||||
|
stage_common() {
|
||||||
|
local dest="$1"
|
||||||
|
cp "${BUILD_DIR}/xrpld" "${dest}/xrpld"
|
||||||
|
cp "${SRC_DIR}/cfg/xrpld-example.cfg" "${dest}/xrpld.cfg"
|
||||||
|
cp "${SRC_DIR}/cfg/validators-example.txt" "${dest}/validators.txt"
|
||||||
|
cp "${SHARED}/xrpld.logrotate" "${dest}/xrpld.logrotate"
|
||||||
|
cp "${SHARED}/update-xrpld.sh" "${dest}/update-xrpld.sh"
|
||||||
|
cp "${SHARED}/update-xrpld-cron" "${dest}/update-xrpld-cron"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_rpm() {
|
||||||
|
local topdir="${BUILD_DIR}/rpmbuild"
|
||||||
|
mkdir -p "${topdir}"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
|
||||||
|
cp "${BUILD_DIR}/package/rpm/xrpld.spec" "${topdir}/SPECS/xrpld.spec"
|
||||||
|
|
||||||
|
stage_common "${topdir}/SOURCES"
|
||||||
|
cp "${SHARED}/xrpld.service" "${topdir}/SOURCES/xrpld.service"
|
||||||
|
cp "${SHARED}/xrpld.sysusers" "${topdir}/SOURCES/xrpld.sysusers"
|
||||||
|
cp "${SHARED}/xrpld.tmpfiles" "${topdir}/SOURCES/xrpld.tmpfiles"
|
||||||
|
cp "${SRC_DIR}/LICENSE.md" "${topdir}/SOURCES/LICENSE.md"
|
||||||
|
cp "${SRC_DIR}/README.md" "${topdir}/SOURCES/README.md"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
rpmbuild -bb \
|
||||||
|
--define "_topdir ${topdir}" \
|
||||||
|
"${topdir}/SPECS/xrpld.spec"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_deb() {
|
||||||
|
local staging="${BUILD_DIR}/debbuild/source"
|
||||||
|
rm -rf "${staging}"
|
||||||
|
mkdir -p "${staging}"
|
||||||
|
|
||||||
|
stage_common "${staging}"
|
||||||
|
cp "${SRC_DIR}/README.md" "${staging}/"
|
||||||
|
cp "${SRC_DIR}/LICENSE.md" "${staging}/"
|
||||||
|
|
||||||
|
# debian/ control files
|
||||||
|
cp -r "${SRC_DIR}/package/deb/debian" "${staging}/debian"
|
||||||
|
|
||||||
|
# Shared support files for dh_installsystemd / sysusers / tmpfiles
|
||||||
|
cp "${SHARED}/xrpld.service" "${staging}/debian/xrpld.service"
|
||||||
|
cp "${SHARED}/xrpld.sysusers" "${staging}/debian/xrpld.sysusers"
|
||||||
|
cp "${SHARED}/xrpld.tmpfiles" "${staging}/debian/xrpld.tmpfiles"
|
||||||
|
|
||||||
|
# Generate debian/changelog (pre-release versions use ~ instead of -).
|
||||||
|
local deb_version="${VERSION//-/\~}"
|
||||||
|
# TODO: Add facility for generating the changelog
|
||||||
|
cat > "${staging}/debian/changelog" <<EOF
|
||||||
|
xrpld (${deb_version}-${PKG_RELEASE}) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Release ${VERSION}.
|
||||||
|
|
||||||
|
-- XRPL Foundation <contact@xrplf.org> $(LC_ALL=C date -u -R)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x "${staging}/debian/rules"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
( cd "${staging}" && dpkg-buildpackage -b --no-sign -d )
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${PKG_TYPE}" in
|
||||||
|
rpm) build_rpm ;;
|
||||||
|
deb) build_deb ;;
|
||||||
|
*)
|
||||||
|
echo "Unknown package type: ${PKG_TYPE}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
23
package/deb/debian/control
Normal file
23
package/deb/debian/control
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Source: xrpld
|
||||||
|
Section: net
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: XRPL Foundation <contact@xrplf.org>
|
||||||
|
Rules-Requires-Root: no
|
||||||
|
Build-Depends:
|
||||||
|
debhelper-compat (= 13)
|
||||||
|
Standards-Version: 4.7.0
|
||||||
|
Homepage: https://github.com/XRPLF/rippled
|
||||||
|
Vcs-Git: https://github.com/XRPLF/rippled.git
|
||||||
|
Vcs-Browser: https://github.com/XRPLF/rippled
|
||||||
|
|
||||||
|
Package: xrpld
|
||||||
|
Section: net
|
||||||
|
Priority: optional
|
||||||
|
Architecture: any
|
||||||
|
Depends:
|
||||||
|
${shlibs:Depends},
|
||||||
|
${misc:Depends}
|
||||||
|
Description: XRP Ledger daemon
|
||||||
|
Reference implementation of the XRP Ledger protocol. Participates
|
||||||
|
in the peer-to-peer network, processes transactions, and maintains
|
||||||
|
a local ledger copy.
|
||||||
20
package/deb/debian/copyright
Normal file
20
package/deb/debian/copyright
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: rippled
|
||||||
|
Source: https://github.com/XRPLF/rippled
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2012-2025 Ripple Labs Inc.
|
||||||
|
License: ISC
|
||||||
|
|
||||||
|
License: ISC
|
||||||
|
Permission to use, copy, modify, and distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
35
package/deb/debian/rules
Normal file
35
package/deb/debian/rules
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
export DH_VERBOSE = 1
|
||||||
|
export DH_OPTIONS = -v
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_auto_configure override_dh_auto_build override_dh_auto_test:
|
||||||
|
@:
|
||||||
|
|
||||||
|
override_dh_auto_install:
|
||||||
|
install -Dm0755 xrpld debian/tmp/opt/xrpld/bin/xrpld
|
||||||
|
install -Dm0644 xrpld.cfg debian/tmp/opt/xrpld/etc/xrpld.cfg
|
||||||
|
install -Dm0644 validators.txt debian/tmp/opt/xrpld/etc/validators.txt
|
||||||
|
install -Dm0644 xrpld.logrotate debian/tmp/opt/xrpld/bin/xrpld.logrotate
|
||||||
|
install -Dm0755 update-xrpld.sh debian/tmp/opt/xrpld/bin/update-xrpld.sh
|
||||||
|
install -Dm0644 update-xrpld-cron debian/tmp/opt/xrpld/bin/update-xrpld-cron
|
||||||
|
install -Dm0644 README.md debian/tmp/usr/share/doc/xrpld/README.md
|
||||||
|
install -Dm0644 LICENSE.md debian/tmp/usr/share/doc/xrpld/LICENSE.md
|
||||||
|
|
||||||
|
override_dh_installsystemd:
|
||||||
|
dh_installsystemd
|
||||||
|
|
||||||
|
override_dh_installsysusers:
|
||||||
|
dh_installsysusers
|
||||||
|
|
||||||
|
override_dh_installtmpfiles:
|
||||||
|
dh_installtmpfiles
|
||||||
|
|
||||||
|
override_dh_install:
|
||||||
|
dh_install
|
||||||
|
|
||||||
|
override_dh_dwz:
|
||||||
|
@:
|
||||||
1
package/deb/debian/source/format
Normal file
1
package/deb/debian/source/format
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0 (quilt)
|
||||||
2
package/deb/debian/xrpld.conffiles
Normal file
2
package/deb/debian/xrpld.conffiles
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/opt/xrpld/etc/xrpld.cfg
|
||||||
|
/opt/xrpld/etc/validators.txt
|
||||||
10
package/deb/debian/xrpld.install
Normal file
10
package/deb/debian/xrpld.install
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
opt/xrpld/bin/xrpld
|
||||||
|
opt/xrpld/bin/xrpld.logrotate
|
||||||
|
opt/xrpld/bin/update-xrpld.sh
|
||||||
|
opt/xrpld/bin/update-xrpld-cron
|
||||||
|
|
||||||
|
opt/xrpld/etc/xrpld.cfg
|
||||||
|
opt/xrpld/etc/validators.txt
|
||||||
|
|
||||||
|
usr/share/doc/xrpld/README.md
|
||||||
|
usr/share/doc/xrpld/LICENSE.md
|
||||||
10
package/deb/debian/xrpld.links
Normal file
10
package/deb/debian/xrpld.links
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
opt/xrpld/etc etc/opt/xrpld
|
||||||
|
|
||||||
|
opt/xrpld/bin/xrpld usr/bin/xrpld
|
||||||
|
|
||||||
|
## remove when "rippled" deprecated
|
||||||
|
opt/xrpld/bin/xrpld opt/xrpld/bin/rippled
|
||||||
|
opt/xrpld/bin/xrpld usr/local/bin/rippled
|
||||||
|
opt/xrpld/etc/xrpld.cfg opt/xrpld/etc/rippled.cfg
|
||||||
|
opt/xrpld opt/ripple
|
||||||
|
etc/opt/xrpld etc/opt/ripple
|
||||||
121
package/rpm/xrpld.spec.in
Normal file
121
package/rpm/xrpld.spec.in
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
%global xrpld_version @xrpld_version@
|
||||||
|
%global pkg_release @pkg_release@
|
||||||
|
%global _opt_prefix /opt/xrpld
|
||||||
|
%global ver_base %(v=%{xrpld_version}; echo ${v%%-*})
|
||||||
|
%global _has_dash %(v=%{xrpld_version}; [ "${v#*-}" != "$v" ] && echo 1 || echo 0)
|
||||||
|
%if 0%{?_has_dash}
|
||||||
|
%global ver_suffix %(v=%{xrpld_version}; printf %s "${v#*-}")
|
||||||
|
%endif
|
||||||
|
Name: xrpld
|
||||||
|
Version: %{ver_base}
|
||||||
|
Release: %{?ver_suffix:0.%{ver_suffix}.}%{pkg_release}%{?dist}
|
||||||
|
Summary: XRP Ledger daemon
|
||||||
|
|
||||||
|
License: ISC
|
||||||
|
URL: https://github.com/XRPLF/rippled
|
||||||
|
|
||||||
|
Source0: xrpld
|
||||||
|
Source1: xrpld.cfg
|
||||||
|
Source2: validators.txt
|
||||||
|
Source3: xrpld.service
|
||||||
|
Source4: xrpld.sysusers
|
||||||
|
Source5: xrpld.tmpfiles
|
||||||
|
Source6: xrpld.logrotate
|
||||||
|
Source7: update-xrpld.sh
|
||||||
|
Source8: update-xrpld-cron
|
||||||
|
Source9: LICENSE.md
|
||||||
|
Source10: README.md
|
||||||
|
|
||||||
|
ExclusiveArch: x86_64
|
||||||
|
BuildRequires: systemd-rpm-macros
|
||||||
|
|
||||||
|
%undefine _debugsource_packages
|
||||||
|
%debug_package
|
||||||
|
|
||||||
|
%{?systemd_requires}
|
||||||
|
%{?sysusers_requires_compat}
|
||||||
|
|
||||||
|
%description
|
||||||
|
xrpld is the reference implementation of the XRP Ledger protocol. It
|
||||||
|
participates in the peer-to-peer XRP Ledger network, processes
|
||||||
|
transactions, and maintains the ledger database.
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
|
# Suppress debugsource subpackage — no source files in the build tree.
|
||||||
|
touch %{_builddir}/debugsourcefiles.list
|
||||||
|
|
||||||
|
# Install binary and config files.
|
||||||
|
install -Dm0755 %{SOURCE0} %{buildroot}%{_opt_prefix}/bin/xrpld
|
||||||
|
install -Dm0644 %{SOURCE1} %{buildroot}%{_opt_prefix}/etc/xrpld.cfg
|
||||||
|
install -Dm0644 %{SOURCE2} %{buildroot}%{_opt_prefix}/etc/validators.txt
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}/etc/opt %{buildroot}/usr/bin %{buildroot}/usr/local/bin
|
||||||
|
ln -s %{_opt_prefix}/etc %{buildroot}/etc/opt/xrpld
|
||||||
|
ln -s %{_opt_prefix}/bin/xrpld %{buildroot}/usr/bin/xrpld
|
||||||
|
|
||||||
|
## remove when "rippled" deprecated
|
||||||
|
ln -s xrpld %{buildroot}%{_opt_prefix}/bin/rippled
|
||||||
|
ln -s %{_opt_prefix}/bin/xrpld %{buildroot}/usr/local/bin/rippled
|
||||||
|
ln -s xrpld.cfg %{buildroot}%{_opt_prefix}/etc/rippled.cfg
|
||||||
|
ln -s %{_opt_prefix} %{buildroot}/opt/ripple
|
||||||
|
ln -s /etc/opt/xrpld %{buildroot}/etc/opt/ripple
|
||||||
|
|
||||||
|
# Install systemd/sysusers/tmpfiles support files.
|
||||||
|
install -Dm0644 %{SOURCE3} %{buildroot}%{_unitdir}/xrpld.service
|
||||||
|
install -Dm0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/xrpld.conf
|
||||||
|
install -Dm0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/xrpld.conf
|
||||||
|
install -Dm0644 %{SOURCE6} %{buildroot}%{_opt_prefix}/bin/xrpld.logrotate
|
||||||
|
install -Dm0755 %{SOURCE7} %{buildroot}%{_opt_prefix}/bin/update-xrpld.sh
|
||||||
|
install -Dm0644 %{SOURCE8} %{buildroot}%{_opt_prefix}/bin/update-xrpld-cron
|
||||||
|
|
||||||
|
# Install doc/license files.
|
||||||
|
install -Dm0644 %{SOURCE9} %{buildroot}%{_opt_prefix}/share/LICENSE.md
|
||||||
|
install -Dm0644 %{SOURCE10} %{buildroot}%{_opt_prefix}/share/README.md
|
||||||
|
|
||||||
|
%pre
|
||||||
|
%sysusers_create_compat %{SOURCE4}
|
||||||
|
|
||||||
|
%post
|
||||||
|
systemd-tmpfiles --create %{_tmpfilesdir}/xrpld.conf || :
|
||||||
|
%systemd_post xrpld.service
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun xrpld.service
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun_with_restart xrpld.service
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license %{_opt_prefix}/share/LICENSE.md
|
||||||
|
%doc %{_opt_prefix}/share/README.md
|
||||||
|
|
||||||
|
%dir %{_opt_prefix}
|
||||||
|
%dir %{_opt_prefix}/bin
|
||||||
|
%dir %{_opt_prefix}/etc
|
||||||
|
|
||||||
|
%{_opt_prefix}/bin/xrpld
|
||||||
|
%{_opt_prefix}/bin/xrpld.logrotate
|
||||||
|
%{_opt_prefix}/bin/update-xrpld.sh
|
||||||
|
%{_opt_prefix}/bin/update-xrpld-cron
|
||||||
|
|
||||||
|
/usr/bin/xrpld
|
||||||
|
/etc/opt/xrpld
|
||||||
|
|
||||||
|
%config(noreplace) %{_opt_prefix}/etc/xrpld.cfg
|
||||||
|
%config(noreplace) %{_opt_prefix}/etc/validators.txt
|
||||||
|
|
||||||
|
%{_unitdir}/xrpld.service
|
||||||
|
%{_sysusersdir}/xrpld.conf
|
||||||
|
%{_tmpfilesdir}/xrpld.conf
|
||||||
|
|
||||||
|
%ghost %dir /var/lib/xrpld
|
||||||
|
%ghost %dir /var/log/xrpld
|
||||||
|
|
||||||
|
# TODO: remove when rippled deprecated
|
||||||
|
%{_opt_prefix}/bin/rippled
|
||||||
|
/usr/local/bin/rippled
|
||||||
|
%{_opt_prefix}/etc/rippled.cfg
|
||||||
|
/etc/opt/ripple
|
||||||
|
/opt/ripple
|
||||||
9
package/shared/update-xrpld-cron
Normal file
9
package/shared/update-xrpld-cron
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# For automatic updates, symlink this file to /etc/cron.d/
|
||||||
|
# Do not remove the newline at the end of this cron script
|
||||||
|
|
||||||
|
# bash required for use of RANDOM below.
|
||||||
|
SHELL=/bin/bash
|
||||||
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
|
||||||
|
# invoke check/update script with random delay up to 59 mins
|
||||||
|
0 * * * * root sleep $((RANDOM*3540/32768)) && /opt/xrpld/bin/update-xrpld.sh
|
||||||
74
package/shared/update-xrpld.sh
Executable file
74
package/shared/update-xrpld.sh
Executable file
@@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# auto-update script for xrpld daemon
|
||||||
|
|
||||||
|
# Check for sudo/root permissions
|
||||||
|
if [[ $(id -u) -ne 0 ]] ; then
|
||||||
|
echo "This update script must be run as root or sudo"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCKDIR=/run/lock/xrpld-update.lock
|
||||||
|
UPDATELOG=/var/log/xrpld/update.log
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
# If this directory isn't removed, future updates will fail.
|
||||||
|
rmdir "$LOCKDIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use mkdir to check if process is already running. mkdir is atomic, as against file create.
|
||||||
|
if ! mkdir "$LOCKDIR" 2>/dev/null; then
|
||||||
|
echo "$(date -u) lockdir exists - won't proceed." >> "$UPDATELOG"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
can_update=false
|
||||||
|
|
||||||
|
if command -v apt-get &>/dev/null; then
|
||||||
|
apt-get update -qq
|
||||||
|
|
||||||
|
if apt-get -s --only-upgrade install xrpld 2>/dev/null | grep -q '^Inst xrpld'; then
|
||||||
|
can_update=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
function apply_update {
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq xrpld
|
||||||
|
}
|
||||||
|
elif command -v yum &>/dev/null; then
|
||||||
|
REPO=${REPO:-stable}
|
||||||
|
if [[ ! "$REPO" =~ ^(stable|unstable|nightly|develop)$ ]]; then
|
||||||
|
echo "Invalid REPO value: ${REPO}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
yum --disablerepo=* --enablerepo="ripple-${REPO}" clean expire-cache
|
||||||
|
|
||||||
|
# yum check-update exits 100 when updates are available, 0 for none, 1 for errors.
|
||||||
|
yum check-update -q --enablerepo="ripple-${REPO}" xrpld
|
||||||
|
rc=$?
|
||||||
|
if [ $rc -eq 100 ]; then
|
||||||
|
can_update=true
|
||||||
|
elif [ $rc -ne 0 ]; then
|
||||||
|
echo "yum check-update failed with exit code $rc"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
function apply_update {
|
||||||
|
yum update -y --enablerepo="ripple-${REPO}" xrpld
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo "No supported package manager found (apt-get or yum)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Do the actual update and restart the service after reloading systemctl daemon.
|
||||||
|
if [ "$can_update" = true ] ; then
|
||||||
|
exec >>"${UPDATELOG}" 2>&1
|
||||||
|
set -e
|
||||||
|
apply_update
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart xrpld.service
|
||||||
|
echo "$(date -u) xrpld daemon updated."
|
||||||
|
else
|
||||||
|
echo "$(date -u) no updates available" >> "$UPDATELOG"
|
||||||
|
fi
|
||||||
15
package/shared/xrpld.logrotate
Normal file
15
package/shared/xrpld.logrotate
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/var/log/xrpld/*.log {
|
||||||
|
daily
|
||||||
|
minsize 200M
|
||||||
|
rotate 7
|
||||||
|
nocreate
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
compresscmd /usr/bin/nice
|
||||||
|
compressoptions -n19 ionice -c3 gzip
|
||||||
|
compressext .gz
|
||||||
|
postrotate
|
||||||
|
/opt/xrpld/bin/xrpld --conf /etc/opt/xrpld/xrpld.cfg logrotate
|
||||||
|
endscript
|
||||||
|
}
|
||||||
21
package/shared/xrpld.service
Normal file
21
package/shared/xrpld.service
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=XRP Ledger Daemon
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
StartLimitIntervalSec=60
|
||||||
|
StartLimitBurst=3
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/opt/xrpld/bin/xrpld --net --silent --conf /etc/opt/xrpld/xrpld.cfg
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
NoNewPrivileges=true
|
||||||
|
ProtectSystem=full
|
||||||
|
PrivateTmp=true
|
||||||
|
User=xrpld
|
||||||
|
Group=xrpld
|
||||||
|
LimitNOFILE=65536
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
1
package/shared/xrpld.sysusers
Normal file
1
package/shared/xrpld.sysusers
Normal file
@@ -0,0 +1 @@
|
|||||||
|
u xrpld - "XRP Ledger daemon" /var/lib/xrpld /sbin/nologin
|
||||||
2
package/shared/xrpld.tmpfiles
Normal file
2
package/shared/xrpld.tmpfiles
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
d /var/lib/xrpld 0750 xrpld xrpld -
|
||||||
|
d /var/log/xrpld 0750 xrpld xrpld -
|
||||||
45
package/test/check_install_paths.sh
Executable file
45
package/test/check_install_paths.sh
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# Validate installed paths and compat symlinks for xrpld packages.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
trap 'test $? -ne 0 && touch /tmp/test_failed' EXIT
|
||||||
|
|
||||||
|
check() { test $1 "$2" || { echo "FAIL: $1 $2"; exit 1; }; }
|
||||||
|
check_resolves_to() {
|
||||||
|
actual=$(readlink -f "$1")
|
||||||
|
[ "$actual" = "$2" ] || { echo "FAIL: $1 resolves to $actual, expected $2"; exit 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
# compat directory symlinks — existence and resolved target
|
||||||
|
check -L /opt/ripple
|
||||||
|
check_resolves_to /opt/ripple /opt/xrpld
|
||||||
|
|
||||||
|
check -L /etc/opt/xrpld
|
||||||
|
check_resolves_to /etc/opt/xrpld /opt/xrpld/etc
|
||||||
|
|
||||||
|
check -L /etc/opt/ripple
|
||||||
|
check_resolves_to /etc/opt/ripple /opt/xrpld/etc
|
||||||
|
|
||||||
|
# config accessible via all expected paths
|
||||||
|
check -f /opt/xrpld/etc/xrpld.cfg
|
||||||
|
check -f /opt/xrpld/etc/rippled.cfg
|
||||||
|
check -f /etc/opt/xrpld/xrpld.cfg
|
||||||
|
check -f /etc/opt/xrpld/rippled.cfg
|
||||||
|
check -f /etc/opt/ripple/xrpld.cfg
|
||||||
|
check -f /etc/opt/ripple/rippled.cfg
|
||||||
|
|
||||||
|
if systemctl is-system-running >/dev/null 2>&1; then
|
||||||
|
# service file sanity check
|
||||||
|
SERVICE=$(systemctl cat xrpld)
|
||||||
|
echo "$SERVICE" | grep -q 'ExecStart=/opt/xrpld/bin/xrpld' || { echo "FAIL: ExecStart wrong"; echo "$SERVICE"; exit 1; }
|
||||||
|
echo "$SERVICE" | grep -q 'User=xrpld' || { echo "FAIL: User not xrpld"; echo "$SERVICE"; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
# binary accessible via all expected paths
|
||||||
|
/opt/xrpld/bin/xrpld --version
|
||||||
|
/opt/xrpld/bin/rippled --version
|
||||||
|
/opt/ripple/bin/xrpld --version
|
||||||
|
/opt/ripple/bin/rippled --version
|
||||||
|
/usr/bin/xrpld --version
|
||||||
|
/usr/local/bin/rippled --version
|
||||||
88
package/test/smoketest.sh
Executable file
88
package/test/smoketest.sh
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Install a locally-built package and run basic verification.
|
||||||
|
#
|
||||||
|
# Usage: smoketest.sh local
|
||||||
|
# Expects packages in build/{dpkg,rpm}/packages/ or build/debbuild/ / build/rpmbuild/RPMS/
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
set -x
|
||||||
|
rm -f /tmp/test_failed /tmp/unittest_results
|
||||||
|
trap 'test $? -ne 0 && touch /tmp/test_failed' EXIT
|
||||||
|
|
||||||
|
install_from=$1
|
||||||
|
|
||||||
|
. /etc/os-release
|
||||||
|
case ${ID} in
|
||||||
|
ubuntu|debian)
|
||||||
|
pkgtype="dpkg"
|
||||||
|
;;
|
||||||
|
fedora|centos|rhel|rocky|almalinux)
|
||||||
|
pkgtype="rpm"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unrecognized distro!"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "${install_from}" != "local" ]; then
|
||||||
|
echo "only 'local' install mode is supported"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install the package
|
||||||
|
if [ "${pkgtype}" = "dpkg" ] ; then
|
||||||
|
apt-get -y update
|
||||||
|
# Find .deb files — check both possible output locations
|
||||||
|
mapfile -t debs < <(find build/debbuild/ build/dpkg/packages/ -name '*.deb' ! -name '*dbgsym*' 2>/dev/null)
|
||||||
|
if [ ${#debs[@]} -eq 0 ]; then
|
||||||
|
echo "No .deb files found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dpkg --no-debsig -i "${debs[@]}" || apt-get -y install -f
|
||||||
|
elif [ "${pkgtype}" = "rpm" ] ; then
|
||||||
|
# Find .rpm files — check both possible output locations
|
||||||
|
mapfile -t rpms < <(find build/rpmbuild/RPMS/ build/rpm/packages/ -name '*.rpm' \
|
||||||
|
! -name '*debug*' ! -name '*devel*' ! -name '*.src.rpm' 2>/dev/null)
|
||||||
|
if [ ${#rpms[@]} -eq 0 ]; then
|
||||||
|
echo "No .rpm files found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rpm -i "${rpms[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify installed version
|
||||||
|
VERSION_OUTPUT=$(/opt/xrpld/bin/xrpld --version)
|
||||||
|
INSTALLED=$(echo "$VERSION_OUTPUT" | head -1 | awk '{print $NF}')
|
||||||
|
echo "Installed version: ${INSTALLED}"
|
||||||
|
|
||||||
|
# Run unit tests
|
||||||
|
if [ -n "${CI:-}" ]; then
|
||||||
|
unittest_jobs=$(nproc)
|
||||||
|
else
|
||||||
|
unittest_jobs=16
|
||||||
|
fi
|
||||||
|
|
||||||
|
(
|
||||||
|
cd /tmp
|
||||||
|
/opt/xrpld/bin/xrpld --unittest --unittest-jobs "${unittest_jobs}" > /tmp/unittest_results || true
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ ! -s /tmp/unittest_results ]; then
|
||||||
|
echo "Unit test results file is empty — xrpld may have crashed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
num_failures=$(tail /tmp/unittest_results -n1 | grep -oP '\d+(?= failures)')
|
||||||
|
if [ -z "$num_failures" ]; then
|
||||||
|
echo "Could not parse unit test results — expected summary line not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "${num_failures}" -ne 0 ]; then
|
||||||
|
echo "$num_failures unit test(s) failed:"
|
||||||
|
grep 'failed:' /tmp/unittest_results
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compat path checks
|
||||||
|
"$(dirname "${BASH_SOURCE[0]}")/check_install_paths.sh"
|
||||||
Reference in New Issue
Block a user