feat: complete daemon integration testing and troubleshooting
Some checks failed
Compile apt-layer (v2) / compile (push) Has been cancelled
Some checks failed
Compile apt-layer (v2) / compile (push) Has been cancelled
- Fix daemon executable path from apt-ostree.py to apt-ostree - Resolve daemon package installation with --break-system-packages flag - Fix test script path calculations for proper apt-layer.sh location - Identify and document import conflicts between local and system dbus modules - Complete test infrastructure and automation for daemon + D-Bus integration - Update changelog and TODO to reflect current status and remaining work - All daemon integration foundation complete, ready for import conflict resolution
This commit is contained in:
parent
551d355825
commit
b58debd443
15 changed files with 419 additions and 6 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
# DO NOT modify this file directly as it will be overwritten #
|
# DO NOT modify this file directly as it will be overwritten #
|
||||||
# #
|
# #
|
||||||
# apt-layer Tool #
|
# apt-layer Tool #
|
||||||
# Generated on: 2025-07-15 17:15:04 #
|
# Generated on: 2025-07-15 17:57:47 #
|
||||||
# #
|
# #
|
||||||
################################################################################################################
|
################################################################################################################
|
||||||
|
|
||||||
|
|
@ -7123,7 +7123,7 @@ APT_OSTREE_DBUS_PATH="/org/debian/aptostree1/Sysroot"
|
||||||
APT_OSTREE_DBUS_INTERFACE="org.debian.aptostree1.Sysroot"
|
APT_OSTREE_DBUS_INTERFACE="org.debian.aptostree1.Sysroot"
|
||||||
|
|
||||||
# Daemon executable path
|
# Daemon executable path
|
||||||
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree.py"
|
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree"
|
||||||
APT_OSTREE_DAEMON_SERVICE="apt-ostree.service"
|
APT_OSTREE_DAEMON_SERVICE="apt-ostree.service"
|
||||||
|
|
||||||
# Check if daemon is available and running
|
# Check if daemon is available and running
|
||||||
|
|
|
||||||
|
|
@ -1647,7 +1647,15 @@ This project is part of the Particle-OS system tools and follows the same licens
|
||||||
### Changed
|
### Changed
|
||||||
- Updated compile.sh to include new scriptlet and ensure correct build order
|
- Updated compile.sh to include new scriptlet and ensure correct build order
|
||||||
- Improved main dispatch and help text for daemon commands
|
- Improved main dispatch and help text for daemon commands
|
||||||
|
- Fixed daemon executable path from `/usr/local/bin/apt-ostree.py` to `/usr/local/bin/apt-ostree`
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Path and invocation issues for test scripts and daemon lifecycle
|
- Path and invocation issues for test scripts and daemon lifecycle
|
||||||
- D-Bus communication reliability and timeout handling
|
- D-Bus communication reliability and timeout handling
|
||||||
|
- Daemon package installation with `--break-system-packages` flag for externally managed environments
|
||||||
|
- Test script path calculations for proper apt-layer.sh location
|
||||||
|
|
||||||
|
### Technical Notes
|
||||||
|
- Identified and documented import conflicts between local `dbus` module and system `dbus` module
|
||||||
|
- Daemon package successfully installed but requires import conflict resolution for full functionality
|
||||||
|
- Test infrastructure complete and ready for use once daemon import issues are resolved
|
||||||
|
|
@ -10,7 +10,7 @@ APT_OSTREE_DBUS_PATH="/org/debian/aptostree1/Sysroot"
|
||||||
APT_OSTREE_DBUS_INTERFACE="org.debian.aptostree1.Sysroot"
|
APT_OSTREE_DBUS_INTERFACE="org.debian.aptostree1.Sysroot"
|
||||||
|
|
||||||
# Daemon executable path
|
# Daemon executable path
|
||||||
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree.py"
|
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree"
|
||||||
APT_OSTREE_DAEMON_SERVICE="apt-ostree.service"
|
APT_OSTREE_DAEMON_SERVICE="apt-ostree.service"
|
||||||
|
|
||||||
# Check if daemon is available and running
|
# Check if daemon is available and running
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ NC='\033[0m' # No Color
|
||||||
|
|
||||||
# Test configuration
|
# Test configuration
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")/.."
|
PROJECT_ROOT="$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")")"
|
||||||
APT_LAYER_PATH="$PROJECT_ROOT/apt-layer.sh"
|
APT_LAYER_PATH="$PROJECT_ROOT/apt-layer.sh"
|
||||||
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree.py"
|
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree"
|
||||||
DBUS_NAME="org.debian.aptostree1"
|
DBUS_NAME="org.debian.aptostree1"
|
||||||
DBUS_PATH="/org/debian/aptostree1"
|
DBUS_PATH="/org/debian/aptostree1"
|
||||||
|
|
||||||
|
|
|
||||||
BIN
src/apt-ostree.py/python/__pycache__/apt_ostree.cpython-313.pyc
Normal file
BIN
src/apt-ostree.py/python/__pycache__/apt_ostree.cpython-313.pyc
Normal file
Binary file not shown.
365
src/apt-ostree.py/python/apt_ostree.egg-info/PKG-INFO
Normal file
365
src/apt-ostree.py/python/apt_ostree.egg-info/PKG-INFO
Normal file
|
|
@ -0,0 +1,365 @@
|
||||||
|
Metadata-Version: 2.2
|
||||||
|
Name: apt-ostree
|
||||||
|
Version: 0.1.0
|
||||||
|
Summary: Atomic package management system for Debian/Ubuntu inspired by rpm-ostree
|
||||||
|
Home-page: https://github.com/particle-os/apt-ostree
|
||||||
|
Author: Particle-OS Team
|
||||||
|
Author-email: team@particle-os.org
|
||||||
|
Project-URL: Bug Reports, https://github.com/particle-os/apt-ostree/issues
|
||||||
|
Project-URL: Source, https://github.com/particle-os/apt-ostree
|
||||||
|
Project-URL: Documentation, https://github.com/particle-os/apt-ostree/docs
|
||||||
|
Keywords: debian ubuntu package management atomic ostree
|
||||||
|
Classifier: Development Status :: 3 - Alpha
|
||||||
|
Classifier: Intended Audience :: System Administrators
|
||||||
|
Classifier: License :: OSI Approved :: MIT License
|
||||||
|
Classifier: Operating System :: POSIX :: Linux
|
||||||
|
Classifier: Programming Language :: Python :: 3
|
||||||
|
Classifier: Programming Language :: Python :: 3.8
|
||||||
|
Classifier: Programming Language :: Python :: 3.9
|
||||||
|
Classifier: Programming Language :: Python :: 3.10
|
||||||
|
Classifier: Programming Language :: Python :: 3.11
|
||||||
|
Classifier: Topic :: System :: Systems Administration
|
||||||
|
Classifier: Topic :: System :: Operating System
|
||||||
|
Requires-Python: >=3.8
|
||||||
|
Description-Content-Type: text/markdown
|
||||||
|
Requires-Dist: PyGObject>=3.40.0
|
||||||
|
Requires-Dist: python-apt>=2.0.0
|
||||||
|
Requires-Dist: dbus-python>=1.2.0
|
||||||
|
Requires-Dist: PyYAML>=6.0.0
|
||||||
|
Requires-Dist: ostree>=0.1.1
|
||||||
|
Requires-Dist: psutil>=5.8.0
|
||||||
|
Requires-Dist: structlog>=21.0.0
|
||||||
|
Requires-Dist: systemd-python>=234
|
||||||
|
Requires-Dist: pytest>=6.0.0
|
||||||
|
Requires-Dist: pytest-asyncio>=0.18.0
|
||||||
|
Requires-Dist: pytest-cov>=3.0.0
|
||||||
|
Requires-Dist: black>=22.0.0
|
||||||
|
Requires-Dist: flake8>=4.0.0
|
||||||
|
Requires-Dist: mypy>=0.950
|
||||||
|
Dynamic: author
|
||||||
|
Dynamic: author-email
|
||||||
|
Dynamic: classifier
|
||||||
|
Dynamic: description
|
||||||
|
Dynamic: description-content-type
|
||||||
|
Dynamic: home-page
|
||||||
|
Dynamic: keywords
|
||||||
|
Dynamic: project-url
|
||||||
|
Dynamic: requires-dist
|
||||||
|
Dynamic: requires-python
|
||||||
|
Dynamic: summary
|
||||||
|
|
||||||
|
# apt-ostree Python Daemon
|
||||||
|
|
||||||
|
This is the Python implementation of the apt-ostree daemon, providing atomic package management for Debian/Ubuntu systems inspired by rpm-ostree.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The apt-ostree daemon provides:
|
||||||
|
- **D-Bus API**: Clean interface for package management operations
|
||||||
|
- **OSTree Integration**: Atomic filesystem management using OSTree
|
||||||
|
- **APT Integration**: Native Debian package management
|
||||||
|
- **Transaction Management**: Atomic operations with rollback capabilities
|
||||||
|
- **Security**: PolicyKit integration and AppArmor support
|
||||||
|
- **Concurrent Operations**: Multiple simultaneous transactions
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
apt-ostree.py/
|
||||||
|
├── apt_ostree.py # Main daemon entry point
|
||||||
|
├── core/ # Core daemon components
|
||||||
|
│ ├── daemon.py # Main daemon class
|
||||||
|
│ ├── transaction.py # Transaction management
|
||||||
|
│ ├── client_manager.py # D-Bus client tracking
|
||||||
|
│ └── sysroot.py # OSTree sysroot management
|
||||||
|
├── dbus/ # D-Bus interface components
|
||||||
|
│ └── interface.py # D-Bus API implementation
|
||||||
|
├── utils/ # Utility components
|
||||||
|
│ ├── config.py # Configuration management
|
||||||
|
│ ├── logging.py # Structured logging
|
||||||
|
│ └── security.py # Security utilities
|
||||||
|
├── tests/ # Test suite
|
||||||
|
│ └── test_basic.py # Basic functionality tests
|
||||||
|
├── requirements.txt # Python dependencies
|
||||||
|
├── setup.py # Package setup
|
||||||
|
└── README.md # This file
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Python 3.8 or higher
|
||||||
|
- OSTree development libraries
|
||||||
|
- D-Bus development libraries
|
||||||
|
- PolicyKit development libraries
|
||||||
|
|
||||||
|
### System Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ubuntu/Debian
|
||||||
|
sudo apt-get install \
|
||||||
|
python3-dev \
|
||||||
|
python3-gi \
|
||||||
|
python3-gi-cairo \
|
||||||
|
gir1.2-ostree-1.0 \
|
||||||
|
libostree-dev \
|
||||||
|
libdbus-1-dev \
|
||||||
|
libpolkit-gobject-1-dev \
|
||||||
|
apparmor-utils
|
||||||
|
|
||||||
|
# Build dependencies
|
||||||
|
sudo apt-get install \
|
||||||
|
build-essential \
|
||||||
|
pkg-config \
|
||||||
|
libglib2.0-dev \
|
||||||
|
libgirepository1.0-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Python Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
git clone https://github.com/particle-os/apt-ostree.git
|
||||||
|
cd apt-ostree/src/apt-ostree.py/python
|
||||||
|
|
||||||
|
# Install Python dependencies
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Install the package
|
||||||
|
pip install -e .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The daemon uses YAML configuration files. Default configuration is loaded from `/etc/apt-ostree/config.yaml`.
|
||||||
|
|
||||||
|
### Example Configuration
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
daemon:
|
||||||
|
dbus:
|
||||||
|
bus_name: "org.debian.aptostree1"
|
||||||
|
object_path: "/org/debian/aptostree1"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
max_workers: 3
|
||||||
|
transaction_timeout: 300
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level: "INFO"
|
||||||
|
format: "json"
|
||||||
|
file: "/var/log/apt-ostree/daemon.log"
|
||||||
|
|
||||||
|
sysroot:
|
||||||
|
path: "/"
|
||||||
|
repo_path: "/var/lib/ostree/repo"
|
||||||
|
|
||||||
|
shell_integration:
|
||||||
|
script_path: "/usr/local/bin/apt-layer.sh"
|
||||||
|
timeout:
|
||||||
|
install: 300
|
||||||
|
remove: 300
|
||||||
|
composefs: 600
|
||||||
|
|
||||||
|
security:
|
||||||
|
polkit_required: true
|
||||||
|
apparmor_profile: "/etc/apparmor.d/apt-ostree"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Running the Daemon
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run as root (required for system operations)
|
||||||
|
sudo python3 -m apt_ostree
|
||||||
|
|
||||||
|
# Or install and run as service
|
||||||
|
sudo apt-ostree
|
||||||
|
```
|
||||||
|
|
||||||
|
### D-Bus API
|
||||||
|
|
||||||
|
The daemon provides a D-Bus API at `org.debian.aptostree1`.
|
||||||
|
|
||||||
|
#### Example: Install Packages
|
||||||
|
|
||||||
|
```python
|
||||||
|
import dbus
|
||||||
|
|
||||||
|
# Connect to system bus
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
|
||||||
|
# Get daemon interface
|
||||||
|
daemon = bus.get_object(
|
||||||
|
'org.debian.aptostree1',
|
||||||
|
'/org/debian/aptostree1/Sysroot'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
result = daemon.InstallPackages(['firefox', 'thunderbird'], False)
|
||||||
|
print(f"Install result: {result}")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example: System Upgrade
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Upgrade system
|
||||||
|
result = daemon.Upgrade({})
|
||||||
|
print(f"Upgrade result: {result}")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Command Line Interface
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install packages
|
||||||
|
apt-ostree install firefox thunderbird
|
||||||
|
|
||||||
|
# Remove packages
|
||||||
|
apt-ostree remove firefox
|
||||||
|
|
||||||
|
# System upgrade
|
||||||
|
apt-ostree upgrade
|
||||||
|
|
||||||
|
# System rollback
|
||||||
|
apt-ostree rollback
|
||||||
|
|
||||||
|
# Check status
|
||||||
|
apt-ostree status
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Running Tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run all tests
|
||||||
|
python -m pytest tests/
|
||||||
|
|
||||||
|
# Run specific test
|
||||||
|
python -m pytest tests/test_basic.py::TestConfigManager::test_default_config
|
||||||
|
|
||||||
|
# Run with coverage
|
||||||
|
python -m pytest --cov=apt_ostree tests/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Code Formatting
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Format code
|
||||||
|
black .
|
||||||
|
|
||||||
|
# Lint code
|
||||||
|
flake8 .
|
||||||
|
|
||||||
|
# Type checking
|
||||||
|
mypy .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Development Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install development dependencies
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install pytest pytest-cov black flake8 mypy
|
||||||
|
|
||||||
|
# Setup pre-commit hooks
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
|
## D-Bus Interface
|
||||||
|
|
||||||
|
### Sysroot Interface
|
||||||
|
|
||||||
|
- `RegisterClient(options)` - Register client for monitoring
|
||||||
|
- `UnregisterClient(options)` - Unregister client
|
||||||
|
- `Reload()` - Reload sysroot state
|
||||||
|
- `ReloadConfig()` - Reload configuration
|
||||||
|
- `GetStatus()` - Get daemon status
|
||||||
|
- `GetOS()` - Get list of OS instances
|
||||||
|
|
||||||
|
### OS Interface
|
||||||
|
|
||||||
|
- `Deploy(revision, options)` - Deploy specific revision
|
||||||
|
- `Upgrade(options)` - Upgrade to latest version
|
||||||
|
- `Rollback(options)` - Rollback to previous deployment
|
||||||
|
- `PkgChange(packages_added, packages_removed, options)` - Add/remove packages
|
||||||
|
- `Rebase(refspec, options)` - Switch to different base OS
|
||||||
|
- `GetDeployments()` - Get list of deployments
|
||||||
|
- `GetBootedDeployment()` - Get currently booted deployment
|
||||||
|
|
||||||
|
### Transaction Interface
|
||||||
|
|
||||||
|
- `Start()` - Start the transaction
|
||||||
|
- `Cancel()` - Cancel the transaction
|
||||||
|
- `Title` (property) - Transaction title
|
||||||
|
- `InitiatingClientDescription` (property) - Client description
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
### PolicyKit Integration
|
||||||
|
|
||||||
|
The daemon uses PolicyKit for authorization. Required actions:
|
||||||
|
|
||||||
|
- `org.debian.aptostree.package.install` - Install packages
|
||||||
|
- `org.debian.aptostree.package.remove` - Remove packages
|
||||||
|
- `org.debian.aptostree.system.upgrade` - System upgrade
|
||||||
|
- `org.debian.aptostree.system.rollback` - System rollback
|
||||||
|
- `org.debian.aptostree.deploy` - Deploy operations
|
||||||
|
- `org.debian.aptostree.rebase` - Rebase operations
|
||||||
|
|
||||||
|
### AppArmor Support
|
||||||
|
|
||||||
|
The daemon includes AppArmor profile support for enhanced security.
|
||||||
|
|
||||||
|
## Logging
|
||||||
|
|
||||||
|
The daemon uses structured logging with JSON format by default.
|
||||||
|
|
||||||
|
### Log Levels
|
||||||
|
|
||||||
|
- `DEBUG` - Detailed debug information
|
||||||
|
- `INFO` - General information
|
||||||
|
- `WARNING` - Warning messages
|
||||||
|
- `ERROR` - Error messages
|
||||||
|
|
||||||
|
### Log Files
|
||||||
|
|
||||||
|
- Console output: Human-readable format
|
||||||
|
- File output: JSON format for machine processing
|
||||||
|
- Systemd journal: Integration with systemd logging
|
||||||
|
|
||||||
|
## Integration
|
||||||
|
|
||||||
|
### Systemd Integration
|
||||||
|
|
||||||
|
The daemon integrates with systemd for service management and status reporting.
|
||||||
|
|
||||||
|
### OSTree Integration
|
||||||
|
|
||||||
|
Direct integration with libostree for filesystem management and atomic operations.
|
||||||
|
|
||||||
|
### APT Integration
|
||||||
|
|
||||||
|
Native integration with python-apt for Debian package management.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
1. Fork the repository
|
||||||
|
2. Create a feature branch
|
||||||
|
3. Make your changes
|
||||||
|
4. Add tests for new functionality
|
||||||
|
5. Ensure all tests pass
|
||||||
|
6. Submit a pull request
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
For support and questions:
|
||||||
|
- GitHub Issues: https://github.com/particle-os/apt-ostree/issues
|
||||||
|
- Documentation: https://github.com/particle-os/apt-ostree/docs
|
||||||
|
- Wiki: https://github.com/particle-os/apt-ostree/wiki
|
||||||
20
src/apt-ostree.py/python/apt_ostree.egg-info/SOURCES.txt
Normal file
20
src/apt-ostree.py/python/apt_ostree.egg-info/SOURCES.txt
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
README.md
|
||||||
|
setup.py
|
||||||
|
apt_ostree.egg-info/PKG-INFO
|
||||||
|
apt_ostree.egg-info/SOURCES.txt
|
||||||
|
apt_ostree.egg-info/dependency_links.txt
|
||||||
|
apt_ostree.egg-info/entry_points.txt
|
||||||
|
apt_ostree.egg-info/requires.txt
|
||||||
|
apt_ostree.egg-info/top_level.txt
|
||||||
|
core/__init__.py
|
||||||
|
core/client_manager.py
|
||||||
|
core/daemon.py
|
||||||
|
core/sysroot.py
|
||||||
|
core/transaction.py
|
||||||
|
dbus/__init__.py
|
||||||
|
dbus/interface.py
|
||||||
|
tests/test_basic.py
|
||||||
|
utils/__init__.py
|
||||||
|
utils/config.py
|
||||||
|
utils/logging.py
|
||||||
|
utils/security.py
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
[console_scripts]
|
||||||
|
apt-ostree = apt_ostree:main
|
||||||
14
src/apt-ostree.py/python/apt_ostree.egg-info/requires.txt
Normal file
14
src/apt-ostree.py/python/apt_ostree.egg-info/requires.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
PyGObject>=3.40.0
|
||||||
|
PyYAML>=6.0.0
|
||||||
|
black>=22.0.0
|
||||||
|
dbus-python>=1.2.0
|
||||||
|
flake8>=4.0.0
|
||||||
|
mypy>=0.950
|
||||||
|
ostree>=0.1.1
|
||||||
|
psutil>=5.8.0
|
||||||
|
pytest-asyncio>=0.18.0
|
||||||
|
pytest-cov>=3.0.0
|
||||||
|
pytest>=6.0.0
|
||||||
|
python-apt>=2.0.0
|
||||||
|
structlog>=21.0.0
|
||||||
|
systemd-python>=234
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
core
|
||||||
|
dbus
|
||||||
|
utils
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue