- Fix trailing spaces and blank lines in Forgejo workflows - Update system requirements from Ubuntu Jammy/Bookworm to Debian 13+ (Trixie) - Update test treefile to use Debian Trixie instead of Ubuntu Jammy - Update documentation to reflect modern system requirements - Fix yamllint errors for CI/CD functionality - Ensure compatibility with modern OSTree and libapt versions
7.8 KiB
Development Commands Analysis: rpm-ostree Integration
Overview
This document analyzes the missing development and debugging commands from rpm-ostree that should be integrated into apt-ostree. These commands are marked with RPM_OSTREE_BUILTIN_FLAG_HIDDEN and are essential for development, testing, and debugging purposes.
Commands Analysis
1. testutils Command
Purpose: Development debugging tool for testing and development workflows.
Flags: RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD | RPM_OSTREE_BUILTIN_FLAG_HIDDEN
Subcommands:
inject-pkglist- Inject package list metadata into OSTree commitsscript-shell- Run scripts in bubblewrap containersgenerate-synthetic-upgrade- Generate synthetic OS updates by modifying ELF filesintegration-read-only- Run integration tests on booted machinec-units- Run C unit testsmoo- Test command for development verification
Implementation Details:
C++ Side (rpmostree-builtin-testutils.cxx)
// inject-pkglist: Creates new commit with pkglist metadata
// - Reads existing commit
// - Creates RPM database package list
// - Writes new commit with pkglist metadata
// - Updates ref to point to new commit
// script-shell: Runs scripts in isolated containers
// - Uses bubblewrap for containerization
// - Mounts root filesystem
// - Executes test scripts safely
Rust Side (testutils.rs)
// generate-synthetic-upgrade: Modifies ELF binaries
// - Finds ELF files in system directories
// - Mutates specified percentage of binaries
// - Creates new OSTree commit with modified files
// - Useful for testing upgrade paths
// integration-read-only: Validates system state
// - Tests status JSON parsing
// - Validates package variants
// - Ensures client bindings work correctly
Integration Plan for apt-ostree:
- Create
src/commands/testutils.rsmodule - Implement all subcommands with APT equivalents
- Add to CLI with hidden flag
- Integrate with existing command structure
2. shlib-backend Command
Purpose: Shared library backend for IPC operations and package management.
Flags: RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD | RPM_OSTREE_BUILTIN_FLAG_HIDDEN
Subcommands:
get-basearch- Get base architecturevarsubst-basearch- Variable substitution for architecturepackagelist-from-commit- Extract package list from OSTree commit
Implementation Details:
// IPC-based communication using Unix domain sockets
// - Creates sealed memfd for data transfer
// - Uses DNF context for package operations
// - Integrates with OSTree repository operations
// - Handles package list extraction and formatting
Integration Plan for apt-ostree:
- Create
src/commands/shlib_backend.rsmodule - Replace DNF with APT equivalents
- Implement IPC communication layer
- Add architecture detection and variable substitution
- Integrate with OSTree operations
3. internals Command
Purpose: Internal system commands for advanced operations.
Status: Referenced in header file but implementation not found in current rpm-ostree source.
Flags: Not specified (likely RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD)
Integration Plan for apt-ostree:
- Research if this command exists in newer rpm-ostree versions
- If not implemented, consider what internal operations would be useful
- Implement as placeholder for future development
- Add to CLI with appropriate flags
Implementation Strategy
Phase 1: Core Infrastructure
- Command Structure: Add hidden command support to CLI
- Flag System: Implement
APT_OSTREE_BUILTIN_FLAG_HIDDENequivalent - Module Organization: Create development commands module
Phase 2: testutils Implementation
- inject-pkglist: APT package list injection
- script-shell: Bubblewrap container execution
- synthetic-upgrade: ELF binary modification for testing
- integration-tests: System validation and testing
Phase 3: shlib-backend Implementation
- IPC Layer: Unix domain socket communication
- Package Operations: APT-based package management
- Architecture Detection: Debian architecture handling
- Variable Substitution: APT-specific variable handling
Phase 4: Integration and Testing
- Command Registration: Add to main command dispatch
- Hidden Flag Support: Implement in CLI help system
- Testing Framework: Integration with existing test suite
- Documentation: Developer and testing guides
Technical Considerations
APT vs DNF Differences
- Package Format: DEB vs RPM
- Database Structure: APT cache vs DNF sack
- Architecture Names: Debian vs Red Hat conventions
- Variable Substitution: APT-specific variables
OSTree Integration
- Package Metadata: APT package list format
- Commit Structure: OSTree commit metadata
- Repository Operations: OSTree repo integration
- Deployment Management: System deployment handling
Security and Isolation
- Bubblewrap: Container execution for scripts
- File Descriptors: Secure IPC communication
- Permission Handling: Root and user operations
- Resource Limits: Memory and process constraints
File Structure
src/commands/
├── testutils.rs # Development testing utilities
├── shlib_backend.rs # Shared library backend
└── internals.rs # Internal system commands (future)
src/cli.rs # Add hidden command support
src/commands/mod.rs # Register development commands
CLI Integration
Hidden Command Support
#[derive(Subcommand)]
pub enum Commands {
// ... existing commands ...
/// Development and debugging tools (hidden)
#[command(hide = true)]
Testutils(TestutilsArgs),
/// Shared library backend (hidden)
#[command(hide = true)]
ShlibBackend(ShlibBackendArgs),
/// Internal system commands (hidden)
#[command(hide = true)]
Internals(InternalsArgs),
}
Flag System
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CommandFlags {
pub local_cmd: bool,
pub hidden: bool,
pub requires_root: bool,
pub container_capable: bool,
pub supports_pkg_installs: bool,
}
Benefits of Integration
Development Workflow
- Testing: Automated testing and validation
- Debugging: Package list inspection and modification
- Integration: System state validation
- Scripting: Safe script execution in containers
Quality Assurance
- Package Management: Validate APT integration
- OSTree Operations: Test commit and deployment logic
- System Integration: Verify daemon and client communication
- Error Handling: Test edge cases and failure modes
Maintenance and Support
- Troubleshooting: Debug package and deployment issues
- Development: Rapid iteration and testing
- Documentation: Generate system state reports
- Validation: Ensure system consistency
Conclusion
Integrating these development commands from rpm-ostree into apt-ostree will provide essential tools for development, testing, and debugging. The commands are designed to be hidden from normal users while providing powerful capabilities for developers and system administrators.
The implementation should maintain the same logical structure and behavior as rpm-ostree while adapting to APT-specific package management and Debian system conventions. This will ensure that apt-ostree provides the same level of development support as the original rpm-ostree implementation.
Next Steps
- Research: Verify current rpm-ostree implementation status
- Design: Create detailed implementation specifications
- Implementation: Develop commands with proper testing
- Integration: Add to CLI and command dispatch system
- Testing: Validate functionality and performance
- Documentation: Create developer and testing guides