fix: switch reqwest TLS backend from rustls to native-tls

reqwest 0.13 defaults to rustls -> aws-lc-rs which requires cmake/nasm
in minimal build environments (AUR chroot). Switch all direct reqwest
users to native-tls (system OpenSSL) to fix clean chroot build failures
reported by users.

Affected crates: owlry-core, owlry-lua, owlry-rune
PKGBUILD: add openssl to depends for all three runtime packages
Also add scripts/aur-local-test for clean chroot testing workflow
This commit is contained in:
2026-04-05 17:58:36 +02:00
parent 0a3af9fa56
commit 5615002062
9 changed files with 453 additions and 8 deletions

105
Cargo.lock generated
View File

@@ -896,6 +896,21 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
"foreign-types-shared",
]
[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.2"
@@ -1634,6 +1649,22 @@ dependencies = [
"webpki-roots",
]
[[package]]
name = "hyper-tls"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [
"bytes",
"http-body-util",
"hyper",
"hyper-util",
"native-tls",
"tokio",
"tokio-native-tls",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.20"
@@ -2259,6 +2290,23 @@ dependencies = [
"getrandom 0.2.17",
]
[[package]]
name = "native-tls"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2"
dependencies = [
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "nix"
version = "0.31.2"
@@ -2503,12 +2551,50 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "openssl"
version = "0.10.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "951c002c75e16ea2c65b8c7e4d3d51d5530d8dfa7d060b4776828c88cfb18ecf"
dependencies = [
"bitflags 2.11.0",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
]
[[package]]
name = "openssl-probe"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
[[package]]
name = "openssl-sys"
version = "0.9.112"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d55af3b3e226502be1526dfdba67ab0e9c96fc293004e79576b2b9edb0dbdb"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -3066,10 +3152,12 @@ dependencies = [
"http-body-util",
"hyper",
"hyper-rustls",
"hyper-tls",
"hyper-util",
"js-sys",
"log",
"mime",
"native-tls",
"percent-encoding",
"pin-project-lite",
"quinn",
@@ -3080,6 +3168,7 @@ dependencies = [
"serde_json",
"sync_wrapper",
"tokio",
"tokio-native-tls",
"tokio-rustls",
"tower",
"tower-http",
@@ -3794,6 +3883,16 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"native-tls",
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.26.4"
@@ -4156,6 +4255,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.2.1"

View File

@@ -6,7 +6,7 @@ pkgdesc='Core daemon for the Owlry application launcher — manages plugins, pro
arch=('x86_64')
url='https://somegit.dev/Owlibou/owlry'
license=('GPL-3.0-or-later')
depends=('gcc-libs')
depends=('gcc-libs' 'openssl')
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-core-v$pkgver.tar.gz")
b2sums=('e37383fd650a3bf9a2c554eb37676037e3ae72bbc2e1aad7c316809094254173b6fcd5ac87907c2f38ce5506e9f26201ec62f82446bc789153c280373e31fc9e')

View File

@@ -6,7 +6,7 @@ pkgdesc="Lua scripting runtime for Owlry — enables user-created Lua plugins"
arch=('x86_64')
url="https://somegit.dev/Owlibou/owlry"
license=('GPL-3.0-or-later')
depends=('owlry-core')
depends=('owlry-core' 'openssl')
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-lua-v$pkgver.tar.gz")
b2sums=('a0e1fa032db8dda8e6bc24457f3c04948129d3f14c1d3e61b8e080340b24f560d43294beb133ad4b1c6eb7942d401108ea91c367b074eaeeefa284e9b2a9dbc8')
@@ -30,7 +30,7 @@ check() {
cd "owlry"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo test -p $_cratename --frozen --release
cargo test -p $_cratename --frozen --lib
}
package() {

View File

@@ -6,7 +6,7 @@ pkgdesc="Rune scripting runtime for Owlry — enables user-created Rune plugins"
arch=('x86_64')
url="https://somegit.dev/Owlibou/owlry"
license=('GPL-3.0-or-later')
depends=('owlry-core')
depends=('owlry-core' 'openssl')
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-rune-v$pkgver.tar.gz")
b2sums=('a0e1fa032db8dda8e6bc24457f3c04948129d3f14c1d3e61b8e080340b24f560d43294beb133ad4b1c6eb7942d401108ea91c367b074eaeeefa284e9b2a9dbc8')

View File

@@ -50,7 +50,7 @@ notify-rust = "4"
# Built-in providers
meval = "0.2"
reqwest = { version = "0.13", default-features = false, features = ["rustls", "json", "blocking"] }
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "json", "blocking"] }
# Optional: embedded Lua runtime
mlua = { version = "0.11", features = ["lua54", "vendored", "send", "serialize"], optional = true }

View File

@@ -31,7 +31,7 @@ serde_json = "1.0"
semver = "1"
# HTTP client for plugins
reqwest = { version = "0.13", features = ["blocking", "json"] }
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "blocking", "json"] }
# Math expression evaluation
meval = "0.2"

View File

@@ -22,7 +22,7 @@ log = "0.4"
env_logger = "0.11"
# HTTP client for network API
reqwest = { version = "0.13", default-features = false, features = ["rustls", "json", "blocking"] }
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "json", "blocking"] }
# Serialization
serde = { version = "1", features = ["derive"] }

