PawletOS-Build
A comprehensive build system for PawletOS with advanced patch management and Android source synchronization capabilities.
Overview
PawletOS-Build provides automated tools for setting up and managing the PawletOS build environment, featuring:
- Intelligent Patch Management: Advanced patch application with conflict detection and resolution
- Source Synchronization: Automated Android source sync using repo
- Build Environment Setup: Streamlined environment configuration for Raspberry Pi builds
- Robust Error Handling: Graceful fallback mechanisms and detailed error reporting
Features
🔧 Build System (build.py)
The main build script provides comprehensive Android build environment setup with the following capabilities:
- Source Code Synchronization: Sync Android source code using
repo syncwith configurable parallel jobs - Advanced Patch Application: Intelligent patch system with two modes:
- Robust Handler: Git-based patch application with conflict analysis and dependency detection
- Legacy Handler: Traditional patch command fallback for compatibility
- Flexible Configuration: Customizable source directories, patch levels, and build options
- Batch Processing: Apply multiple patches with selective filtering and ignore lists
🛠️ Patch Management (scripts/better-patch.py)
Advanced patch handling system featuring:
- Conflict Analysis: Pre-application analysis of potential patch conflicts
- Dependency Detection: Automatic detection of patch dependencies and ordering
- Rollback Capability: Automatic rollback on failure with cleanup
- Git Integration: Leverages Git's powerful merge capabilities for better conflict resolution
- Detailed Reporting: Comprehensive patch application reports and statistics
🍓 Raspberry Pi Setup (rpivanilla-ensetup.sh)
Environment setup script for Raspberry Pi vanilla builds:
- Sets up the RaspberryVanilla build environment
- Sources necessary build configuration files
- Provides template for build-specific exports
Usage
Quick Start
-
Basic patch application:
python3 build.py --applyPatches -
Sync source and apply patches:
python3 build.py --resync --applyPatches -
Force operations with verbose output:
python3 build.py --forceResync --forceApplyPatches --verbosePatches
Command Line Options
| Option | Description |
|---|---|
--resync |
Sync source code with repo sync |
--forceResync |
Force sync source code with repo sync --force-sync |
--applyPatches |
Apply patches from patches directory |
--forceApplyPatches |
Force apply patches even if some fail |
--patchLevel <n> |
Patch level for -p option (default: 1) |
--sourceDir <path> |
Source directory (default: current directory) |
--patchDir <path> |
Patch directory (default: patches) |
--syncJobs <n> |
Number of parallel jobs for repo sync |
--ignorePatches <files> |
List of patches to ignore |
--useLegacyPatch |
Use legacy patch command instead of robust handler |
--verbosePatches |
Verbose output for patch application |
Advanced Patch Management
The build system includes an intelligent patch handler that provides:
- Pre-flight Analysis: Analyzes patches before application to detect conflicts
- Smart Conflict Resolution: Uses Git's three-way merge for better conflict handling
- Dependency Management: Automatically orders patches based on file dependencies
- Rollback Protection: Automatic rollback on failure with repository cleanup
Environment Setup
For Raspberry Pi builds, use the provided setup script:
chmod +x rpivanilla-ensetup.sh
./rpivanilla-ensetup.sh
This script will:
- Navigate to the RaspberryVanilla directory
- Source the build environment setup
- Prepare the environment for lunch and build commands
Directory Structure
PawletOS-Build/
├── build.py # Main build system script
├── rpivanilla-ensetup.sh # Raspberry Pi environment setup
├── scripts/
│ └── better-patch.py # Advanced patch management system
├── patches/ # Patch files directory (created as needed)
└── README.md # This file
Requirements
- Python 3.6+
- Git (recommended for advanced patch features)
- Android build tools (repo, patch)
- Bash shell for setup scripts
Contributing
When adding new patches or modifying the build system:
- Test patches individually before batch application
- Use
--verbosePatchesfor debugging patch issues - Consider patch dependencies when organizing patch files
- Update documentation for new features or options
License
See the LICENSE file for licensing information.