Buildbot master tweaks: use generic builder for scons win32, unpack fixes.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 22 Mar 2011 15:25:18 +0000 (15:25 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 22 Mar 2011 15:25:18 +0000 (15:25 +0000)
build_files/buildbot/master.cfg
build_files/buildbot/master_unpack.py
build_files/buildbot/slave_compile.py

index aee6f1175eb80bf5f459cf32db94f90ddbf30586..f6aa6390e8c0d8f494b73dc1c92a10ea7c2f9b05 100644 (file)
@@ -70,18 +70,7 @@ def svn_step():
 def lib_svn_step(dir):
     return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir)
 
-def scons_compile_step():
-    return Compile(command=['python', 'scons/scons.py'], workdir='blender')
-
-def scons_file_upload(f, id):
-    filename = 'buildbot_upload_' + id + '.zip'
-    unpack_script = 'master_unpack.py'
-
-    f.addStep(Compile(name='package', command=['python', 'scons/scons.py', 'BF_QUICK=slnt', 'buildslave'], description='packaging', descriptionDone='packaged', workdir='blender'))
-    f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100*1024*1024, workdir='install'))
-    f.addStep(MasterShellCommand(name='unpack', command=['python', unpack_script, filename], description='unpacking', descriptionDone='unpacked'))
-
-# generic
+# generic builder
 
 def generic_builder(id, libdir=''):
     filename = 'buildbot_upload_' + id + '.zip'
@@ -98,28 +87,21 @@ def generic_builder(id, libdir=''):
     f.addStep(Compile(command=['python', compile_script, id]))
     f.addStep(Test(command=['python', test_script, id]))
     f.addStep(ShellCommand(name='package', command=['python', pack_script, id], description='packaging', descriptionDone='packaged'))
-    f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100*1024*1024))
+    if id.find('cmake') != -1:
+        f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100*1024*1024))
+    else:
+        f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100*1024*1024, workdir='install'))
     f.addStep(MasterShellCommand(name='unpack', command=['python', unpack_script, filename], description='unpacking', descriptionDone='unpacked'))
     return f
 
+# builders
+
 add_builder(c, 'mac_x86_64_cmake', 'darwin-9.x.universal', generic_builder)
 add_builder(c, 'mac_i386_cmake', 'darwin-9.x.universal', generic_builder)
 add_builder(c, 'mac_ppc_cmake', 'darwin-9.x.universal', generic_builder)
 add_builder(c, 'linux_x86_64_cmake', '', generic_builder)
 add_builder(c, 'linux_x86_64_scons', '', generic_builder)
-
-# win32 scons
-
-# TODO: add scons test target
-def win32_scons(id, libdir):
-    f = BuildFactory()
-    f.addStep(svn_step())
-    f.addStep(lib_svn_step(libdir))
-    f.addStep(scons_compile_step())
-    scons_file_upload(f, id)
-    return f
-
-add_builder(c, 'win32_scons', 'windows', win32_scons)
+add_builder(c, 'win32_scons', 'windows', generic_builder)
 
 # SCHEDULERS
 #
index 2c2bc1898b255be6043d0b9bb71803176a15d15c..70c8b4c3b0b0a351f755c2ad347da7d9333bce43 100644 (file)
@@ -26,59 +26,59 @@ import zipfile
 
 # extension stripping
 def strip_extension(filename):
-       extensions = ['.zip', '.tar', '.bz2', '.gz', '.tgz', '.tbz', '.exe']
+    extensions = ['.zip', '.tar', '.bz2', '.gz', '.tgz', '.tbz', '.exe']
 
-       for ext in extensions:
-               if filename.endswith(ext):
-                       filename = filename[:-len(ext)]
+    for ext in extensions:
+        if filename.endswith(ext):
+            filename = filename[:-len(ext)]
 
-       return filename
+    return filename
 
 # extract platform from package name
 def get_platform(filename):
-       # name is blender-version-platform.extension. we want to get the
-       # platform out, but there may be some variations, so we fiddle a
-       # bit to handle current and hopefully future names
-       filename = strip_extension(filename)
-       filename = strip_extension(filename)
+    # name is blender-version-platform.extension. we want to get the
+    # platform out, but there may be some variations, so we fiddle a
+    # bit to handle current and hopefully future names
+    filename = strip_extension(filename)
+    filename = strip_extension(filename)
 
