Files
PawletOS-Build/README.md
T
oxmc 53f3bc95c7 patches.mappings: support prefix-strip in addition to exact match
Lets patches be laid out as android/<version>/<real-aosp-path>/*.patch
and still land in the correct project, instead of every patch under a
mapped folder going to one fixed target.
2026-07-04 06:30:46 -07:00

122 lines
4.8 KiB
Markdown

# PawletOS-Build
Scripts and helpers to build PawletOS.
## Usage
### Setup Environment
```bash
# Install dependencies
pip3 install -r requirements.txt
# Setup and sync source code
python3 environ.py --applyPatches
# Or with custom source directory
python3 environ.py --sourceDir my-source --applyPatches
```
### Configuration
Create `repo.yml` (or copy [`example.repo.yml`](example.repo.yml), which has this
same structure with full inline comments):
```yaml
repo:
# Upstream manifest repo, passed to `repo init -u`.
url: "https://android.googlesource.com/platform/manifest"
# Tag/branch, passed to `repo init -b`. Must match an AOSP release tag.
branch: "android-14.0.0_r1"
# Extra flags appended verbatim to `repo init`.
options:
- "--depth=1"
- "--no-clone-bundle"
# Local manifest XML fragments. Downloaded with `requests` and written to
# <sourceDir>/.repo/local_manifests/<key>.xml after `repo init`, before
# `repo sync` — `repo` merges every *.xml in that directory into the manifest
# (adding projects, removing projects, overriding revisions, etc).
#
# Every key's value is normally a single URL string, downloaded as-is to
# "<key>.xml". The "remove_projects" key is the one exception: it may instead
# be a YAML list of URLs, all downloaded and merged into one "remove_projects.xml",
# combining child elements and de-duplicating ones that share the same tag +
# name attribute (first occurrence wins). Handy for splitting a long
# <remove-project> list across a common file and a device-specific one.
local_manifests:
device_manifest: "https://raw.githubusercontent.com/example/device-manifest/main/manifest.xml"
vendor_manifest: "https://raw.githubusercontent.com/example/vendor-manifest/main/manifest.xml"
remove_projects:
- "https://raw.githubusercontent.com/example/manifests/main/common/remove_projects.xml"
- "https://raw.githubusercontent.com/example/manifests/main/device/remove_projects.xml"
# Used with --applyPatches / --forceApplyPatches.
patches:
# Directories (relative to sourceDir) to search recursively for *.patch files,
# resolved after repo sync. Subdirectory layout mirrors AOSP project paths:
# patches/frameworks/base/*.patch -> applied at frameworks/base/
# patches/packages/apps/Settings/*.patch -> applied at packages/apps/Settings/
dirs:
- patches
# Optional: maps a patch subdirectory to a different AOSP project path, for
# layouts that don't/shouldn't mirror the AOSP tree directly. Two forms:
#
# - Exact match -> replace the whole subdir: every patch found under it
# applies to the one given project.
# android/36: frameworks/base
# patches/android/36/*.patch -> applied at frameworks/base/
#
# - Prefix match (map to "") -> strip the matched prefix and use the rest
# of the path as-is. Lets you group patches by Android version while
# still targeting multiple different AOSP projects underneath:
# android/37: ""
# patches/android/37/frameworks/base/*.patch -> applied at frameworks/base/
# patches/android/37/packages/apps/Settings/*.patch -> applied at packages/apps/Settings/
mappings:
android/36: frameworks/base
android/37: ""
```
### Command Line Options
| Option | Description |
|--------|-------------|
| `--noSync` | Skip repo sync (sync is enabled by default) |
| `--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: AOSP-source) |
| `--patchDir <dirs>` | Patch directories (default: patches). Can specify multiple. |
| `--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 |
| `--config <file>` | Path to repo configuration file (default: repo.yml) |
| `--no-git-lfs` | Disable Git LFS setup (enabled by default) |
## Files
- `environ.py` - Main setup script
- `repo.yml` - Repository configuration (not tracked; create your own, see below)
- `example.repo.yml` - Fully commented example/reference for `repo.yml`
- `scripts/better-patch.py` - Patch management
- `patches/` - Patch files
## Requirements
- Python 3.6+
- Git (recommended for advanced patch features)
- Git LFS (optional, for large file support)
- Android build tools (repo, patch)
- Bash shell for setup scripts
- Python packages:
- `PyYAML` (for YAML configuration support)
- `requests` (for downloading local manifests)
### Installing Python Dependencies
```bash
pip3 install PyYAML requests
```