This document describes how to develop, manage, and maintain patches for the DataSipper project.
DataSipper uses a patch-based approach to modify Chromium, similar to projects like Ungoogled Chromium. This allows us to maintain our modifications separately from the upstream Chromium codebase and makes it easier to update to newer Chromium versions.
patches/
├── series # Master patch application order
├── core/ # Essential DataSipper functionality
│ ├── datasipper/ # Core infrastructure patches
│ ├── network-interception/ # Network capture patches
│ ├── ui-panel/ # UI panel patches
│ └── external-integrations/ # Integration patches
├── extra/ # Optional features
│ ├── network-interception/ # Advanced network features
│ ├── ui-panel/ # Enhanced UI features
│ └── external-integrations/ # Additional integrations
└── upstream-fixes/ # Fixes for upstream Chromium issues
-
Core Patches (
core/): Essential modifications required for DataSipper functionality- Must be maintained across Chromium updates
- Should be minimal and focused
- Include network interception, UI panel, and basic integrations
-
Extra Patches (
extra/): Optional enhancements and advanced features- May be dropped if they become too difficult to maintain
- Include advanced filtering, visualization, and extended integrations
-
Upstream Fixes (
upstream-fixes/): Patches that fix issues in upstream Chromium- Should be submitted upstream when possible
- May be removed when fixes are included in newer Chromium versions
- GNU Quilt: For patch development and management
- Python 3.9+: For patch automation scripts
- Git: For version control and upstream tracking
# Source the quilt environment
source scripts/set_quilt_vars.sh
# Navigate to Chromium source
cd chromium-src/src# Create new patch file
./scripts/patches.py create my-feature-name --category core/datasipper
# Or using quilt (after sourcing environment)
cd chromium-src/src
qnew core/datasipper/my-feature-name.patch# Add files you plan to modify
quilt add path/to/file.cc
quilt add path/to/file.h
# Make your changes using your preferred editor
quilt edit path/to/file.cc
# Or edit directly and add afterwards
vim path/to/file.cc
quilt add path/to/file.cc# Refresh the patch with your changes
quilt refresh
# Review the patch
quilt diffEdit patches/series to include your new patch in the correct location:
# Add your patch in the appropriate section
core/datasipper/my-feature-name.patch
# Test patch application
./scripts/patches.py apply --dry-run
# Apply all patches
./scripts/patches.py apply
# Build and test Chromium
cd chromium-src/src
ninja -C out/Default chrome# List all patches
./scripts/patches.py list
# Validate all patches exist
./scripts/patches.py validate
# Apply all patches
./scripts/patches.py apply
# Test application without applying
./scripts/patches.py apply --dry-run
# Force application (continue on errors)
./scripts/patches.py apply --force
# Remove all patches
./scripts/patches.py reverse
# Create new patch
./scripts/patches.py create patch-name --category core/datasipper# Source environment first
source scripts/set_quilt_vars.sh
cd chromium-src/src
# Apply patches
qpush -a # Apply all patches
qpush # Apply next patch
qpush patch-name # Apply up to specific patch
# Remove patches
qpop -a # Remove all patches
qpop # Remove current patch
qpop patch-name # Remove down to specific patch
# Patch development
qnew patch-name # Create new patch
qadd file # Add file to current patch
qedit file # Edit file (auto-adds to patch)
qrefresh # Update current patch
qdiff # Show current patch diff
# Information
qtop # Show current patch
qapplied # List applied patches
qunapplied # List unapplied patches
qseries # Show all patches- Must use unified diff format (
diff -u) - UTF-8 encoding required
- Paths must be relative to Chromium source root
- Use
a/andb/prefixes with 3-line context
- Use descriptive names:
network-request-interception.patch - Include feature area:
ui-panel-slide-animation.patch - Use hyphens, not underscores
- End with
.patchextension
Include descriptive headers in patches:
# DataSipper: Add network request interception
#
# This patch implements the core network request interception
# functionality for capturing HTTP/HTTPS traffic.
#
# Affects:
# - content/browser/loader/navigation_url_loader_impl.cc
# - services/network/url_loader.cc
--- a/content/browser/loader/navigation_url_loader_impl.cc
+++ b/content/browser/loader/navigation_url_loader_impl.cc# Update Chromium source to new version
cd chromium-src/src
git fetch origin
git checkout <new-commit-hash>
gclient sync
# Remove old patches
./scripts/patches.py reverse
# Attempt to apply patches
./scripts/patches.py applyWhen patches fail to apply:
# Try forcing application to see which patches fail
./scripts/patches.py apply --force
# For each failing patch, use quilt to fix
cd chromium-src/src
source ../../scripts/set_quilt_vars.sh
# Push patches one by one and fix conflicts
qpush # Apply next patch
# If it fails:
qpush -f # Force apply with rejects
qedit <conflicted-file> # Edit to fix conflicts
qrefresh # Update the patch# Make necessary changes to fix the patch
quilt edit path/to/file.cc
# Update the patch
quilt refresh
# Continue with remaining patches
quilt push- Keep patches focused and minimal
- Avoid large code deletions using language features
- Remove code line by line for clarity
- Group related changes in single patches
- Document the purpose and scope of each patch
- Always test patch application on clean Chromium source
- Build and test functionality after applying patches
- Test patch removal and reapplication
- Verify patches apply in correct order
- Regularly test patches against newer Chromium versions
- Keep patch descriptions up to date
- Remove patches that are no longer needed
- Submit upstream fixes when appropriate
- Document patch purpose and implementation
- Keep series file organized and commented
- Update this guide when adding new procedures
- Maintain patch interdependency documentation
- Fuzz: Code has changed slightly, patch may still work
- Rejects: Code has changed significantly, manual intervention needed
- Missing files: Files have been moved or deleted upstream
- Update file paths if files have moved
- Adapt patches to new code structure
- Split large patches into smaller, more focused ones
- Remove patches that are no longer relevant
- Use
--dry-runto test without applying - Check git log for relevant upstream changes
- Use
quilt diffto see what changes a patch makes - Apply patches incrementally to isolate issues
When contributing new patches:
- Follow the patch format requirements
- Test thoroughly on clean Chromium source
- Document the patch purpose and scope
- Add appropriate entries to the series file
- Update relevant documentation
- Consider backward compatibility with existing features
For questions or issues with patch development, consult the project documentation or create an issue in the project repository.