Skip to contentSkip to conversation

Trying to tweak a build with a setup.cfg file

DISCUSSION Paul D. DeRocco 2 participants 5 messages Aug 19, 2013 – Aug 20, 2013

lore
Share & tools
lore
#0 lore raw

I'm trying to build python-matplotlib from the Danny branch of meta-openembedded/meta-oe/recipes-devtools/python. I need to add a setup.cfg file to tweak the build, but I don't know how to get it into the right place.

I put the setup.cfg into a python-matplotlib subdirectory in my recipes directory, and added a python-matplotlib_1.1.0.bbappend file which contains the following lines:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PRINC := "${@int(PRINC) + 2}"
SRC_URI += "file://setup.cfg"

The file is being copied into .../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib-1.1.0-r3 rather than .../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib-1.1.0-r3/mat plotlib-1.1.0 where it needs to be. How do I push it down a level?

Signature · 2 lines
Ciao,               Paul D. DeRocco
Paul                mailto:[email protected] 
#1 lore raw
Quoted 13 lines · Paul D. DeRocco

I'm trying to build python-matplotlib from the Danny branch of meta-openembedded/meta-oe/recipes-devtools/python. I need to add a setup.cfg file to tweak the build, but I don't know how to get it into the right place.

I put the setup.cfg into a python-matplotlib subdirectory in my recipes directory, and added a python-matplotlib_1.1.0.bbappend file which contains the following lines:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PRINC := "${@int(PRINC) + 2}"
SRC_URI += "file://setup.cfg"

Quoted 6 lines

The file is being copied into .../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib-1.1.0-r3 rather than .../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib-1.1.0-r3/mat plotlib-1.1.0 where it needs to be. How do I push it down a level?

By default, anything in SRC_URI goes into ${WORKDIR}, not ${S}. You should be able to change this like so:

    SRC_URI += "file://setup.cfg;subdir=matplotlib-${PV}"
Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 31 lines

On Mon, Aug 19, 2013 at 3:52 PM, Paul D. DeRocco
<[email protected]> wrote:

I'm trying to build python-matplotlib from the Danny branch of meta-openembedded/meta-oe/recipes-devtools/python. I
need to add a
setup.cfg file to tweak the build, but I don't know how
to get it into the
right place.

I put the setup.cfg into a python-matplotlib
subdirectory in my recipes
directory, and added a python-matplotlib_1.1.0.bbappend
file which

	contains the following lines:
	
	FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
	PRINC := "${@int(PRINC) + 2}"
	SRC_URI += "file://setup.cfg"
	
	The file is being copied into

.../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib-1.1.0-r3
rather than

.../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib- 1.1.0-r3/mat
plotlib-1.1.0 where it needs to be. How do I push it
down a level?

Quoted 6 lines

From: Chris Larson

By default, anything in SRC_URI goes into ${WORKDIR}, not ${S}. You should be able to change this like so:

    SRC_URI += "file://setup.cfg;subdir=matplotlib-${PV}"

Thanks. That'll get me over this hump.

While I was out at my daily workout, I was thinking about this. Is it possible to mimic the directory structure in the metadata, in this case pushing the file down a level, and then specifying that subdirectory name in front of the filename in the SRC_URI, instead of as a "subdir" option after it? Or must file:// always be followed by a simple filename?

I'd experiment with it, but I have a reallly slooow build system which takes about fifteen minutes just to do the do_rootfs.

Signature · 2 lines
Ciao,               Paul D. DeRocco
Paul                mailto:[email protected] 
Quoted 7 lines
Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics 
#3 lore raw
In reply to Chris Larson

Well, I hate to say it, but this didn't work. The setup.cfg file ended up in the same place, even though I did a clean and a cleansstate on the python-matplotlib recipe.

The log shows it searching for setup.cfg, so it is definitely separating the "subdir=" option from the name. And it's not complaining about not finding it. So it's acting like it's ignoring the option.

Google didn't turn up any official documentation on this option, but showed a modest amount of discussion of it, along with a 2009 patch to base.bbclass which implements the creation and switching to of the new directory:

<http://lists.openembedded.org/pipermail/openembedded-commits/2009-January
/097189.html>

Yet this doesn't look remotely like my base.bbclass, which is much shorter than 725 lines, and doesn't contain any code like this. In the intervening years, this may well have been moved into some other module, but it's acting like there is a generic routine that parses name=value options into a list, but doesn't give you an error if nothing uses the option, and nothing is using it.

This is a Gumstix build based on the Danny branch, by the way, which isn't the latest and greatest, but it's not four years old either.

So I decided to try what I mentioned in the last message, which is simply to mimic the fragment of the directory tree in my metadata, creating a file called python-matplotlib/matplotlib-1.1.0/setup.cfg, and putting this in the recipe:

    SRC_URI += "file://matplotlib-${PV}/setup.cfg"

It worked.

I suspect what happened is that support for the "subdir=" option on local files was added in 2009, then someone thought, why have this obscure syntax? Simpler to impose the directory structure on the local files in the metadata, allow file:// to refer to any pathname, not just a filename, and have the file copy routine create any necessary subdirectories in the build tree. So they took that option out. Just a guess.

That said, although the setup.cfg file did cause the necessary module to be compiled, the compile failed for unrelated reasons. If it's not one thing, it's another. And I rather doubt anyone around here has ever used Yocto to build the GDK backend for matplotlib, so I don't know who to ask about this.

Signature · 2 lines
Ciao,               Paul D. DeRocco
Paul                mailto:[email protected] 
Quoted 52 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Larson
Sent: Monday, August 19, 2013 4:37 PM
To: Paul D. DeRocco
Cc: yocto
Subject: Re: [yocto] Trying to tweak a build with a setup.cfg file

On Mon, Aug 19, 2013 at 3:52 PM, Paul D. DeRocco
<[email protected]> wrote:

I'm trying to build python-matplotlib from the Danny branch of meta-openembedded/meta-oe/recipes-devtools/python. I
need to add a
setup.cfg file to tweak the build, but I don't know how
to get it into the
right place.

I put the setup.cfg into a python-matplotlib
subdirectory in my recipes
directory, and added a python-matplotlib_1.1.0.bbappend
file which

	contains the following lines:
	
	FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
	PRINC := "${@int(PRINC) + 2}"
	SRC_URI += "file://setup.cfg"
	
	The file is being copied into

.../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib-1.1.0-r3
rather than

.../work/armv7a-vfp-neon-poky-linux-gnueabi/python-matplotlib- 1.1.0-r3/mat
plotlib-1.1.0 where it needs to be. How do I push it
down a level?

By default, anything in SRC_URI goes into ${WORKDIR}, not ${S}. You should be able to change this like so:

    SRC_URI += "file://setup.cfg;subdir=matplotlib-${PV}"
Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics 
#4 lore raw
Quoted 7 lines · Paul D. DeRocco

I suspect what happened is that support for the "subdir=" option on local files was added in 2009, then someone thought, why have this obscure syntax? Simpler to impose the directory structure on the local files in the metadata, allow file:// to refer to any pathname, not just a filename, and have the file copy routine create any necessary subdirectories in the build tree. So they took that option out. Just a guess.

We've always supported directories in file:// uris. The unpacking process was moved from base.bbclass into the bitbake fetchers. See
https://github.com/openembedded/bitbake/blob/master/lib/bb/fetch2/__init__.py#L1234-L1240.
Not sure why it didn't work for you, though. I'm guessing it has to do with the way it changes the current working directory before running the command, rather than directly altering the destination directory — if the command being run uses an absolute path, the current working directory wouldn't affect anything. *shrug*

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics