# Debian Packaging for all-smi

## Launchpad PPA Build Requirements

### Important: Internet Access Restriction
Launchpad build environments do NOT have internet access. This means:
- You cannot download Rust or any other dependencies during build
- All build dependencies must be declared in debian/control
- The build must use system-provided packages only

### Build Dependencies
The following packages are required and must be available in the Ubuntu repository:
- `rustc-1.93 | rustc-1.94 | rustc-1.95 | rustc (>= 1.93)` - Rust compiler for the current dependency set
- `cargo-1.93 | cargo-1.94 | cargo-1.95 | cargo (>= 1.93)` - Cargo for the current lockfile/dependency set
- `pkg-config` - For finding system libraries
- `libssl-dev` - OpenSSL development files
- `protobuf-compiler` - Protocol buffer compiler
- `libprotobuf-dev` - Well-known protobuf includes such as `timestamp.proto`
- `cmake` - Build system

### Rust Version Requirements
This project currently requires Rust 1.93 or newer. This means:
- Ubuntu 22.04 (Jammy): needs the `~lablup/+archive/ubuntu/rustc-release` dependency PPA (provides `rustc-1.93`)
- Ubuntu 24.04 (Noble): needs the `~lablup/+archive/ubuntu/rustc-release` dependency PPA (provides `rustc-1.93`)
- Ubuntu 26.04 (Resolute): ships `rustc`/`cargo` 1.93 in the archive — no extra PPA required

### Build Process
1. The GitHub Actions workflow vendors dependencies into `vendor/`
2. `debian/sanitize-vendor.py` removes hidden/orig checksum entries that break Launchpad source tarballs
3. The debian/rules file auto-detects the newest available toolchain among `rustc-1.95` / `rustc-1.94` / `rustc-1.93`, falling back to the unversioned `rustc` (a `>= 1.93` guard validates whichever is selected)
4. The project is built with `cargo build --release --frozen`
5. The binary is installed to `/usr/bin/all-smi`

### Troubleshooting Build Failures
If the build fails on Launchpad:
1. Check the build log for the exact error
2. Common issues:
   - Missing build dependencies: Add them to debian/control
   - Rust version incompatibility: Ensure Rust 1.93+ is available
   - Network access attempts: Remove any code that downloads dependencies
   - Vendored checksum mismatch: Re-run the vendor sanitization step
   - Permission issues: Ensure proper file permissions in debian/rules
   - Cargo registry access: The build will fail if it tries to download crates

### Automatic Version Incrementing
The packaging scripts support automatic version incrementing to avoid conflicts with existing PPA versions:

1. **get-next-ppa-version.sh**: Queries the PPA to find existing versions and calculates the next revision
2. **update-changelog.sh**: Supports `--auto-increment` flag to use the next available version
3. **GitHub Actions**: Automatically uses version incrementing when uploading to PPA

Version format: `{version}-1~{distro}{revision}`
- Example: `0.7.2-1~noble1` → `0.7.2-1~noble2` → `0.7.2-1~noble3`
