SCPM is a simple package manager for Scarlet OS.
- Library (
user/lib/scpm/) - Core functionality (package management, archive extraction) - CLI (
user/bin/src/scpm.rs) - Command-line interface - Builder (
tools/scpm-pack/) - Host-side package creation tool
SCPM packages use .scarlet format (tar.gz):
package-0.1.0.scarlet (tar.gz)
├── package.toml # Metadata (auto-parsed)
├── bin/ # Executables
│ └── hello
├── lib/ # Shared libraries
└── ... # Other files
[package]
name = "hello"
version = "0.1.0"
description = "Hello World example package"
author = "Scarlet Team"
architecture = "riscv64" # "riscv64", "aarch64", "any"
binaries = ["hello"]
libraries = []
dependencies = []During installation, files under the scarlet/ directory are extracted to the system root:
scarlet/ # Prefix in package
├── bin/hello → /bin/hello
├── lib/libtest.so → /lib/libtest.so
└── etc/config.conf → /etc/config.conf
# List installed packages
scpm list
# Show package information
scpm info hello
# Install package
scpm install hello-0.1.0.scarlet
# Remove package
scpm remove hello
# Search packages
scpm search editor# Build
cd tools/scpm-pack
cargo build --release
# Initialize new package
./target/release/scpm-pack init hello \
--dir ./hello \
--description "Test package" \
--author "Developer"
# Place binaries
cp /path/to/hello ./hello/bin/
# Build package
./target/release/scpm-pack build ./hello --output hello-0.1.0.scarletuse scpm::{PackageManager, PackageMetadata};
// Create package manager with default config
let manager = PackageManager::with_default_config();
// Check if installed
if manager.is_installed("hello") {
println!("Installed!");
}
// Get package info
if let Some(pkg) = manager.get_installed("hello") {
println!("Version: {}", pkg.version);
}
// Install from bytes
let data = std::fs::read("package.scarlet")?;
manager.install_from_bytes("package", &data)?;- Core library types (PackageMetadata, PackageArchive)
- Package manager operations (install, remove, list, info)
- tar.gz archive extraction (miniz_oxide + tar-no-std)
- File extraction and placement (scarlet/ → system root)
- Installed file tracking
- Overwrite prevention
- Host-side package builder
- CLI binary
- Remote repository support (HTTP fetch)
- Dependency resolution
- Configuration file management (conffiles)
- Upgrade handling
- Database persistence (currently in-memory only)
[dependencies]
scarlet_std = { path = "../std" }
miniz_oxide = { version = "0.7", features = ["with-alloc"] }
tar-no-std = "0.4"- Uses
scarlet_std(replaces standard library) - Dynamic memory allocation with
alloc - Custom TOML parser (no serde)
- gzip decompression - deflate expansion with miniz_oxide
- tar parsing - entry traversal with tar-no-std
- Metadata extraction - parse package.toml
- File placement - extract scarlet/ contents to system root
- Minimal dependencies
- Clear package structure
- Maintainable code
- Prevent overwriting existing files
- Track installed files
- Atomic operations (future)
- Plugin format (.deb compatibility considered)
- Declarative hook scripts
- Remote repository support