MikeyB
MikeyB

Reputation: 3350

Using distutils to install INTO a chroot'ed environment

I maintain a chrooted Linux image and I have a package that I'd like to install into that chrooted image.

Both packages end up getting installed into both locations; I can't figure out what is going on and how to fix it.

My setup.py:

import os
from distutils.core import setup

setup(name='ServerLibrary',
    version='1.1',
    description='Server Framework',
    author='Michael Brown',
    scripts = [ 'foo.py' ],
    packages = [ 'ServerLibrary' ],
)

os.chroot('/srv/nfs/chrooted-nfs-client/')
setup(name='ClientLibrary',
    version='1.1',
    description='Client Framework',
    author='Michael Brown',
    packages = [ 'ClientLibrary' ],
)

What's the best way to accomplish what I'm trying to do?

Upvotes: 2

Views: 924

Answers (1)

MikeyB
MikeyB

Reputation: 3350

I figured out that I needed to specify a different build directory for set of files. distutils was assuming that everything inside 'build' needed to get installed each time.

Hopefully I'll save someone else the trouble of figuring out how to do this. Here's my fixed 2nd part of the script:

os.chroot('/srv/nfs/chrooted-nfs-client/')
setup(name='ClientLibrary',
    version='1.1',
    description='Client Framework',
    author='Michael Brown',
    packages = [ 'ClientLibrary' ],
    options = {
        'build': { 'build_base': 'build-chroot' }
    }
)

Upvotes: 1

Related Questions