From: Jan-Benedict G. <jb...@us...> - 2005-04-14 20:11:55
|
Update of /cvsroot/linux-vax/toolchain/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12172 Modified Files: README Added Files: try_patches.sh Log Message: - try_patches.sh: patch sources with a named set of patches. Index: README =================================================================== RCS file: /cvsroot/linux-vax/toolchain/scripts/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- README 14 Apr 2005 20:04:38 -0000 1.2 +++ README 14 Apr 2005 20:11:46 -0000 1.3 @@ -28,3 +28,13 @@ manually, but it's of little use... It'll copy the first directory's contents into the second directory. + +try_patches.sh +~~~~~~~~~~~~~~ +This script gets three arguments (component (like binutils, gcc, glibc, ports), +the directory containing sources to be patched and a directory containing +patches). All patches (in the patches directory) are expected to follow this +filename convention: + + ${3}/COMPONENT-nnn-some_description.patch + --- NEW FILE: try_patches.sh --- #!/bin/sh # # $1 - component to patch (gcc, glibc, ports, binutils) # $2 - destination directory; patches are expected to apply with -p1 # $3 - directory containing the patches # function try_patches() { echo -n "Looking for ${1} patches... " if ! ls ${3}/${1}-[0-9][0-9][0-9]-*.patch > /dev/null 2>&1; then echo "none." return else echo "found `ls ${3}/${1}-[0-9][0-9][0-9]-*.patch | wc -l`." fi for patchfile in ${3}/${1}-[0-9][0-9][0-9]-*.patch; do echo "Applying `basename "${patch}"` ..." pushd "${2}" patch -p1 --verbose < "${patchfile}" popd done } if [ $# -ne 3 ]; then echo "$0 <component> <directory-to-patch> <directory-containing-patches>" >&2 echo "All patches are expected to apply with -p1 within directory-to-patch." >&2 echo "Their names are expected to be in this form:" >&2 echo "" >&2 echo " COMPONENT-nnn-description.patch" >&2 echo "" >&2 echo "nnn is exactly three decimal digits; description mustn't contain spaces." >&2 exit 1 fi if [ ! -d "${2}" ]; then echo "${2} is not a directory, so I don't expect patchable sources here..." >&2 exit 1 fi if [ ! -d "${3}" ]; then echo "${3} is not a directory, so I don't expect patches here..." >&2 exit 1 fi try_patches "${1}" "${2}" "${3}" |