opn
This commit is contained in:
1 parent
222775a043
commit
02870305bc
4 files changed
+23
-8
No files matched your search
Binary file not shown.
@@ -7,17 +7,28 @@ PATCH_ROOT=/opt/rust-package-builder/opnsense/patches
|
||||
|
||||
[[ -f "$SOURCE_DIR/Cargo.toml" ]] || fatal "missing Cargo.toml in FreeBSD build source: $SOURCE_DIR"
|
||||
|
||||
VERSION=$(python3 - "$SOURCE_DIR/Cargo.toml" <<'PY'
|
||||
import sys, tomllib
|
||||
# build-release.sh already resolves the Cargo package version and exports VERSION.
|
||||
# Reuse it here so the FreeBSD branch does not need to parse Cargo.toml again.
|
||||
SOURCE_VERSION=${VERSION:-}
|
||||
if [[ -z "$SOURCE_VERSION" ]]; then
|
||||
# Fallback for standalone/manual use of this helper. Rocky Linux 9 exposes
|
||||
# python3 as Python 3.9, while tomllib is part of the stdlib from Python 3.11.
|
||||
PYTHON_BIN=${RUST_PROXY_PYTHON:-/usr/bin/python3.11}
|
||||
[[ -x "$PYTHON_BIN" ]] || fatal "Python 3.11 not found: $PYTHON_BIN"
|
||||
SOURCE_VERSION=$("$PYTHON_BIN" - "$SOURCE_DIR/Cargo.toml" <<'PY'
|
||||
import sys
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
with Path(sys.argv[1]).open('rb') as f:
|
||||
print(tomllib.load(f)['package']['version'])
|
||||
PY
|
||||
)
|
||||
)
|
||||
fi
|
||||
|
||||
PATCH_DIR="$PATCH_ROOT/$VERSION"
|
||||
[[ -n "$SOURCE_VERSION" ]] || fatal "cannot determine RustProxy version for FreeBSD patch selection"
|
||||
PATCH_DIR="$PATCH_ROOT/$SOURCE_VERSION"
|
||||
if [[ ! -d "$PATCH_DIR" ]]; then
|
||||
log "no FreeBSD/OPNsense patch set for RustProxy $VERSION; using upstream source"
|
||||
log "no FreeBSD/OPNsense patch set for RustProxy $SOURCE_VERSION; using upstream source"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -25,7 +36,7 @@ shopt -s nullglob
|
||||
patches=("$PATCH_DIR"/*.patch)
|
||||
(( ${#patches[@]} > 0 )) || fatal "FreeBSD patch directory is empty: $PATCH_DIR"
|
||||
|
||||
log "applying FreeBSD/OPNsense patches for RustProxy $VERSION"
|
||||
log "applying FreeBSD/OPNsense patches for RustProxy $SOURCE_VERSION"
|
||||
for patch_file in "${patches[@]}"; do
|
||||
patch_name=$(basename "$patch_file")
|
||||
if git -C "$SOURCE_DIR" apply --check "$patch_file" 2>/dev/null; then
|
||||
@@ -34,6 +45,6 @@ for patch_file in "${patches[@]}"; do
|
||||
elif git -C "$SOURCE_DIR" apply --reverse --check "$patch_file" 2>/dev/null; then
|
||||
log "patch already present: $patch_name"
|
||||
else
|
||||
fatal "patch does not apply cleanly: $patch_name (RustProxy $VERSION)"
|
||||
fatal "patch does not apply cleanly: $patch_name (RustProxy $SOURCE_VERSION)"
|
||||
fi
|
||||
done
|
||||
Reference in new issue
Block a user