mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 19:04:31 +00:00
111 lines
3.0 KiB
Bash
Executable File
111 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "========================================"
|
|
echo " Docker Build Fix Verification"
|
|
echo "========================================"
|
|
echo ""
|
|
|
|
# Test 1: prole-db exists
|
|
echo "1. Testing prole-db directory..."
|
|
if [ -d "prole-db" ] && [ -f "prole-db/Dockerfile" ]; then
|
|
echo " ✓ prole-db directory with Dockerfile exists"
|
|
else
|
|
echo " ✗ prole-db directory or Dockerfile missing"
|
|
exit 1
|
|
fi
|
|
|
|
# Test 2: Spec includes prole-db
|
|
echo "2. Testing spec file includes prole-db..."
|
|
python3 scripts/generate_spec.py > /dev/null 2>&1
|
|
if grep -q "('prole-db', 'prole-db')" installer.spec; then
|
|
echo " ✓ prole-db included in spec"
|
|
else
|
|
echo " ✗ prole-db not in spec"
|
|
exit 1
|
|
fi
|
|
|
|
# Test 3: Resource path resolution
|
|
echo "3. Testing resource path resolution..."
|
|
python3 << 'PYTEST'
|
|
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path.cwd()))
|
|
from install import get_resource_path
|
|
|
|
prole_db = get_resource_path("prole-db")
|
|
if prole_db.exists() and (prole_db / "Dockerfile").exists():
|
|
print(" ✓ get_resource_path('prole-db') works")
|
|
else:
|
|
print(" ✗ Resource path resolution failed")
|
|
sys.exit(1)
|
|
PYTEST
|
|
if [ $? -ne 0 ]; then exit 1; fi
|
|
|
|
# Test 4: Build directory creation
|
|
echo "4. Testing .prole/build directory creation..."
|
|
python3 << 'PYTEST'
|
|
import sys
|
|
from pathlib import Path
|
|
import shutil
|
|
|
|
prole_home = Path.home() / ".prole"
|
|
build_dir = prole_home / "build" / "prole-db-test"
|
|
|
|
# Create and verify
|
|
build_dir.mkdir(parents=True, exist_ok=True)
|
|
if build_dir.exists():
|
|
print(f" ✓ Created: {build_dir}")
|
|
# Cleanup
|
|
shutil.rmtree(prole_home / "build" / "prole-db-test")
|
|
else:
|
|
print(" ✗ Failed to create build directory")
|
|
sys.exit(1)
|
|
PYTEST
|
|
if [ $? -ne 0 ]; then exit 1; fi
|
|
|
|
# Test 5: Copy operation
|
|
echo "5. Testing build context copy..."
|
|
python3 << 'PYTEST'
|
|
import sys
|
|
from pathlib import Path
|
|
import shutil
|
|
|
|
sys.path.insert(0, str(Path.cwd()))
|
|
from install import get_resource_path
|
|
|
|
prole_home = Path.home() / ".prole"
|
|
build_dir = prole_home / "build" / "prole-db-test"
|
|
source_dir = get_resource_path("prole-db")
|
|
|
|
try:
|
|
if build_dir.exists():
|
|
shutil.rmtree(build_dir)
|
|
shutil.copytree(source_dir, build_dir)
|
|
|
|
# Verify
|
|
if (build_dir / "Dockerfile").exists():
|
|
print(f" ✓ Copied build context successfully")
|
|
# Cleanup
|
|
shutil.rmtree(prole_home / "build" / "prole-db-test")
|
|
else:
|
|
print(" ✗ Copy incomplete")
|
|
sys.exit(1)
|
|
except Exception as e:
|
|
print(f" ✗ Copy failed: {e}")
|
|
sys.exit(1)
|
|
PYTEST
|
|
if [ $? -ne 0 ]; then exit 1; fi
|
|
|
|
echo ""
|
|
echo "========================================"
|
|
echo " ✓ All Docker Build Fix Tests Passed"
|
|
echo "========================================"
|
|
echo ""
|
|
echo "The Docker build will now work correctly:"
|
|
echo " • From source: Uses PROJECT_ROOT/prole-db"
|
|
echo " • From package: Copies to ~/.prole/build/prole-db"
|
|
echo ""
|
|
echo "Build directory: ~/.prole/build/prole-db"
|
|
echo "Build command: docker build -t prole-db:TAG ."
|
|
echo ""
|