Topics

Removing URL escapes from a Bitbake variable

Patrick Doyle <wpdster@...>
 

I have a recipe that looks something like this (I'm simplifying a bit here):

SRC_URI += "${EXTERNAL_URL}"

do_compile() {
do -something -with $(basename ${EXTERNAL_URL} .ext)
}

where EXTERNAL_URL is supplied in the environment when invoking
Bitbake (and is whitelisted in the environment).

The problem is, if that URL has HTTP escapes in it, they get decoded
by the fetcher, and the file in ${WORKDIR} no longer looks like
$(basename ${EXTERNAL_URL}).

Is there any way to invoke a URL decoder on a variable within bitbake?
Is there any way to determine what the filename was of a file that was
downloaded?
Is there any better way to do this?

Thanks for any tips you can provide.

--wpd

Patrick Doyle <wpdster@...>
 

On Mon, Apr 6, 2020 at 3:34 PM Patrick Doyle <wpdster@...> wrote:

I have a recipe that looks something like this (I'm simplifying a bit here):

SRC_URI += "${EXTERNAL_URL}"

do_compile() {
do -something -with $(basename ${EXTERNAL_URL} .ext)
}

where EXTERNAL_URL is supplied in the environment when invoking
Bitbake (and is whitelisted in the environment).

The problem is, if that URL has HTTP escapes in it, they get decoded
by the fetcher, and the file in ${WORKDIR} no longer looks like
$(basename ${EXTERNAL_URL}).
Never mind. I found it. I did something like:

EXTERNAL_FILE="${@bb.fetch.decodeurl(d.getVar('EXTERNAL_URL',True))[2]}"
do_compile() {
do -something-with $(basename ${EXTERNAL_URL})
}

I would still be happy to learn of a better way to have done this.

--wpd