move logic for install-to-prefixdir and test-from-prefixdir from buildmaster config to misc/build_helpers #1275

Closed
opened 2010-12-01 07:07:05 +00:00 by zooko · 1 comment

Buildmaster config is a bad place to keep logic—almost nobody can see it except for a privileged few, and it tends to be ill-documented and ill-organized. Move the install-to-prefix step (below) and the test-from-prefix step (below) from buildmaster config into a script in the tahoe-lafs source tree. Also add a test to it that goes red if the install puts anything other than allmydata into the Python lib dir (currently the install puts buildtest into there, which is not intended and will be fixed as soon as we have a test of it).

install-to-prefix:

class InstallToPrefixDir(PythonCommand):
    """
    Step to install into a temporary install directory using --prefix.
    """

    flunkOnFailure = False
    description = ["install-to-prefix"]
    name = "install-to-prefix"

    def __init__(self, prefixinstalldir="prefixinstalldir", *args, **kwargs):
        python_command = ["-c", ("import subprocess, sys;"
                             "sys.exit(subprocess.call([sys.executable, 'setup.py', 'install', '--single-version-externally-managed', '--record=record.txt', '--prefix', '"+prefixinstalldir+"']))")]
        kwargs['python_command'] = python_command
        PythonCommand.__init__(self, *args, **kwargs)
        self.addFactoryArguments(prefixinstalldir=prefixinstalldir)

example: http://tahoe-lafs.org/buildbot/builders/Kyle%20OpenBSD%20amd64/builds/24/steps/install-to-prefix/logs/stdio

test-from-prefix:

class TestFromPrefixDir(PythonCommand):
    """
    Step to run the Tahoe-LAFS tests from a --prefix=installdir installation.
    """
    flunkOnFailure = True
    description = ["test-from-prefixdir"]
    name = "test-from-prefixdir"

    def __init__(self, testsuite=None, prefixinstalldir="prefixinstalldir", srcbasedir=".", *args, **kwargs):
        if testsuite:
            assert isinstance(testsuite, basestring)
            pcmd = (
                    "import copy,os,subprocess,sys;"
                    "trial=os.path.join(os.getcwd(), 'misc', 'build_helpers', 'run_trial.py');"
                    "os.chdir('"+srcbasedir+"');"
                    "testsuite='"+testsuite+"';"
                    "prefixinstdir=os.path.join(os.getcwd(), 'prefixinstalldir');"
                    "libdir=(('win32' in sys.platform.lower()) and os.path.join(os.getcwd(), 'prefixinstalldir', 'Lib', 'site-packages') or os.path.join(os.getcwd(), 'prefixinstalldir', 'lib', 'python%(ver)s' % {'ver': sys.version[:3]}, 'site-packages'));"
                    "bindir=('win32' in sys.platform.lower()) and 'Scripts' or 'bin';"
                    "env=copy.copy(os.environ);"
                    "env['PATH']=bindir+os.pathsep+env.get('PATH','');"
                    "env['PYTHONPATH']=libdir+os.pathsep+env.get('PYTHONPATH','');"
                    "os.chdir('prefixinstalldir');"
                    "sys.exit(subprocess.call([sys.executable, trial, '--reporter=bwverbose', '--rterror', testsuite], env=env))")
        else:
            pcmd = (
                    "import copy,os,subprocess,sys;"
                    "trial=os.path.join(os.getcwd(), 'misc', 'build_helpers', 'run_trial.py');"
                    "os.chdir('"+srcbasedir+"');"
                    "testsuite=subprocess.Popen([sys.executable, 'setup.py', '--name'], stdout=subprocess.PIPE).communicate()[0].strip()+'.test';"
                    "prefixinstdir=os.path.join(os.getcwd(), 'prefixinstalldir');"
                    "libdir=(('win32' in sys.platform.lower()) and os.path.join(os.getcwd(), 'prefixinstalldir', 'Lib', 'site-packages') or os.path.join(os.getcwd(), 'prefixinstalldir', 'lib', 'python%(ver)s' % {'ver': sys.version[:3]}, 'site-packages'));"
                    "bindir=('win32' in sys.platform.lower()) and 'Scripts' or 'bin';"
                    "env=copy.copy(os.environ);"
                    "env['PATH']=bindir+os.pathsep+env.get('PATH','');"
                    "env['PYTHONPATH']=libdir+os.pathsep+env.get('PYTHONPATH','');"
                    "os.chdir('prefixinstalldir');"
                    "sys.exit(subprocess.call([sys.executable, trial, '--reporter=bwverbose', '--rterror', testsuite], env=env))")
        python_command = ["-c", pcmd]
        logfiles = {"test.log": prefixinstalldir+"/_trial_temp/test.log"}
        kwargs['python_command'] = python_command
        kwargs['logfiles'] = logfiles
        PythonCommand.__init__(self, *args, **kwargs)
        self.addFactoryArguments(testsuite=testsuite, prefixinstalldir=prefixinstalldir, srcbasedir=srcbasedir)

example: http://tahoe-lafs.org/buildbot/builders/Kyle%20OpenBSD%20amd64/builds/24/steps/test-from-prefixdir/logs/stdio

(Note: we also need to copy the in-source-tree buildstep script into zfec and pycryptopp source trees.)

