As far as I know, this trick was invented by Peter Jones. Edit: Or it could be ajax?
Parted in Fedora uses a clever method to manage patches with git and “git am”.
%prep
%setup -q
# Create a git repo within the expanded tarball.
git init
git config user.email "..."
git config user.name "..."
git add .
git commit -a -q -m "%{version} baseline."
# Apply all the patches on top.
git am %{patches}
The background is that there is a git repo somewhere else which stores the unpacked baseline parted tarball, plus patches (stored as commits) on top.
I assume that Peter exports the commits using git format-patch. At build time these are applied on top of the tarball using git am.
There are two clear advantages:
- No need to have lots of duplicate
%patchlines in the spec file. - git-am restores permissions and empty files properly, which regular patch does not do.
With libguestfs in RHEL 6 we have roughly 80 patches, so managing these patches is very tedious, and this will greatly simplify things.
