Skip to contentSkip to conversation

Escaping in PACKAGECONFIG

DISCUSSION Boszormenyi Zoltan 3 participants 3 messages Nov 26, 2014 – Jan 14, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

what is the proper way of escaping a comma in the string specified for PACKAGECONFIG? I would like to use something like the below in my custom PHP recipe:

PACKAGECONFIG[mysql] = ' \
                        --enable-mysqlnd="shared" \
                        --with-mysql="shared,mysqlnd" \
                        --with-mysqli="shared,mysqlnd" \
                        --with-mysql-sock=${localstatedir}/lib/mysql/mysql.sock \
                        --with-pdo-mysql="shared,mysqlnd" \
                        , \
                        ,mysql5'

With ...="shared,mysqlnd", ...="shared\,mysqlnd" or ...="shared\\,mysqlnd" I get:

ERROR: Only enable,disable,depend,rdepend can be specified!

and

ERROR: Nothing PROVIDES 'mysqlnd"' (but .../php/php_5.6.3.bb DEPENDS on or otherwise requires it). Close matches:
mysql5
ERROR: Required build target 'php' has no buildable providers.
Missing or unbuildable dependency chain was: ['php', 'mysqlnd"']

But, this works:

MYSQLND="shared,mysqlnd"

PACKAGECONFIG[mysql] = ' \
                        --enable-mysqlnd="shared" \
                        --with-mysql=${MYSQLND} \        
                        --with-mysqli=${MYSQLND} \                 
                        --with-mysql-sock=${localstatedir}/lib/mysql/mysql.sock \
                        --with-pdo-mysql=${MYSQLND} \                 
                        , \
                        ,mysql5'

Why?

Thanks in advance,
Zoltán Böszörményi

#1 lore raw

Hi Zoltán,

Quoted 35 lines · On Wednesday 26 November 2014 19:17:16 Boszormenyi Zoltan wrote:

what is the proper way of escaping a comma in the string specified for PACKAGECONFIG? I would like to use something like the below in my custom PHP recipe:

PACKAGECONFIG[mysql] = ' \
                        --enable-mysqlnd="shared" \
                        --with-mysql="shared,mysqlnd" \
                        --with-mysqli="shared,mysqlnd" \

--with-mysql-sock=${localstatedir}/lib/mysql/mysql.sock \

--with-pdo-mysql="shared,mysqlnd" \
                        , \
                        ,mysql5'

With ...="shared,mysqlnd", ...="shared\,mysqlnd" or ...="shared\\,mysqlnd" I get:

ERROR: Only enable,disable,depend,rdepend can be specified!

and

ERROR: Nothing PROVIDES 'mysqlnd"' (but .../php/php_5.6.3.bb DEPENDS on or otherwise requires it). Close matches:
mysql5
ERROR: Required build target 'php' has no buildable providers. Missing or unbuildable dependency chain was: ['php', 'mysqlnd"']

But, this works:

MYSQLND="shared,mysqlnd"

PACKAGECONFIG[mysql] = ' \
                        --enable-mysqlnd="shared" \
                        --with-mysql=${MYSQLND} \
                        --with-mysqli=${MYSQLND} \
Quoted 6 lines

--with-mysql-sock=${localstatedir}/lib/mysql/mysql.sock \

--with-pdo-mysql=${MYSQLND} \
                        , \
                        ,mysql5'

Why?

Sorry for the delayed response. Basically, if you look at how PACKAGECONFIG is implemented in meta/classes/base.bbclass, we simply do a python split() call on the value of each varflag value (i.e. each individual PACKAGECONFIG[xyz] value). However, because we get that value using getVarFlags() without passing True for the "expand" parameter, the value is unexpanded, so variable references such as ${MYSQLND} above won't have been expanded when the string gets split. I'm not sure if that was intentional but it is how it has been implemented; I don't think anyone has given much thought to cases like this where you need to have commas in the value since it's relatively uncommon.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#2 lore raw
Quoted 5 lines · Paul Eggleton

Sorry for the delayed response. Basically, if you look at how PACKAGECONFIG is
implemented in meta/classes/base.bbclass, we simply do a python split() call
on the value of each varflag value (i.e. each individual PACKAGECONFIG[xyz]

Quoted 9 lines

value). However, because we get that value using getVarFlags() without passing
True for the "expand" parameter, the value is unexpanded, so variable references such as ${MYSQLND} above won't have been expanded when the string
gets split. I'm not sure if that was intentional but it is how it has been implemented; I don't think anyone has given much thought to cases like this where you need to have commas in the value since it's relatively uncommon.

FWIW, Mesa has a similar problem and that's exactly how it's solved.

Ross