Buildmaster config is a bad place to keep logic—almost nobody can see it except for a privileged few, and it tends to be ill-documented and ill-organized. Move the install-to-prefix step (below) and the test-from-prefix step (below) from buildmaster config into a script in the tahoe-lafs source tree. Also add a test to it that goes red if the install puts anything other than `allmydata` into the Python lib dir (currently the install puts `buildtest` into there, which is not intended and will be fixed as soon as we have a test of it). install-to-prefix: ``` class InstallToPrefixDir(PythonCommand): """ Step to install into a temporary install directory using --prefix. """ flunkOnFailure = False description = ["install-to-prefix"] name = "install-to-prefix" def __init__(self, prefixinstalldir="prefixinstalldir", *args, **kwargs): python_command = ["-c", ("import subprocess, sys;" "sys.exit(subprocess.call([sys.executable, 'setup.py', 'install', '--single-version-externally-managed', '--record=record.txt', '--prefix', '"+prefixinstalldir+"']))")] kwargs['python_command'] = python_command PythonCommand.__init__(self, *args, **kwargs) self.addFactoryArguments(prefixinstalldir=prefixinstalldir) ``` example: <http://tahoe-lafs.org/buildbot/builders/Kyle%20OpenBSD%20amd64/builds/24/steps/install-to-prefix/logs/stdio> test-from-prefix: ``` class TestFromPrefixDir(PythonCommand): """ Step to run the Tahoe-LAFS tests from a --prefix=installdir installation. """ flunkOnFailure = True description = ["test-from-prefixdir"] name = "test-from-prefixdir" def __init__(self, testsuite=None, prefixinstalldir="prefixinstalldir", srcbasedir=".", *args, **kwargs): if testsuite: assert isinstance(testsuite, basestring) pcmd = ( "import copy,os,subprocess,sys;" "trial=os.path.join(os.getcwd(), 'misc', 'build_helpers', 'run_trial.py');" "os.chdir('"+srcbasedir+"');" "testsuite='"+testsuite+"';" "prefixinstdir=os.path.join(os.getcwd(), 'prefixinstalldir');" "libdir=(('win32' in sys.platform.lower()) and os.path.join(os.getcwd(), 'prefixinstalldir', 'Lib', 'site-packages') or os.path.join(os.getcwd(), 'prefixinstalldir', 'lib', 'python%(ver)s' % {'ver': sys.version[:3]}, 'site-packages'));" "bindir=('win32' in sys.platform.lower()) and 'Scripts' or 'bin';" "env=copy.copy(os.environ);" "env['PATH']=bindir+os.pathsep+env.get('PATH','');" "env['PYTHONPATH']=libdir+os.pathsep+env.get('PYTHONPATH','');" "os.chdir('prefixinstalldir');" "sys.exit(subprocess.call([sys.executable, trial, '--reporter=bwverbose', '--rterror', testsuite], env=env))") else: pcmd = ( "import copy,os,subprocess,sys;" "trial=os.path.join(os.getcwd(), 'misc', 'build_helpers', 'run_trial.py');" "os.chdir('"+srcbasedir+"');" "testsuite=subprocess.Popen([sys.executable, 'setup.py', '--name'], stdout=subprocess.PIPE).communicate()[0].strip()+'.test';" "prefixinstdir=os.path.join(os.getcwd(), 'prefixinstalldir');" "libdir=(('win32' in sys.platform.lower()) and os.path.join(os.getcwd(), 'prefixinstalldir', 'Lib', 'site-packages') or os.path.join(os.getcwd(), 'prefixinstalldir', 'lib', 'python%(ver)s' % {'ver': sys.version[:3]}, 'site-packages'));" "bindir=('win32' in sys.platform.lower()) and 'Scripts' or 'bin';" "env=copy.copy(os.environ);" "env['PATH']=bindir+os.pathsep+env.get('PATH','');" "env['PYTHONPATH']=libdir+os.pathsep+env.get('PYTHONPATH','');" "os.chdir('prefixinstalldir');" "sys.exit(subprocess.call([sys.executable, trial, '--reporter=bwverbose', '--rterror', testsuite], env=env))") python_command = ["-c", pcmd] logfiles = {"test.log": prefixinstalldir+"/_trial_temp/test.log"} kwargs['python_command'] = python_command kwargs['logfiles'] = logfiles PythonCommand.__init__(self, *args, **kwargs) self.addFactoryArguments(testsuite=testsuite, prefixinstalldir=prefixinstalldir, srcbasedir=srcbasedir) ``` example: <http://tahoe-lafs.org/buildbot/builders/Kyle%20OpenBSD%20amd64/builds/24/steps/test-from-prefixdir/logs/stdio> (Note: we also need to copy the in-source-tree buildstep script into zfec and pycryptopp source trees.)
zooko added the
dev-infrastructure
major
enhancement
1.8.0
labels 2010-12-01 07:07:05 +00:00
zooko added this to the undecided milestone 2010-12-01 07:07:05 +00:00
zooko self-assigned this 2010-12-01 07:07:05 +00:00
davidsarah commented 2010-12-01 19:51:13 +00:00
Owner

Duplicate of #1248 (I'll copy the description to that ticket).

Duplicate of #1248 (I'll copy the description to that ticket).
tahoe-lafs added the
duplicate
label 2010-12-01 19:51:13 +00:00
davidsarah closed this issue 2010-12-01 19:51:13 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1275
No description provided.