71 lines
2.5 KiB
Python
71 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script for bootstrap tool detection and functionality
|
|
"""
|
|
|
|
from create_debian_atomic import DebianAtomicBuilder
|
|
import sys
|
|
|
|
def test_bootstrap_detection():
|
|
"""Test automatic bootstrap tool detection"""
|
|
print("Testing bootstrap tool detection...")
|
|
|
|
# Test with mmdebstrap preference (default)
|
|
print("\n1. Testing with mmdebstrap preference (default):")
|
|
try:
|
|
builder = DebianAtomicBuilder(use_mmdebstrap=True)
|
|
info = builder.get_bootstrap_info()
|
|
print(f" Detected tool: {info['tool']}")
|
|
print(f" Version: {info['version']}")
|
|
print(f" Available: {info['available']}")
|
|
print(f" Preferred: {'mmdebstrap' if info['preferred'] else 'debootstrap'}")
|
|
except Exception as e:
|
|
print(f" Error: {e}")
|
|
|
|
# Test with debootstrap preference
|
|
print("\n2. Testing with debootstrap preference:")
|
|
try:
|
|
builder = DebianAtomicBuilder(use_mmdebstrap=False)
|
|
info = builder.get_bootstrap_info()
|
|
print(f" Detected tool: {info['tool']}")
|
|
print(f" Version: {info['version']}")
|
|
print(f" Available: {info['available']}")
|
|
print(f" Preferred: {'mmdebstrap' if info['preferred'] else 'debootstrap'}")
|
|
except Exception as e:
|
|
print(f" Error: {e}")
|
|
|
|
# Test variant listing
|
|
print("\n3. Testing variant listing:")
|
|
try:
|
|
builder = DebianAtomicBuilder()
|
|
variants = builder.list_variants()
|
|
print(f" Available variants: {', '.join(variants)}")
|
|
except Exception as e:
|
|
print(f" Error: {e}")
|
|
|
|
def test_bootstrap_commands():
|
|
"""Test bootstrap command generation"""
|
|
print("\n4. Testing bootstrap command generation:")
|
|
try:
|
|
builder = DebianAtomicBuilder()
|
|
print(f" Using tool: {builder.bootstrap_tool}")
|
|
|
|
# Show what command would be run for minimal variant
|
|
packages = builder.get_packages_for_variant("minimal")
|
|
print(f" Packages for minimal: {len(packages)} packages")
|
|
print(f" First 5 packages: {', '.join(packages[:5])}")
|
|
|
|
except Exception as e:
|
|
print(f" Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
print("🔧 Bootstrap Tool Testing")
|
|
print("=" * 40)
|
|
|
|
test_bootstrap_detection()
|
|
test_bootstrap_commands()
|
|
|
|
print("\n✅ Testing completed!")
|
|
print("\nTo test actual building, run:")
|
|
print(" python3 create-debian-atomic.py minimal --help")
|
|
print(" python3 create-debian-atomic.py minimal")
|