Using quilt to Apply Patches from a Different Directory
If you have a set of patches stored in a different directory and want to apply them to the current working directory’s source tree, follow these general steps:
Use “sudo apt install quilt” if needed.
1. Set Up the QUILT_PATCHES Environment Variable
quilt looks for patches in the .pc directory by default, but you can override this by specifying the directory containing the patches.
export QUILT_PATCHES=/path/to/patches
Alternatively, you can set it inline when running commands:
QUILT_PATCHES=/path/to/patches quilt series
Create series file andf put in working directory:
If the file is missing, you can create it manually by listing your patches:
cd /path/to/patches
ls *.patch > series
cpseries/path/to/builddirectory
Then edit the series file to ensure it contains one patch filename per line.
2. Initialize and Refresh Quilt Metadata
Ensure that the quilt metadata is set up in your working directory:
quilt push -a # Attempt to apply all patches
If you get conflicts or errors, you may need to apply patches one by one:
quilt push
3. Applying Patches Manually
If you only want to apply specific patches, list available patches first:
quilt series
Then apply a specific patch:
quilt push patch-name.patch
4. Checking Patch Application
After applying patches, verify the applied patches using:
quilt applied
To see unapplied patches:
quilt unapplied
5. Removing Patches (If Needed)
If a patch doesn’t apply correctly, you can pop it off:
quilt pop
To remove all patches:
quilt pop -a
6. Editing and Refreshing Patches
If modifications are needed after applying patches:
quilt edit <file>
quilt refresh
7. Cleaning Up
If you no longer need quilt metadata in your directory:
rm -rf .pc
