# 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 (`libxml2` → `libxml2`), 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) 4. Fix texinfo compilation error — unblocks many autotools packages 5. Implement `[[optional-packages]]` generation for split packages 6. Fix SHA-256 → BLAKE3 mapping — use correct hash or document the gap 7. Add `cargopath`/`cargopackages` fields to cargo template generation ### Medium-term (broader coverage) 8. Expand dependency mapping table to cover common AUR libraries 9. Improve linuxism detection (D-Bus, udev, sysfs patterns) 10. Add `shallow_clone`, `upstream`, `installs` fields 11. Validate intltool and gobject-introspection recipes