often times we put patches in ${FILESDIR} or we d/l them from some place via SRC_URI ... seems silly that so many patches given to `epatch` are of the form: ${FILESDIR}/patch ... why not do this: if [ -n "$1" ] ; then if [ "${EPATCH_SOURCE}" = "${WORKDIR}/patch" ] ; then EPATCH_SOURCE="$1" fi if [ ! -f "$1" ] ; then if [ -f "${FILESDIR}/$1" ] ; then EPATCH_SOURCE="${FILESDIR}/$1" elif [ -f "${DISTDIR}/$1" ] ; then EPATCH_SOURCE="${DISTDIR}/$1" elif [ -f "${WORKDIR}/$1" ] ; then # maybe we dont really need this ... EPATCH_SOURCE="${WORKDIR}/$1" fi fi fi eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:"
Bit ambiguous. What if you specify a bulk patch dir != "$WORKDIR/patch" ? More like (you can do form cleanups later on): if [ -n "$1" ] ; then if [ -d "$1" ] ; then EPATCH_SOURCE="$1" elif [ ! -f "$1" -a -f "${EPATCH_SOURCE}/$1" ] ; then EPATCH_SOURCE="${EPATCH_SOURCE}/$1" fi if [ ! -e "${EPATCH_SOURCE}" ] ; then if [ -f "${FILESDIR}/$1" ] ; then EPATCH_SOURCE="${FILESDIR}/$1" elif [ -f "${DISTDIR}/$1" ] ; then EPATCH_SOURCE="${DISTDIR}/$1" elif [ -f "${WORKDIR}/$1" ] ; then # maybe we dont really need this ... EPATCH_SOURCE="${WORKDIR}/$1" fi fi fi
i'll let you handle the details, i just more wanted the idea of search paths ...the bit of code was to help express my thoughts ;)
actually i just realized this could lead to some obscure bugs ... for example, you have a patch in $WORKDIR and another patch in $FILESDIR which are named the same ... but you misspell the patch while putting it into $FILESDIR and epatch goes and uses the one in $WORKDIR instead of the one in $FILESDIR :) lame, but could easily lead to a lot of wasted time