-       tokens = filename.split("-")
-       platforms = ['osx', 'mac', 'bsd', 'win', 'linux', 'source', 'irix', 'solaris']
-       platform_tokens = []
-       found = False
+    tokens = filename.split("-")
+    platforms = ['osx', 'mac', 'bsd', 'win', 'linux', 'source', 'irix', 'solaris']
+    platform_tokens = []
+    found = False
 
-       for i, token in enumerate(tokens):
-               if not found:
-                       for platform in platforms:
-                               if token.lower().find(platform) != -1:
-                                       found = True
+    for i, token in enumerate(tokens):
+        if not found:
+            for platform in platforms:
+                if token.lower().find(platform) != -1:
+                    found = True
 
-               if found:
-                       platform_tokens += [token]
+        if found:
+            platform_tokens += [token]
 
-       return '-'.join(platform_tokens)
+    return '-'.join(platform_tokens)
 
 # get filename
 if len(sys.argv) < 2:
-       sys.stderr.write("Not enough arguments, expecting file to unpack\n")
-       sys.exit(1)
+    sys.stderr.write("Not enough arguments, expecting file to unpack\n")
+    sys.exit(1)
 
 filename = sys.argv[1]
 
 # open zip file
 if not os.path.exists(filename):
-       sys.stderr.write("File " + filename + " not found.\n")
-       sys.exit(1)
+    sys.stderr.write("File " + filename + " not found.\n")
+    sys.exit(1)
 
 try:
-       z = zipfile.ZipFile(filename, "r")
+    z = zipfile.ZipFile(filename, "r")
 except Exception, ex:
-       sys.stderr.write('Failed to open zip file: ' + str(ex) + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to open zip file: ' + str(ex) + '\n')
+    sys.exit(1)
 
 if len(z.namelist()) != 1:
-       sys.stderr.write("Expected on file in " + filename + ".")
-       sys.exit(1)
+    sys.stderr.write("Expected on file in " + filename + ".")
+    sys.exit(1)
 
 package = z.namelist()[0]
 packagename = os.path.basename(package)
@@ -87,31 +87,33 @@ packagename = os.path.basename(package)
 platform = get_platform(packagename)
 
 if platform == '':
-       sys.stderr.write('Failed to detect platform from package: ' + packagename + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to detect platform from package: ' + packagename + '\n')
+    sys.exit(1)
 
 # extract
 dir = 'public_html/download'
 
 try:
-       zf = z.open(package)
-       f = file(os.path.join(dir, packagename), "wb")
+    zf = z.open(package)
+    f = file(os.path.join(dir, packagename), "wb")
 
-       shutil.copyfileobj(zf, f)
+    shutil.copyfileobj(zf, f)
 
-       zf.close()
-       z.close()
+    zf.close()
+    z.close()
+    
+    os.remove(filename)
 except Exception, ex:
-       sys.stderr.write('Failed to unzip package: ' + str(ex) + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to unzip package: ' + str(ex) + '\n')
+    sys.exit(1)
 
 # remove other files from the same platform
 try:
-       for f in os.listdir(dir):
-               if f.lower().find(platform.lower()) != -1:
-                       if f != packagename:
-                               os.remove(os.path.join(dir, f))
+    for f in os.listdir(dir):
+        if f.lower().find(platform.lower()) != -1:
+            if f != packagename:
+                os.remove(os.path.join(dir, f))
 except Exception, ex:
-       sys.stderr.write('Failed to remove old packages: ' + str(ex) + '\n')
-       sys.exit(1)
+    sys.stderr.write('Failed to remove old packages: ' + str(ex) + '\n')
+    sys.exit(1)
 
index 4892865bceabe19d461c36aa3630a0252d0aec45..708c2951272606054b000dc2d819fe433810bc26 100644 (file)
@@ -52,7 +52,8 @@ if builder.find('cmake') != -1:
 else:
     # scons
     os.chdir(blender_dir)
+    scons_options = []
 
-    retcode = subprocess.call(['python', 'scons/scons.py'])
+    retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
     sys.exit(retcode)