import glob
import tarfile
import subprocess
+import shutil
def next_build_number():
try:
return expired
-def get_configuration(debug):
- configuration = 'Windows Vista'
+def get_configuration(release, debug):
+ configuration = release
if debug:
configuration += ' Debug'
return configuration
-def get_configuration_name(debug):
- configuration = 'WindowsVista'
-
- if debug:
- configuration += 'Debug'
- else:
- configuration += 'Release'
-
- return configuration
-
-def get_target_path(arch, debug):
- configuration = get_configuration_name(debug)
-
- target = { 'x86': os.sep.join([configuration, 'Win32']), 'x64': os.sep.join([configuration, 'x64']) }
+def get_target_path(release, arch, debug):
+ configuration = get_configuration(release, debug)
+ name = ''.join(configuration.split(' '))
+ target = { 'x86': os.sep.join([name, 'Win32']), 'x64': os.sep.join([name, 'x64']) }
target_path = os.sep.join(['proj', target[arch]])
return target_path
def __str__(self):
return repr(self.value)
-def msbuild(name, arch, debug):
- cwd = os.getcwd()
- configuration = get_configuration(debug)
+def msbuild(platform, configuration, target, file, args, dir):
+ os.environ['PLATFORM'] = platform
+ os.environ['CONFIGURATION'] = configuration
+ os.environ['TARGET'] = target
+ os.environ['FILE'] = file
+ os.environ['EXTRA'] = args
- if arch == 'x86':
- os.environ['PLATFORM'] = 'Win32'
- elif arch == 'x64':
- os.environ['PLATFORM'] = 'x64'
+ cwd = os.getcwd()
+ bin = os.path.join(cwd, 'msbuild.bat')
- os.environ['CONFIGURATION'] = configuration
- os.environ['TARGET'] = 'Build'
- os.environ['BUILD_ARGS'] = ''
- os.environ['BUILD_FILE'] = name + '.sln'
+ print(bin)
+ print(dir)
- os.chdir('proj')
- status = shell('msbuild.bat')
+ os.chdir(dir)
+ status = shell(bin)
os.chdir(cwd)
if (status != None):
raise msbuild_failure(configuration)
+def build_sln(name, release, arch, debug):
+ configuration = get_configuration(release, debug)
+
+ if arch == 'x86':
+ platform = 'Win32'
+ elif arch == 'x64':
+ platform = 'x64'
+
+ cwd = os.getcwd()
+
+ msbuild(platform, configuration, 'Build', name + '.sln', '', 'proj')
+
+def remove_timestamps(path):
+ try:
+ os.unlink(path + '.orig')
+ except OSError:
+ pass
+
+ os.rename(path, path + '.orig')
+
+ src = open(path + '.orig', 'r')
+ dst = open(path, 'w')
+
+ for line in src:
+ if line.find('TimeStamp') == -1:
+ dst.write(line)
+
+ dst.close()
+ src.close()
+
+def run_sdv(name, dir):
+ configuration = get_configuration('Windows 8', False)
+ platform = 'x64'
+
+ msbuild(platform, configuration, 'Build', name + '.vcxproj',
+ '', os.path.join('proj', name))
+ msbuild(platform, configuration, 'sdv', name + '.vcxproj',
+ '/p:Inputs="/clean"', os.path.join('proj', name))
+ msbuild(platform, configuration, 'sdv', name + '.vcxproj',
+ '/p:Inputs="/check:default.sdv"', os.path.join('proj', name))
+
+ path = ['proj', name, 'sdv', 'SDV.DVL.xml']
+ remove_timestamps(os.path.join(*path))
+
+ msbuild(platform, configuration, 'dvl', name + '.vcxproj',
+ '', os.path.join('proj', name))
+
+ path = ['proj', name, name + '.DVL.XML']
+ shutil.copy(os.path.join(*path), dir)
def symstore_del(name, age):
symstore_path = [os.environ['KIT'], 'Debuggers']
shell(' '.join(command))
-def symstore_add(name, arch, debug):
+def symstore_add(name, release, arch, debug):
cwd = os.getcwd()
- configuration = get_configuration_name(debug)
- target_path = get_target_path(arch, debug)
+ target_path = get_target_path(release, arch, debug)
symstore_path = [os.environ['KIT'], 'Debuggers']
if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
symstore_del(driver, 30)
- msbuild(driver, 'x86', debug[sys.argv[1]])
- msbuild(driver, 'x64', debug[sys.argv[1]])
+ release = 'Windows Vista'
+
+ build_sln(driver, release, 'x86', debug[sys.argv[1]])
+ build_sln(driver, release, 'x64', debug[sys.argv[1]])
+
+ symstore_add(driver, release, 'x86', debug[sys.argv[1]])
+ symstore_add(driver, release, 'x64', debug[sys.argv[1]])
- symstore_add(driver, 'x86', debug[sys.argv[1]])
- symstore_add(driver, 'x64', debug[sys.argv[1]])
+ if len(sys.argv) <= 2 or sys.argv[2] != 'nosdv':
+ run_sdv(driver, driver)
listfile = callfnout(['git','ls-tree', '-r', '--name-only', 'HEAD'])
archive(driver + '\\source.tgz', listfile.splitlines(), tgz=True)
+++ /dev/null
-#!python -u
-
-import os, sys
-import datetime
-import re
-import glob
-import tarfile
-import subprocess
-
-def shell(command):
- print(command)
- sys.stdout.flush()
-
- pipe = os.popen(command, 'r', 1)
-
- for line in pipe:
- print(line.rstrip())
-
- return pipe.close()
-
-class msbuild_failure(Exception):
- def __init__(self, value):
- self.value = value
- def __str__(self):
- return repr(self.value)
-
-def msbuild(name, target, sdv_arg):
- cwd = os.getcwd()
-
- os.environ['CONFIGURATION'] = 'Windows 8 Release'
- os.environ['PLATFORM'] = 'x64'
- os.environ['TARGET'] = target
- os.environ['BUILD_FILE'] = name + '.vcxproj'
- os.environ['BUILD_ARGS'] = sdv_arg
-
- os.chdir('proj')
- os.chdir(name)
- status = shell('..\\msbuild.bat')
- os.chdir(cwd)
-
-# if (status != None):
-# raise msbuild_failure(sdv_arg)
-
-def archive(filename, files, tgz=False):
- access='w'
- if tgz:
- access='w:gz'
- tar = tarfile.open(filename, access)
- for name in files :
- try:
- print('adding '+name)
- tar.add(name)
- except:
- pass
- tar.close()
-
-if __name__ == '__main__':
- msbuild('xennet', 'sdv', '/p:Inputs="/clean"')
- msbuild('xennet', 'sdv', '/p:Inputs="/check:default.sdv"')
- msbuild('xennet', 'dvl', '')