http://people.freedesktop.org/~ajax/kernel-autopatch.patch Based on something I did for the xserver specfile. Essentially this makes it so you only have to name the patches once, in the order you want to apply them, which makes it both easier to work with and harder to forget things. I''ve tried to make this as friendly and robust as possible, including bailing out appropriately when faced with a bad patch, and explicitly naming patches that fail to apply right at the end of build output. Feedback would be appreciated, even if it''s of the form "no, that''s gross." - ajax
On 21/01/2008, Adam Jackson <ajackson@redhat.com> wrote:> http://people.freedesktop.org/~ajax/kernel-autopatch.patch > > Based on something I did for the xserver specfile. Essentially this > makes it so you only have to name the patches once, in the order you > want to apply them, which makes it both easier to work with and harder > to forget things. > > I''ve tried to make this as friendly and robust as possible, including > bailing out appropriately when faced with a bad patch, and explicitly > naming patches that fail to apply right at the end of build output. > Feedback would be appreciated, even if it''s of the form "no, that''s > gross."Can''t speak from an implementation point of view but you must be a mind-reader. Several people will appreciate the thought behind it, myself included. On #fedora-kernel recently: <kylem> i really find it irritating that i need to edit Patchxx: *and* add an ApplyPatch. * kylem ponders converting the spec file to use quilt. <j-rod> fark <j-rod> not a fan of that either <jwb> why not j-rod ? <f13> I think he meant he''s not a fan of editing twice. <f13> not that he wasn''t a fan of quilt. <jwb> oh <kylem> i always forget to do one or the other :\ Cheers! -- Christopher Brown http://www.chruz.com
Christopher Brown wrote:> On 21/01/2008, Adam Jackson <ajackson@redhat.com> wrote: >> http://people.freedesktop.org/~ajax/kernel-autopatch.patch >> >> Based on something I did for the xserver specfile. Essentially this >> makes it so you only have to name the patches once, in the order you >> want to apply them, which makes it both easier to work with and harder >> to forget things. >> >> I''ve tried to make this as friendly and robust as possible, including >> bailing out appropriately when faced with a bad patch, and explicitly >> naming patches that fail to apply right at the end of build output. >> Feedback would be appreciated, even if it''s of the form "no, that''s >> gross." > > Can''t speak from an implementation point of view but you must be a > mind-reader. Several people will appreciate the thought behind it, > myself included. On #fedora-kernel recently: > > <kylem> i really find it irritating that i need to edit Patchxx: *and* > add an ApplyPatch. > * kylem ponders converting the spec file to use quilt. > <j-rod> fark > <j-rod> not a fan of that either > <jwb> why not j-rod ? > <f13> I think he meant he''s not a fan of editing twice. > <f13> not that he wasn''t a fan of quilt. > <jwb> oh > <kylem> i always forget to do one or the other :\First glance says oh hell yeah, check it in. -- Jarod Wilson jwilson@redhat.com
On 01/21/2008 05:22 PM, Adam Jackson wrote:> http://people.freedesktop.org/~ajax/kernel-autopatch.patch >Using the below script, based on what you suggested, we can add lines like this to specify patch options: Patch101: a.patch PATCH101_OPTS=-R -F2 And this to skip a patch: Patch101: a.patch PATCH101_OPTS=SKIP With this change I''d say go for it. awk ''/^Patch.*:/ { print $1" %{_sourcedir}/"$2 }'' %{_specdir}/%{name}.spec | while read num patch ; do optfield="$( echo $num | cut -f 1 -d : | tr [:lower:] [:upper:] )_OPTS" opts="$( cat %{_specdir}/%{name}.spec | grep ^${optfield} | cut -f 2 -d = )" [[ $opts == "SKIP" ]] && continue if ! ApplyPatch "$patch" $opts ; then set +x echo Failed to apply $(basename $patch). exit 1 fi done || exit 1
On 01/22/2008 01:47 PM, Chuck Ebbert wrote:> awk ''/^Patch.*:/ { print $1" %{_sourcedir}/"$2 }'' %{_specdir}/%{name}.spec | > while read num patch ; do > optfield="$( echo $num | cut -f 1 -d : | tr [:lower:] [:upper:] )_OPTS" > opts="$( cat %{_specdir}/%{name}.spec | grep ^${optfield} | cut -f 2 -d = )"Should be this, just in case any option contains an "=": opts="$( cat %{_specdir}/%{name}.spec | grep ^${optfield} | cut -f 2- -d = )"> [[ $opts == "SKIP" ]] && continue > if ! ApplyPatch "$patch" $opts ; then > set +x > echo Failed to apply $(basename $patch). > exit 1 > fi > done || exit 1 >
On Mon, Jan 21, 2008 at 11:20:17PM -0500, Jarod Wilson wrote: > Christopher Brown wrote: > > On 21/01/2008, Adam Jackson <ajackson@redhat.com> wrote: > >> http://people.freedesktop.org/~ajax/kernel-autopatch.patch > >> > >> Based on something I did for the xserver specfile. Essentially this > >> makes it so you only have to name the patches once, in the order you > >> want to apply them, which makes it both easier to work with and harder > >> to forget things. > >> > >> I''ve tried to make this as friendly and robust as possible, including > >> bailing out appropriately when faced with a bad patch, and explicitly > >> naming patches that fail to apply right at the end of build output. > >> Feedback would be appreciated, even if it''s of the form "no, that''s > >> gross." > > > First glance says oh hell yeah, check it in. The magic to only apply linux-2.6-compile-fixes.patch if there''s something in the file disappeared, but other than that it looks ok to me too. Dave -- http://www.codemonkey.org.uk
On Tue, Jan 22, 2008 at 01:47:09PM -0500, Chuck Ebbert wrote: > On 01/21/2008 05:22 PM, Adam Jackson wrote: > > http://people.freedesktop.org/~ajax/kernel-autopatch.patch > > > > Using the below script, based on what you suggested, we can add lines like > this to specify patch options: > > Patch101: a.patch > PATCH101_OPTS=-R -F2 > > And this to skip a patch: > > Patch101: a.patch > PATCH101_OPTS=SKIP > > With this change I''d say go for it. The amount of voodoo in the kernel spec file is both scary, and awesome at the same time. I love it :) Dave -- http://www.codemonkey.org.uk