refactor: restructure src/ into modules/, scripts/, and build/
- src/nag_screen/ and src/node_info/ -> src/modules/ (mods grouped explicitly) - src/Scripts/ -> src/scripts/ (lowercase, consistent) - src/gen-rules.sh -> build/ (build tool separated from source) Update all references: debian/rules, .github/workflows/*, build/gen-rules.sh, src/scripts/test/test-syntax.sh (SRC_DIR now points to src/modules/), src/scripts/test/test-patches.sh, and files.list comments.
This commit is contained in:
parent
3db6a010df
commit
71e95cc630
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@ -43,11 +43,11 @@ jobs:
|
||||
run: |
|
||||
perl -i -pe 'BEGIN { $v = $ENV{BUILD_VERSION} }
|
||||
s/(our \$VERSION\s*=\s*'"'"')[^'"'"']*'"'"';/${1}$v'"'"';/
|
||||
' src/node_info/files/Config.pm
|
||||
' src/modules/node_info/files/Config.pm
|
||||
|
||||
- name: Generate dynamic debian rules
|
||||
run: |
|
||||
bash src/gen-rules.sh >> debian/rules
|
||||
bash build/gen-rules.sh >> debian/rules
|
||||
|
||||
- name: Build deb package
|
||||
run: |
|
||||
|
||||
4
.github/workflows/test-release.yml
vendored
4
.github/workflows/test-release.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
run: |
|
||||
BUILD_VERSION="${{ steps.version.outputs.build_version }}"
|
||||
sed -i -E "s/^our \\\$VERSION\\s*=.*/our \\\$VERSION = '${BUILD_VERSION}';/" \
|
||||
src/node_info/files/Config.pm
|
||||
src/modules/node_info/files/Config.pm
|
||||
|
||||
- name: Set package version in changelog
|
||||
run: |
|
||||
@ -46,7 +46,7 @@ jobs:
|
||||
|
||||
- name: Generate dynamic debian rules
|
||||
run: |
|
||||
bash src/gen-rules.sh >> debian/rules
|
||||
bash build/gen-rules.sh >> debian/rules
|
||||
|
||||
- name: Build package
|
||||
run: dpkg-buildpackage -us -uc -b
|
||||
|
||||
6
.github/workflows/validate-mods.yml
vendored
6
.github/workflows/validate-mods.yml
vendored
@ -32,13 +32,13 @@ jobs:
|
||||
path: deb
|
||||
|
||||
- name: Fetch upstream Proxmox files
|
||||
run: bash src/Scripts/test/fetch-proxmox-files.sh
|
||||
run: bash src/scripts/test/fetch-proxmox-files.sh
|
||||
|
||||
- name: Install built package
|
||||
run: apt-get install -y ./deb/*.deb
|
||||
|
||||
- name: Test all mods
|
||||
run: bash src/Scripts/test/test-patches.sh all
|
||||
run: bash src/scripts/test/test-patches.sh all
|
||||
|
||||
- name: Validate source syntax
|
||||
run: bash src/Scripts/test/test-syntax.sh all
|
||||
run: bash src/scripts/test/test-syntax.sh all
|
||||
|
||||
10
.github/workflows/weekly-patch-test.yml
vendored
10
.github/workflows/weekly-patch-test.yml
vendored
@ -58,19 +58,19 @@ jobs:
|
||||
export BUILD_VERSION="${VERSION}-test-${SHORT_SHA}"
|
||||
perl -i -pe 'BEGIN { $v = $ENV{BUILD_VERSION} }
|
||||
s/(our \$VERSION\s*=\s*'"'"')[^'"'"']*'"'"';/$1'"'"'$v'"'"';/
|
||||
' src/node_info/files/Config.pm
|
||||
' src/modules/node_info/files/Config.pm
|
||||
|
||||
- name: Generate dynamic debian rules
|
||||
run: |
|
||||
bash src/gen-rules.sh >> debian/rules
|
||||
bash src/gen-rules.sh conffiles >> debian/pve-mod.conffiles
|
||||
bash build/gen-rules.sh >> debian/rules
|
||||
bash build/gen-rules.sh conffiles >> debian/pve-mod.conffiles
|
||||
|
||||
- name: Build package
|
||||
run: dpkg-buildpackage -us -uc -b
|
||||
|
||||
# ── Test ───────────────────────────────────────────────────────────────
|
||||
- name: Fetch upstream Proxmox files
|
||||
run: bash src/Scripts/test/fetch-proxmox-files.sh
|
||||
run: bash src/scripts/test/fetch-proxmox-files.sh
|
||||
|
||||
- name: Install built package
|
||||
run: sudo apt-get install -y ../pve-mod_*.deb
|
||||
@ -78,7 +78,7 @@ jobs:
|
||||
- name: Test mod
|
||||
run: |
|
||||
set -o pipefail
|
||||
sudo bash src/Scripts/test/test-patches.sh "${{ matrix.mod }}" 2>&1 | tee test-output.log
|
||||
sudo bash src/scripts/test/test-patches.sh "${{ matrix.mod }}" 2>&1 | tee test-output.log
|
||||
|
||||
- name: Report failure as issue
|
||||
if: failure()
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# src/gen-rules.sh
|
||||
# build/gen-rules.sh
|
||||
#
|
||||
# Generates the per-module portion of the Debian build configuration from each
|
||||
# module's metadata, so adding or changing a module never requires touching
|
||||
# debian/rules by hand.
|
||||
#
|
||||
# A module is any directory under src/ that contains a files/ and/or patches/
|
||||
# subdirectory (so src/Scripts/, which has neither, is ignored). The module's
|
||||
# directory name is its canonical mod key (matches the [modules] keys in
|
||||
# pve-mod.conf and the install path usr/lib/pve-mod/patches/<mod>/).
|
||||
# A module is any directory under src/modules/ that contains a files/ and/or
|
||||
# patches/ subdirectory. The module's directory name is its canonical mod key
|
||||
# (matches the [modules] keys in pve-mod.conf and the install path
|
||||
# usr/lib/pve-mod/patches/<mod>/).
|
||||
#
|
||||
# Usage:
|
||||
# gen-rules.sh Emit dpkg install lines (tab-indented, no header).
|
||||
# Append to debian/rules' override_dh_install recipe:
|
||||
# bash src/gen-rules.sh >> debian/rules
|
||||
# bash build/gen-rules.sh >> debian/rules
|
||||
# Conffiles under etc/ are detected automatically by
|
||||
# debhelper (compat 13+); no separate conffiles step needed.
|
||||
#
|
||||
@ -37,7 +37,7 @@ set -euo pipefail
|
||||
# regardless of the caller's working directory.
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
SRC_DIR="$REPO_ROOT/src"
|
||||
SRC_DIR="$REPO_ROOT/src/modules"
|
||||
PKG_DIR="debian/pve-mod"
|
||||
|
||||
# Print the list of module directory names (basenames), sorted, that contain a
|
||||
@ -62,7 +62,7 @@ emit_install() {
|
||||
emit_install_rules() {
|
||||
local mod="$1"
|
||||
local mod_dir="$SRC_DIR/$mod"
|
||||
local rel_mod="src/$mod"
|
||||
local rel_mod="src/modules/$mod"
|
||||
|
||||
# 1. Mapped files from files/files.list.
|
||||
local manifest="$mod_dir/files/files.list"
|
||||
10
debian/rules
vendored
10
debian/rules
vendored
@ -6,18 +6,18 @@ override_dh_install:
|
||||
# ── Static section ─────────────────────────────────────────────────────
|
||||
# Generic, mod-independent files that never change when mods are added.
|
||||
# Everything mod-specific (module files, patches, per-mod configs) is
|
||||
# generated and appended below by src/gen-rules.sh at build time and is
|
||||
# generated and appended below by build/gen-rules.sh at build time and is
|
||||
# NOT committed to the repository.
|
||||
#
|
||||
# Patch helpers (generic, manifest-driven)
|
||||
install -Dm755 src/Scripts/apply-patches.sh debian/pve-mod/usr/lib/pve-mod/apply-patches.sh
|
||||
install -Dm755 src/Scripts/revert-patches.sh debian/pve-mod/usr/lib/pve-mod/revert-patches.sh
|
||||
install -Dm755 src/scripts/apply-patches.sh debian/pve-mod/usr/lib/pve-mod/apply-patches.sh
|
||||
install -Dm755 src/scripts/revert-patches.sh debian/pve-mod/usr/lib/pve-mod/revert-patches.sh
|
||||
# Configure tool
|
||||
install -Dm755 src/Scripts/pve-mod-configure debian/pve-mod/usr/sbin/pve-mod-configure
|
||||
install -Dm755 src/scripts/pve-mod-configure debian/pve-mod/usr/sbin/pve-mod-configure
|
||||
# Main config (conffile for user edits)
|
||||
install -Dm644 src/pve-mod.conf debian/pve-mod/etc/pve-mod/pve-mod.conf
|
||||
# Main config reference copy for upgrade key-diff (not a conffile)
|
||||
install -Dm644 src/pve-mod.conf debian/pve-mod/usr/share/pve-mod/pve-mod.conf.default
|
||||
# ── Dynamic section ────────────────────────────────────────────────────
|
||||
# `bash src/gen-rules.sh >> debian/rules` appends per-module install lines
|
||||
# `bash build/gen-rules.sh >> debian/rules` appends per-module install lines
|
||||
# here during CI, just before dpkg-buildpackage. Do not commit them.
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
# source - path relative to this files/ directory
|
||||
# destination - path relative to the package root (no leading slash)
|
||||
# permission - octal mode, optional (defaults to 644)
|
||||
# Read by src/gen-rules.sh to generate the per-module debian install rules.
|
||||
# Read by build/gen-rules.sh to generate the per-module debian install rules.
|
||||
#
|
||||
# The nag_screen mod ships no new files - it only patches existing Proxmox
|
||||
# files - so this manifest is intentionally empty.
|
||||
@ -4,7 +4,7 @@
|
||||
# source - path relative to this files/ directory
|
||||
# destination - path relative to the package root (no leading slash)
|
||||
# permission - octal mode, optional (defaults to 644)
|
||||
# Read by src/gen-rules.sh to generate the per-module debian install rules.
|
||||
# Read by build/gen-rules.sh to generate the per-module debian install rules.
|
||||
|
||||
# PVE API2 facade
|
||||
PveMod_SensorInfo.pm usr/share/perl5/PVE/API2/PVEMod_SensorInfo.pm
|
||||
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# src/Scripts/test/test-mods.sh
|
||||
# src/scripts/test/test-patches.sh
|
||||
#
|
||||
# Exercises pve-mod's patch engine against the installed Proxmox files.
|
||||
#
|
||||
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# src/Scripts/test/test-syntax.sh
|
||||
# src/scripts/test/test-syntax.sh
|
||||
#
|
||||
# Validates source syntax for all mod files without requiring a running system.
|
||||
#
|
||||
@ -16,7 +16,7 @@
|
||||
set -u
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SRC_DIR="${PVE_MOD_SRC_DIR:-$(cd "$SCRIPT_DIR/../../.." && pwd)/src}"
|
||||
SRC_DIR="${PVE_MOD_SRC_DIR:-$(cd "$SCRIPT_DIR/../../.." && pwd)/src/modules}"
|
||||
|
||||
info() { echo "[syntax] $*"; }
|
||||
warn() { echo "[syntax] WARNING: $*" >&2; }
|
||||
Loading…
Reference in New Issue
Block a user