On 07/22/2016 11:20 AM, Miguel Flores Silverio wrote:
On 07/22/2016 10:02 AM, Laura Abbott wrote:
> On 07/20/2016 09:44 AM, Miguel Flores Silverio wrote:
>> It enables the builid macro and uses the name of the patch as
>> label instead of rpmdev-bumpspec.
>>
>> Signed-off-by: Miguel Flores Silverio <floresmigu3l(a)gmail.com>
>
> This doesn't apply to my tree and neither does the patch for
> perf-man. Can you double check how you are generating the patches
> with 'git format-patch'?
Interesting. Could be the fact that I generated both patches on a separate branch from
master?
That is the only thing I did different this time.
Was the branch based on master or were there other changes before
these? That can screw things up. At least for the perf-man.sh
script it didn't look like it was fully detecting it as a new
file. Try doing.
git checkout -b my_current_work
git checkout -b new_patch_v4 origin/master
git cherry-pick <commit of new_patch_v4>
git format-patch -1 HEAD
and then repeating for perf-man-v5. This will ensure your patch
is always based on master.
>
>> ---
>> * PATCHv2
>> - Fix: Fail adding a patch with no description
>> - Fix: Fail to add a patch outside the tree
>> - Fix: Fail when adding a patch already in the tree directory
>> - Fix: Fail to add to git when running script outside tree
>> - enables the buildid and changes it to the patch name being added
>> * PATCHv3
>> - replaces "-" [dash] with "_"[uder score] to use patch
name
>> as builid
>> * PATCHv4
>> - changed mv for cp
>> - Fix: conflicts when applying to rawhide
>>
>> scripts/newpatch.sh | 57 ++++++++++++++++++++++++++++++++++++-----------------
>> 1 file changed, 39 insertions(+), 18 deletions(-)
>>
>> diff --git a/scripts/newpatch.sh b/scripts/newpatch.sh
>> index 0dc2e83..bf85767 100755
>> --- a/scripts/newpatch.sh
>> +++ b/scripts/newpatch.sh
>> @@ -1,21 +1,42 @@
>> -#!/bin/sh
>> -# Easy application of new patches.
>> -# Always adds to the very end. (Bumps last patch nr by 100)
>> -# Parameters:
>> -# $1 - patch filename
>> -# $2 - description
>> +#! /bin/sh
>>
>> -OLD=$(grep ^Patch kernel.spec | tail -n1 | awk '{ print $1 }' | sed
s/Patch// | sed s/://)
>> -NEW=$(($OLD/100*100+100))
>> +# Facilitates the addition of a new patch to the source tree.
>> +# -- Moves patch to tree
>> +# -- Adds patch to kernel.spec list of patches
>> +# -- Adds patch to git
>> +# -- change buildid macro to the name of the patch being added
>>
>> -sed -i "/^Patch$OLD:\ /a#\ $2\nPatch$NEW:\ $1" kernel.spec
>> -
>> -LAST=$(grep ^ApplyPatch kernel.spec | tail -n1 | awk '{ print $2 }')
>> -
>> -sed -i "/^ApplyPatch $LAST/aApplyPatch $1" kernel.spec
>> -
>> -cvs add $1
>> -
>> -scripts/bumpspecfile.py kernel.spec "- $2"
>> -make clog
>> +# Base directory is relative to where the script is.
>> +BASEDIR="$(dirname "$(cd $(dirname $BASH_SOURCE[0]) &&
pwd)")"
>> +pushd $BASEDIR > /dev/null
>> +# Check for at least patch
>> +if [ "$#" -lt 1 ]; then
>> + echo "usage: $0 [ /path/to/patch/ ] [ description ]"
>> + exit 1
>> +fi
>> +PATCHDIR=$1
>> +DESC=$2
>> +PATCH="$(basename "$PATCHDIR")"
>> +# Kernel.spec file in the current tree
>> +SPECFILE="$BASEDIR/kernel.spec"
>> +# If adding patch from outside the source tree move it to the source tree
>> +if [ -z "$(ls | grep $PATCH)" ]; then
>> + cp $PATCHDIR $BASEDIR/
>> +fi
>>
>> +if [ ! -z "$(grep $PATCH $SPECFILE)" ]
>> +then
>> + echo "$PATCH already in kernel.spec"
>> + exit 1
>> +fi
>> +# ID number of the last patch in kernel.spec
>> +LPATCH_ID=$(grep ^Patch $SPECFILE | tail -n1 | awk '{ print $1 }' | sed
s/Patch// | sed s/://)
>> +# ID of the next patch to be added to kernel.spec
>> +NPATCH_ID=$(($LPATCH_ID + 1 ))
>> +# Add patch with new id at the end of the list of patches
>> +sed -i "/^Patch$LPATCH_ID:\ /a#\ $DESC\nPatch$NPATCH_ID:\ $PATCH"
$SPECFILE
>> +# Add it to git
>> +git add $PATCH
>> +BUILDID_PATCH="$(echo $PATCH | sed 's/\-/\_/g' )"
>> +sed -i "s/^.*define buildid .*$/%define buildid .$BUILDID_PATCH/"
$SPECFILE
>> +popd > /dev/null
>> --
>> 2.7.4
>>
>