Dealing with quilt

Copyright 2016 by Assured Information Security, Inc. Created by Jean-Edouard Lejosne <lejosnej@ainfosec.com>. This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

Quilt Setup

Configure quilt to generate patches with less metadata by creating ~/.quiltrc with the following content:

# Options passed to GNU diff when generating patches
QUILT_DIFF_OPTS="--show-c-function"

# Options passed to GNU patch when applying patches.
QUILT_PATCH_OPTS="--unified"

# Do not include index lines
QUILT_NO_DIFF_INDEX=1
# Do not include timestamps
QUILT_NO_DIFF_TIMESTAMPS=1

# Options to pass to commands (QUILT_${COMMAND}_ARGS)
# Generate a/ b/ patches to cut down on churn
#QUILT_DIFF_ARGS="--no-timestamps --color=auto -p ab"
#QUILT_REFRESH_ARGS="--no-timestamps --backup -p ab"
QUILT_DIFF_ARGS="--color=auto -p ab"
QUILT_REFRESH_ARGS="--backup -p ab"
QUILT_PUSH_ARGS="--color=auto"
QUILT_SERIES_ARGS="--color=auto"
QUILT_PATCHES_ARGS="--color=auto"
QUILT_NEW_ARGS="-p ab"

If you don't set the above options, you should run `quilt refresh` with additional command line arguments `quilt refresh -p ab --no-timestamps --no-index` when refreshing patches.  As we store patches in git, the reduced metadata makes a cleaner git history when we uprev software packages.

Modifying an existing patch

  • in the following, replace <recipe> by the name of the recipe you want to modify
  • go to the work directory (`cd openxt/build/tmp-eglibc/work/*/<recipe>-*/*/`)
  • type `quilt` for a list of commands. `quilt applied`, for example, will show you all the patches that are currently applied, which should be all of them
  • find the patch you want to modify, say x.patch, and pop to it: `quilt pop x.patch`, that will unapply all the patches applied after (on top of) that one
  • add the file you want to modify to the patch: `quilt add file.c`
  • do the modifications you want. if you did the modifications before reaching this step, game over. run `./bb -c cleansstate <recipe> && ./bb <recipe>` and start over
  • once you've modified the file, you `quilt refresh` to refresh the patch
  • then `quilt push -a` to make sure the part of the patchqueue you pop-ed earlier still applies
  • if your patch modification introduces a conflict or any fuzz to another patch, fix it
  • once you're done, overwrite the patch file in the xenclient-oe repository (openxt/build/repos/xenclient-oe/) with the newly modified one (under patches/ in the work directory)
  • then clean and rebuild the recipe: ./bb -c cleansstate recipe && ./bb recipe
  • test the result. if all works, you can finally go to openxt/build/repos/xenclient-oe, commit and push to your xenclient-oe fork!