Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 27029

Summary: search paths for `epatch`
Product: Portage Development Reporter: SpanKY <vapier>
Component: UnclassifiedAssignee: Martin Schlemmer (RETIRED) <azarah>
Status: RESOLVED WONTFIX    
Severity: enhancement    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description SpanKY gentoo-dev 2003-08-20 20:14:32 UTC
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:"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-08-22 13:21:40 UTC
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
Comment 2 SpanKY gentoo-dev 2003-08-22 13:54:18 UTC
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 ;) 
Comment 3 SpanKY gentoo-dev 2004-06-17 18:43:56 UTC
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