View File

@@ -328,7 +328,7 @@ bump-meta new_version:
# === Testing ===
# Test a specific AUR package build locally
# Quick local build test (no chroot, uses host deps)
aur-test-pkg pkg:
#!/usr/bin/env bash
set -euo pipefail
@@ -337,3 +337,14 @@ aur-test-pkg pkg:
makepkg -sf
echo "Package built successfully!"
ls -lh *.pkg.tar.zst
# Build AUR packages from the local working tree in a clean chroot.
# Packages current source (incl. uncommitted changes), patches PKGBUILD,
# builds in dep order, injects local artifacts, restores PKGBUILD on exit.
#
# Examples:
# just aur-local-test owlry-core
# just aur-local-test -c owlry-core owlry-rune
# just aur-local-test --all --reset
aur-local-test *args:
scripts/aur-local-test {{args}}

329
scripts/aur-local-test Executable file
View File

@@ -0,0 +1,329 @@
#!/usr/bin/env bash
# scripts/aur-local-test
#
# Build AUR packages from the local working tree in a clean extra chroot.
#
# Packages the current working tree (including uncommitted changes) into a
# tarball, temporarily patches each PKGBUILD to use it, runs
# extra-x86_64-build, then restores the PKGBUILD on exit regardless of
# success or failure.
#
# Packages with local AUR deps (e.g. owlry-rune depends on owlry-core) are
# built in topological order and their artifacts injected automatically.
#
# Usage: scripts/aur-local-test [OPTIONS] [PKG...]
# See --help for details.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)"
REPO_NAME="$(basename "$REPO_ROOT")"
AUR_DIR="$REPO_ROOT/aur"
# State tracked for cleanup
TMP_TARBALL=""
declare -a PKGBUILD_BACKUPS=()
declare -a PLACED_FILES=()
# Build config
RESET_CHROOT=0
declare -a INPUT_PKGS=()
declare -a EXTRA_INJECT=() # --inject paths (external AUR deps)
# ─── Output helpers ──────────────────────────────────────────────────────────
die() { echo "error: $*" >&2; exit 1; }
info() { printf '\033[1;34m==>\033[0m %s\n' "$*"; }
ok() { printf '\033[1;32m ->\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33m !\033[0m %s\n' "$*" >&2; }
fail() { printf '\033[1;31mFAIL\033[0m %s\n' "$*" >&2; }
# ─── Cleanup ─────────────────────────────────────────────────────────────────
cleanup() {
local code=$?
local f pkgbuild
# Remove tarballs placed in aur/ dirs
for f in "${PLACED_FILES[@]+"${PLACED_FILES[@]}"}"; do
[[ -f "$f" ]] && rm -f "$f"
done
# Restore patched PKGBUILDs from backups
for f in "${PKGBUILD_BACKUPS[@]+"${PKGBUILD_BACKUPS[@]}"}"; do
pkgbuild="${f%.bak}"
[[ -f "$f" ]] && mv "$f" "$pkgbuild"
done
[[ -n "$TMP_TARBALL" && -f "$TMP_TARBALL" ]] && rm -f "$TMP_TARBALL"
exit "$code"
}
trap cleanup EXIT INT TERM
# ─── Usage ───────────────────────────────────────────────────────────────────
usage() {
cat >&2 <<EOF
Usage: $(basename "$0") [OPTIONS] [PKG...]
Build AUR packages from the local working tree in a clean chroot.
Packages current working tree (incl. uncommitted changes), patches PKGBUILD
source + checksum, runs extra-x86_64-build, then restores on exit.
Packages with local AUR deps are built in topological order and their
.pkg.tar.zst artifacts are injected into dependent builds automatically.
OPTIONS
-c, --reset Reset chroot matrix (passes -c to extra-x86_64-build).
Only applied to the first package; subsequent builds
reuse the already-fresh chroot.
-a, --all Build all packages in aur/ (respects dep order).
-I, --inject FILE Inject FILE (.pkg.tar.zst) into the chroot before
building. For AUR deps not in the official repos
(e.g. owlry-core when testing owlry-plugins).
Can be repeated.
-h, --help Show this help.
EXAMPLES
# Single package
$(basename "$0") owlry-core
# Multiple packages with chroot reset
$(basename "$0") -c owlry-core owlry-rune
# All packages in dependency order
$(basename "$0") --all --reset
# owlry-plugins: inject owlry-core from sibling repo
$(basename "$0") -I ../owlry/aur/owlry-core/owlry-core-*.pkg.tar.zst --all
EOF
exit 1
}
# ─── Argument parsing ────────────────────────────────────────────────────────
while [[ $# -gt 0 ]]; do
case "$1" in
-c|--reset)
RESET_CHROOT=1
shift ;;
-a|--all)
for dir in "$AUR_DIR"/*/; do
pkg=$(basename "$dir")
[[ -f "$dir/PKGBUILD" ]] && INPUT_PKGS+=("$pkg")
done
shift ;;
-I|--inject)
[[ $# -ge 2 ]] || die "--inject requires an argument"
[[ -f "$2" ]] || die "inject file not found: $2"
EXTRA_INJECT+=("$(realpath "$2")")
shift 2 ;;
-h|--help) usage ;;
-*) die "unknown option: $1" ;;
*)
if [[ "$1" == *.pkg.tar.zst ]]; then
[[ -f "$1" ]] || die "inject file not found: $1"
EXTRA_INJECT+=("$(realpath "$1")")
else
INPUT_PKGS+=("$1")
fi
shift ;;
esac
done
[[ ${#INPUT_PKGS[@]} -eq 0 ]] && usage
# ─── Dependency resolution ───────────────────────────────────────────────────
# Return the names of local AUR packages that PKG depends on.
local_deps_of() {
local pkg="$1"
local pkgbuild="$AUR_DIR/$pkg/PKGBUILD"
[[ -f "$pkgbuild" ]] || return 0
local dep_line bare
dep_line=$(grep '^depends=' "$pkgbuild" 2>/dev/null | head -1 || true)
[[ -z "$dep_line" ]] && return 0
# Strip depends=, parens, and quotes; split on whitespace
echo "$dep_line" \
| sed "s/^depends=//; s/[()\"']/ /g" \
| tr ' ' '\n' \
| while IFS= read -r dep; do
[[ -z "$dep" ]] && continue
bare="${dep%%[><=]*}" # strip version constraints
[[ -d "$AUR_DIR/$bare" ]] && echo "$bare"
done
}
# Topological sort (DFS) — deps before dependents.
declare -A TOPO_VISITED=()
declare -a TOPO_ORDER=()
topo_visit() {
local pkg="$1"
[[ -v "TOPO_VISITED[$pkg]" ]] && return 0
TOPO_VISITED[$pkg]=1
local dep
while IFS= read -r dep; do
topo_visit "$dep"
done < <(local_deps_of "$pkg")
TOPO_ORDER+=("$pkg")
}
resolve_order() {
TOPO_VISITED=()
TOPO_ORDER=()
local pkg
for pkg in "$@"; do
topo_visit "$pkg"
done
}
# ─── Tarball creation ────────────────────────────────────────────────────────
make_tarball() {
TMP_TARBALL=$(mktemp /tmp/aur-local-XXXXXX.tar.gz)
info "Packaging ${REPO_NAME} working tree (incl. uncommitted changes)..."
tar czf "$TMP_TARBALL" \
--exclude='.git' \
--exclude='target' \
--transform "s|^\.|${REPO_NAME}|" \
-C "$REPO_ROOT" .
ok "Tarball ready: $(du -b "$TMP_TARBALL" | cut -f1 | numfmt --to=iec 2>/dev/null || wc -c < "$TMP_TARBALL") bytes"
}
# ─── PKGBUILD patching ───────────────────────────────────────────────────────
# Patch a package's PKGBUILD to use the local tarball.
# Backs up the original; cleanup() restores it on exit.
patch_pkgbuild() {
local pkg="$1"
local pkgbuild="$AUR_DIR/$pkg/PKGBUILD"
local pkgdir="$AUR_DIR/$pkg"
# Skip packages with no remote source (meta/group packages)
if ! grep -q '^source=' "$pkgbuild" || grep -qE '^source=\(\s*\)' "$pkgbuild"; then
ok "No source URL to patch — skipping tarball injection for $pkg"
return 0
fi
local pkgname pkgver filename hash
pkgname=$(grep '^pkgname=' "$pkgbuild" | cut -d= -f2- | tr -d "\"'")
pkgver=$(grep '^pkgver=' "$pkgbuild" | cut -d= -f2- | tr -d "\"'")
filename="${pkgname}-${pkgver}.tar.gz"
hash=$(b2sum "$TMP_TARBALL" | cut -d' ' -f1)
# Backup original PKGBUILD
cp "$pkgbuild" "${pkgbuild}.bak"
PKGBUILD_BACKUPS+=("${pkgbuild}.bak")
# Place local tarball where makepkg looks for it
cp "$TMP_TARBALL" "$pkgdir/$filename"
PLACED_FILES+=("$pkgdir/$filename")
# Patch source and checksum lines in-place
sed -i "s|^source=.*|source=(\"${filename}\")|" "$pkgbuild"
sed -i "s|^b2sums=.*|b2sums=('${hash}')|" "$pkgbuild"
ok "Patched PKGBUILD: source=${filename}, b2sum=${hash:0:12}…"
}
# ─── Build ───────────────────────────────────────────────────────────────────
# built_artifacts[pkg] = path to the .pkg.tar.zst produced in this run.
# Used to inject pkg artifacts into dependent builds.
declare -A BUILT_ARTIFACTS=()
find_artifact() {
local pkg="$1"
local pkgver
# pkgver is the same in patched and original PKGBUILD
pkgver=$(grep '^pkgver=' "$AUR_DIR/$pkg/PKGBUILD" | cut -d= -f2- | tr -d "\"'" \
|| grep '^pkgver=' "$AUR_DIR/$pkg/PKGBUILD.bak" | cut -d= -f2- | tr -d "\"'")
ls "$AUR_DIR/$pkg/${pkg}-${pkgver}-"*".pkg.tar.zst" 2>/dev/null \
| grep -v -- '-debug-' | sort -V | tail -1 || true
}
build_one() {
local pkg="$1"
local pkgdir="$AUR_DIR/$pkg"
info "[$pkg] Patching PKGBUILD..."
patch_pkgbuild "$pkg"
# Collect inject args: extra (external) + artifacts of local deps built earlier
local inject=()
for f in "${EXTRA_INJECT[@]+"${EXTRA_INJECT[@]}"}"; do
inject+=("-I" "$f")
done
while IFS= read -r dep; do
if [[ -v "BUILT_ARTIFACTS[$dep]" ]]; then
inject+=("-I" "${BUILT_ARTIFACTS[$dep]}")
else
warn "$pkg depends on $dep (local AUR) which was not built in this run"
warn " → Build $dep first or pass: -I path/to/${dep}-*.pkg.tar.zst"
fi
done < <(local_deps_of "$pkg")
# Build args: -c only on the first package, then cleared
local build_args=()
if [[ $RESET_CHROOT -eq 1 ]]; then
build_args+=("-c")
RESET_CHROOT=0
fi
info "[$pkg] Running extra-x86_64-build..."
(
cd "$pkgdir"
if [[ ${#inject[@]} -gt 0 ]]; then
extra-x86_64-build "${build_args[@]+"${build_args[@]}"}" -- "${inject[@]}"
else
extra-x86_64-build "${build_args[@]+"${build_args[@]}"}"
fi
)
# Record artifact for potential injection into dependents
local artifact
artifact=$(find_artifact "$pkg")
if [[ -n "$artifact" ]]; then
BUILT_ARTIFACTS[$pkg]="$artifact"
ok "[$pkg] artifact: $(basename "$artifact")"
fi
}
# ─── Main ────────────────────────────────────────────────────────────────────
# Validate all requested packages exist
for pkg in "${INPUT_PKGS[@]}"; do
[[ -d "$AUR_DIR/$pkg" && -f "$AUR_DIR/$pkg/PKGBUILD" ]] \
|| die "package not found: aur/$pkg/PKGBUILD"
done
# Sort into build order (deps before dependents)
resolve_order "${INPUT_PKGS[@]}"
# Create one tarball, reused for all packages in this run
make_tarball
declare -a FAILED=()
for pkg in "${TOPO_ORDER[@]}"; do
echo ""
if build_one "$pkg"; then
:
else
fail "[$pkg]"
FAILED+=("$pkg")
fi
done
echo ""
if [[ ${#FAILED[@]} -gt 0 ]]; then
fail "packages failed: ${FAILED[*]}"
exit 1
fi
info "All packages built successfully!"