Files
RedBear-OS/local/docs/CUB-WORKFLOW-ASSESSMENT.md
T
vasilito 7706617e7f cub: full AUR package manager + Phase 1-5 native build tools
cub redesign (local/recipes/system/cub/):
- AUR RPC v5 client (serde_json) with search/info
- ~/.cub/ user-local recipe/source/repo storage
- Enhanced PKGBUILD parser: optdepends, .SRCINFO, split packages, 19 linuxism patterns
- Recipe generation: host: prefix on dev-deps, shallow_clone, cargopath, installs, optional-packages
- Dependency resolver: scans build errors for missing commands/headers/libs/pkgconfig, maps to packages
- Dependency installation: checks installed packages, fetches AUR deps, interactive prompt
- ~110 Arc→Redox dependency mappings
- ratatui TUI: search, info, install, build, query views
- 14 Arch-style CLI switches (-S/-Si/-Syu/-G/-R/-Q/-Qi/-Ql)
- 65 tests, 0 failures, clean build

Phase 1-5 native build tools (local/recipes/dev/):
- P1 Substrate: tar, m4, diffutils (gnulib bypass), mkfifo kernel patch (1085 lines)
- P2 Build Systems: bison, flex, meson (standalone wrapper), ninja-build, libtool
- P3 Native GCC: gcc-native, binutils-native (cross-compiled for redox host)
- P4 Native LLVM: llvm-native (clang + lld from monorepo)
- P5 Native Rust: rust-native (rustc + cargo)
- Groups: build-essential-native, dev-essential expanded

Config:
- redbear-mini: +7 tools (diffutils, tar, bison, flex, meson, ninja, m4)
- redbear-full: +4 native tools (gcc, binutils, llvm, rust)
- All recipes moved to local/ with symlinks for cookbook discovery (Red Bear policy)

Docs:
- BUILD-TOOLS-PORTING-PLAN.md: phased porting roadmap
- CUB-WORKFLOW-ASSESSMENT.md: gap analysis and integration assessment
2026-05-08 00:13:31 +01:00

5.6 KiB

Cub Workflow Integration Assessment

Status: Assessment + Implementation complete (2026-05-07) Scope: AUR search → PKGBUILD parse → recipe.toml generation → cook with build tools

End-to-End Flow Assessment

User: "cub -S ripgrep-all"
  │
  ├─ 1. AUR Search  ✅  Works. AurClient::search() via AUR RPC v5.
  │
  ├─ 2. Fetch PKGBUILD  ✅  Works. Git clone from aur.archlinux.org.
  │
  ├─ 3. Parse PKGBUILD  ⚠️  Partial. See Gap #1-3 below.
  │
  ├─ 4. Convert to recipe.toml  ⚠️  Partial. See Compatibility Gaps below.
  │
  └─ 5. Cook recipe  ⚠️  Partial. Depends on build tool availability.

Critical Gaps: PKGBUILD → Recipe Conversion

Gap 1: Install Function Silently Lost (CRITICAL)

PKGBUILD package() functions with install -Dm755 commands are not converted. The generated recipe.toml has no install instructions. Files are never staged.

Impact: Any AUR package using package() produces a broken recipe that builds but installs nothing.

Gap 2: Multiple Source Entries → Hard Error (CRITICAL)

cookbook.rs line 63-67: if a PKGBUILD has >1 source, generate_recipe() returns a hard error. Many AUR packages use multiple source tarballs.

Impact: cub build fails immediately with "Cookbook recipe generation currently supports a single primary source."

Gap 3: SHA-256 Passed as BLAKE3 (HIGH)

PKGBUILD uses SHA-256 checksums. Cookbook expects BLAKE3. The SHA-256 hex string is copied verbatim into the blake3 field.

Impact: Cookbook hash verification will fail on packages with checksums.

Gap 4: Dependency Coverage ~15-20% (MEDIUM)

deps.rs maps 44 Arch→Redox dependencies. The AUR ecosystem has thousands. Unmapped deps pass through unchanged (libxml2libxml2), which may or may not resolve at cook time.

Gap 5: Split Packages Not Generated (HIGH)

AUR packages with pkgname=('foo' 'foo-docs' 'foo-libs') and multiple package_*() functions are detected but only the primary package is converted. [[optional-packages]] is never generated.

Gap 6: Linuxism Detection Incomplete (MEDIUM)

Only systemctl, /usr/lib/systemd, systemd, /proc are detected. Missing: dbus-daemon, udev, /sys/, Python systemd imports.

Recipe.toml Compatibility Gaps

# Gap Severity Impact
C1 dev-dependencies missing host: prefix CRITICAL Cross-compilation filtering broken
C2 [[optional-packages]] not generated HIGH Split packages impossible
C3 shallow_clone field missing MEDIUM Large git repos clone slowly
C4 upstream field missing LOW Fork tracking lost
C5 installs field not populated MEDIUM Install manifest empty
C6 cargopath/cargopackages/cargoexamples missing MEDIUM Cargo workspace builds broken
C7 script field missing from [source] LOW Source prep scripts lost
C8 SameAs/Path source variants not supported LOW Recipe reuse impossible

Build Tool Availability for Cooking

Available (all templates covered)

Template Tools Needed Status
cargo rustc + cargo rust-native
cmake cmake + ninja + gcc all present
meson meson + ninja + gcc all present
configure autoconf, automake, libtool, m4, gcc, make all present
custom whatever script declares depends on recipe

Missing / Broken

Tool Status Blocks
texinfo BROKEN (compilation error) Autotools packages with makeinfo
intltool WIP (compiled, not tested) GNOME i18n packages
gobject-introspection WIP (not tested) GTK/GNOME introspection packages
gtk-doc WIP (not tested) Development docs only (low priority)

Dependency Mapping Coverage

Category Count Examples
Explicitly mapped 44 glibc→relibc, openssl→openssl3, etc.
Dropped (unavailable) 5 systemd, xorg-server, linux-api-headers
Pass-through (unknown) Thousands libxml2, libpcre, etc.

Build Flow Integration

What Works End-to-End

  1. Simple Rust packages (cargo template, single source)
  2. Simple C packages (configure template, single source)
  3. CMake packages (single source)
  4. Meson packages (single source)

What Breaks

  1. Any package with install function → recipe missing install logic
  2. Multi-source packages → hard error at generation
  3. Split packages → only primary package built
  4. Packages with checksums → BLAKE3 verification mismatch
  5. Packages needing texinfo → build tool unavailable
  6. Cross-compilation deps → host: prefix not added

Recommendations

Immediate (unblock basic AUR packages)

  1. Fix install function conversion — route package() content to BuildKind::Custom.script
  2. Remove multi-source hard error — support multiple source entries or warn gracefully
  3. Add host: prefix to dev-dependencies when building for target

Short-term (unblock common packages)

  1. Fix texinfo compilation error — unblocks many autotools packages
  2. Implement [[optional-packages]] generation for split packages
  3. Fix SHA-256 → BLAKE3 mapping — use correct hash or document the gap
  4. Add cargopath/cargopackages fields to cargo template generation

Medium-term (broader coverage)

  1. Expand dependency mapping table to cover common AUR libraries
  2. Improve linuxism detection (D-Bus, udev, sysfs patterns)
  3. Add shallow_clone, upstream, installs fields
  4. Validate intltool and gobject-introspection recipes