mirror of
https://github.com/armbian/build.git
synced 2026-09-08 23:59:54 +08:00
* extensions: add @description headers and a list generator Add a one-line `# @description` header near the top of every extension in extensions/ (85 files), each ~35-45 words / 3 sentences, source-verified against the extension's actual behaviour. Two extensions with a dedicated docs page also carry a `# @doc-page` link. Add lib/tools/gen-extensions-list.py, which scans extensions/**/*.sh for these headers and prints the Markdown extensions reference consumed by the documentation repo. The list is no longer hand-maintained: edit an extension's `# @description` and the generator brings the change over. Signed-off-by: Igor Pecovnik <igor@armbian.com> * extensions: correct descriptions flagged in review, validate @doc-page Seven @description headers claimed more than the code does: cleanup-space-final-image zerofree globs ${LOOP}p?, so p10+ is not covered image-output-abl one recovery image from ABL_DTB_LIST[0], not per-DTB marvell-tools binaries-marvell and cryptopp track branches, not pins nvidia also skipped without a working headers package odin2-preset-firstrun ships hardcoded 1234 root/user passwords preset-firstrun static networking is on by default, not optional uefi-edk2-rk3588 acpi=off is a default, not forced Reword each to match, and call out the two credential hazards explicitly rather than leaving them implied. In the generator, restrict @doc-page to site-relative paths. The value goes into a Markdown link target on the published docs site and Python-Markdown does not sanitize URL schemes, so a "javascript:" target would survive into the page; unusable values are now dropped with a warning on stderr. Signed-off-by: Igor Pecovnik <igor@armbian.com> * gen-extensions-list: close two holes in @doc-page validation DOC_PAGE_RE accepted "//external.example/x". "/" is in the character class, so after the required leading slash a second one matched happily -- the protocol- relative case the comment claimed to reject sailed straight through. Add a negative lookahead. The annotation parser also matched a single \S+ token, so "@doc-page /guide extra" and a bare "@doc-page" failed to match at all and were dropped in silence, with no warning. Capture the whole value instead and let validation reject it, so malformed annotations are reported rather than ignored. Output over the current extensions/ tree is byte-identical. Signed-off-by: Igor Pecovnik <igor@armbian.com> --------- Signed-off-by: Igor Pecovnik <igor@armbian.com>
57 lines
2.4 KiB
Bash
57 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
# @description Fixes old U-Boot's `pylibfdt` failing to build against SWIG >= 4.3 (Debian trixie), which gave `SWIG_Python_AppendOutput()` a third argument. Rewrites the 2-arg calls to the version-agnostic `SWIG_AppendOutput()` macro in `libfdt.i`/`libfdt_wrap.c` under both pylibfdt paths. A safe no-op when the old call is absent; companion to `uboot-binman-fix-pkg-resources`.
|
|
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Copyright (c) 2013-2026 Igor Pecovnik, igor@armbian.com
|
|
#
|
|
# This file is a part of the Armbian Build Framework
|
|
# https://github.com/armbian/build/
|
|
#
|
|
# Fix old U-Boot's pylibfdt failing to build against SWIG >= 4.3
|
|
# (Debian trixie ships 4.3+).
|
|
#
|
|
# SWIG 4.3.0 gave SWIG_Python_AppendOutput() a third parameter (is_void),
|
|
# so the 2-argument calls in old pylibfdt SWIG interfaces no longer compile:
|
|
#
|
|
# scripts/dtc/pylibfdt/libfdt_wrap.c: error: too few arguments to
|
|
# function 'SWIG_Python_AppendOutput'
|
|
#
|
|
# Upstream (dtc/U-Boot >= v2026.07) switched to the version-agnostic
|
|
# SWIG_AppendOutput() macro. Do the same substitution at build time on the
|
|
# checked-in interface (libfdt.i / libfdt.i_shipped) and, if present, on an
|
|
# already-generated wrapper (libfdt_wrap.c), so SWIG regenerates a wrapper
|
|
# that compiles.
|
|
#
|
|
# Safe for all U-Boot versions: no-op when the old 2-arg call is absent.
|
|
# Handles both the old (lib/libfdt/pylibfdt) and new (scripts/dtc/pylibfdt)
|
|
# pylibfdt locations. Can be removed once all BOOTBRANCH versions ship the
|
|
# SWIG_AppendOutput() form (>= v2026.07).
|
|
|
|
function pre_config_uboot_target__fix_pylibfdt_swig() {
|
|
local patched=0 f
|
|
for f in \
|
|
scripts/dtc/pylibfdt/libfdt.i \
|
|
scripts/dtc/pylibfdt/libfdt.i_shipped \
|
|
scripts/dtc/pylibfdt/libfdt_wrap.c \
|
|
lib/libfdt/pylibfdt/libfdt.i \
|
|
lib/libfdt/pylibfdt/libfdt.i_shipped \
|
|
lib/libfdt/pylibfdt/libfdt_wrap.c; do
|
|
|
|
[[ -f "${f}" ]] || continue
|
|
# Only rewrite genuine 2-arg calls; the fixed 3-arg definition
|
|
# 'SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void)'
|
|
# and any SWIG_AppendOutput() use are left untouched.
|
|
grep -q 'SWIG_Python_AppendOutput(resultobj' "${f}" || continue
|
|
|
|
display_alert "Patching pylibfdt" "SWIG_Python_AppendOutput -> SWIG_AppendOutput in ${f}" "info"
|
|
sed -i 's/SWIG_Python_AppendOutput(resultobj/SWIG_AppendOutput(resultobj/g' "${f}"
|
|
patched=1
|
|
done
|
|
|
|
[[ "${patched}" -eq 1 ]] && display_alert "pylibfdt" "patched for SWIG >= 4.3 (SWIG_AppendOutput)" "info"
|
|
|
|
return 0
|
|
}
|