diff options
| author | Alexandre Oliva <lxoliva@fsfla.org> | 2016-09-24 07:15:20 +0000 |
|---|---|---|
| committer | Alexandre Oliva <lxoliva@fsfla.org> | 2016-09-24 07:15:20 +0000 |
| commit | 8087632e47732ff52050c519d55e35c4494a628e (patch) | |
| tree | c5fc5fa3d0075fc6ad50e805aecb73a219818373 /freed-ora/current/f25/scripts | |
| parent | 223f355c62b83bb306b697bac3e663036a5f49e6 (diff) | |
| download | linux-libre-raptor-8087632e47732ff52050c519d55e35c4494a628e.tar.gz linux-libre-raptor-8087632e47732ff52050c519d55e35c4494a628e.zip | |
4.8.0-0.rc7.git0.1.fc25.gnu
Diffstat (limited to 'freed-ora/current/f25/scripts')
| -rwxr-xr-x | freed-ora/current/f25/scripts/check-patchlist.sh | 113 | ||||
| -rwxr-xr-x | freed-ora/current/f25/scripts/newpatch.sh | 55 |
2 files changed, 151 insertions, 17 deletions
diff --git a/freed-ora/current/f25/scripts/check-patchlist.sh b/freed-ora/current/f25/scripts/check-patchlist.sh new file mode 100755 index 000000000..134e41e97 --- /dev/null +++ b/freed-ora/current/f25/scripts/check-patchlist.sh @@ -0,0 +1,113 @@ +#! /bin/sh +# This script was created in a effort to make patch management a bit easier. +# It list all the patches in the current tree and identifies if they are +# present in the kernel.spec, PatchList.txt, both files or neither. +# +# eg. ./check-patchlist.sh [optional flag] + +function usage(){ + echo "List all the patches currently in the tree. It also helps identify" + echo "if the patch is present in kernel.spec or PatchList.txt. " + echo "-h, --help " + echo "-t, --tracked patches in both kernel.spec and PatchList.txt " + echo "-p, --patchlist patches added to PatchList.txt. " + echo "-s, --specfile patches added to kernel.spec. " + echo "-n, --not-tracked patches in the tree but not in PatchList.txt " + echo " or kernel.spec " +} + +BASEDIR=$(dirname "$( cd $(dirname $BASH_SOURCE[0]) && pwd)") +pushd $BASEDIR > /dev/null + +function list_all(){ + echo "===========Legend===========================" + echo ". In kernel.spec " + echo "* In PatchList.txt " + echo "+ In PatchList.txt & Kernel.spec " + echo "- Neither in PatchList.txt nor kernel.spec" + echo "============================================" + for patch in $(ls *.patch); do + if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo "+ ${patch}" # Patches in kernel.spec and PatchList.txt + + elif [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ] + then + echo "* ${patch}" # Patches in PatchList.txt but not in kernel.spec + + elif [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo ". ${patch}" # Patches in kernel.spec but not in PatchList.txt + + else + echo "- ${patch}" # Neither in PatchList.txt nor kernel.spec + + fi + done +} + +function list_present_not_added(){ + for patch in $(ls *.patch); do + if [ -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done +} + +function list_present_added(){ + for patch in $(ls *.patch); do + if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done +} + +function list_patchList(){ + for patch in $(ls *.patch); do + if [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done + +} +function list_specfile(){ + for patch in $(ls *.patch); do + if [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ] + then + echo $patch + fi + done +} + +if [ -z "$@" ]; then + list_all +else + + for opt in "$@"; do + case $opt in + -t|--tracked) + list_present_added + ;; + -s|--specfile) + list_specfile + ;; + -h|--help) + usage + ;; + -n|--not-added) + list_present_not_added + ;; + -p|--patchlist) + list_patchList + ;; + *) + usage + ;; + esac + done +fi + +popd > /dev/null diff --git a/freed-ora/current/f25/scripts/newpatch.sh b/freed-ora/current/f25/scripts/newpatch.sh index 0dc2e837c..2d7498655 100755 --- a/freed-ora/current/f25/scripts/newpatch.sh +++ b/freed-ora/current/f25/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 -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 |

