[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH xenvkbd] Remove the old python build scripts and document use of the EWDK


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • Date: Thu, 19 Sep 2019 14:44:43 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@xxxxxxxxxx; spf=Pass smtp.mailfrom=Paul.Durrant@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • Delivery-date: Thu, 19 Sep 2019 13:45:02 +0000
  • Ironport-sdr: /OrVabOo9q9o0SC/5K1pBxVkyGQj0YHHyvGwVxmhIu/W0n2EvKxrvxYjaT0zrYqfPHz6hbRwKQ 2TpJDVgfPf+gVswChTG2yTEdG9C+1bD75DS4wJ1NOsd3pQWhK6HWn+gCTMk5PCbBIlID1z51bj RTfcObRWY0nepKING92FecDXqyPi1qmFzPC/AJwh4K3DuX8Pid4ibz6MLoUwSbSYaAFsU/BsYb abgVfIm14LFla3Suy6covDeVaQHnKbq+n3pTCmIGhP3bqgWM5rGvhqA8xfJFBrZ8DKp8V2uBc8 Yno=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 BUILD.md    |  67 ++++--------
 build.py    | 340 ------------------------------------------------------------
 clean.py    |  21 ----
 kdfiles.py  |  26 -----
 msbuild.bat |  10 --
 5 files changed, 19 insertions(+), 445 deletions(-)
 delete mode 100644 build.py
 delete mode 100644 clean.py
 delete mode 100644 kdfiles.py
 delete mode 100755 msbuild.bat

diff --git a/BUILD.md b/BUILD.md
index 0c68b20..8edd202 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -1,59 +1,30 @@
 Building the XenVkbd Package
 ============================
 
-First you'll need a device driver build environment for Windows 8, Windows
-8.1, or Windows 10.
-For Windows 8 this means:
+First you'll need a device driver build environment for Windows 10. Happily
+Microsoft has made this easy with the introduction of the 'EWDK'. This is an
+ISO containing all the build environment you need.
 
-*   Visual Studio 2012 (Professional or Ultimate)
-*   Windows Driver Kit 8
+The package should support building with the following EWDKs:
 
-For Windows 8.1 this means:
+- EWDK for Windows 10, version 1809 with Visual Studio Build Tools 15.8.9
 
-*   Visual Studio 2013 (Any SKU, including Express)
-*   Windows Driver Kit 8.1
+Once you have downloaded the ISO, open it and you should see a file called:
 
-For Windows 10 this means:
+LaunchBuildEnv.cmd
 
-*   Visual Studio 2015 (Any SKU, including Express or Community)
-*   Windows Driver Kit 10
+Run this and it should give you a build environment command prompt. From
+within this shell navigate to the root of your checked out repository
+and run:
 
-(See http://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx). You
-may find it useful to install VirtualCloneDrive from http://www.slysoft.com
-as Visual Studio is generally supplied in ISO form.
+powershell ./build.ps1
 
-Install Visual Studio first (you only need install MFC for C++) and then
-the WDK. Set an environment variable called VS to the base of the Visual
-Studio Installation (e.g. C:\Program Files\Microsoft Visual Studio 12.0) and
-a variable called KIT to the base of the WDK
-(e.g. C:\Program Files\Windows Kits\8.1). Also set an environment variable
-called SYMBOL\_SERVER to point at a location where driver symbols can be
-stored. This can be local directory e.g. C:\Symbols.
+This will then prompt you for whether you want a 'free' (non-debug) or a
+'checked' (debug) build and then proceed to build all x86 and x64 drivers.
 
-NOTE: If you are using WDK 10 then you will need to acquire the DIFx
-      re-distributable package from one of the other WDKs, so that the
-      driver build can copy dpinst.exe into the output.
-      Set the environment variable DPINST_REDIST to the base dpinst
-      directory (i.e. the directory under which the x86 and x64 sub-
-      directories containing dpinst.exe can be found).
-
-Next you'll need a 3.x version of python (which you can get from
-http://www.python.org). Make sure python.exe is somewhere on your default
-path.
-
-Now fire up a Command Prompt and navigate to the base of your git repository.
-At the prompt type:
-
-    build.py checked
-
-This will create a debug build of the driver. To create a non-debug build
-type:
-
-    build.py free
-
-Note that Static Driver Verifier is run by default as part of the build
-process. This can be very time consuming. If you don't want to run the
-verifier then you can add the 'nosdv' keyword to the end of your command
-e.g.:
-
-    build.py free nosdv
+NOTE: Because the EWDKs do not contain the 'dpinst' re-distributable driver
+installer utility, this will not be included in the built driver package
+by default. However, if you set the environment variable DPINST_REDIST to
+point to a directory with x86 and x64 sub-directories containing 32- and
+64-bit dpinst.exe binaries (respectively) then these will be copied into
+the built packages, making installation more convenient.
diff --git a/build.py b/build.py
deleted file mode 100644
index 1033b6c..0000000
--- a/build.py
+++ /dev/null
@@ -1,340 +0,0 @@
-#!python -u
-
-import os, sys
-import datetime
-import re
-import glob
-import tarfile
-import subprocess
-import shutil
-import time
-
-def next_build_number():
-    try:
-        file = open('.build_number', 'r')
-        build_number = file.read()
-        file.close()
-    except IOError:
-        build_number = '0'
-
-    file = open('.build_number', 'w')
-    file.write(str(int(build_number) + 1))
-    file.close()
-
-    return build_number
-
-def get_expired_symbols(name, age = 30):
-    path = os.path.join(os.environ['SYMBOL_SERVER'], '000Admin\\history.txt')
-
-    try:
-        file = open(path, 'r')
-    except IOError:
-        return []
-
-    threshold = datetime.datetime.utcnow() - datetime.timedelta(days = age)
-
-    expired = []
-
-    for line in file:
-        item = line.split(',')
-
-        if (re.match('add', item[1])):
-            id = item[0]
-            date = item[3].split('/')
-            time = item[4].split(':')
-            tag = item[5].strip('"')
-
-            age = datetime.datetime(year = int(date[2]),
-                                    month = int(date[0]),
-                                    day = int(date[1]),
-                                    hour = int(time[0]),
-                                    minute = int(time[1]),
-                                    second = int(time[2]))
-            if (tag == name and age < threshold):
-                expired.append(id)
-
-        elif (re.match('del', item[1])):
-            id = item[2].rstrip()
-            try:
-                expired.remove(id)
-            except ValueError:
-                pass
-
-    file.close()
-
-    return expired
-
-
-def get_configuration(release, debug):
-    configuration = release
-
-    if debug:
-        configuration += ' Debug'
-    else:
-        configuration += ' Release'
-
-    return configuration
-
-
-def get_target_path(release, arch, debug, vs):
-    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([vs, target[arch]])
-
-    return target_path
-
-
-def shell(command, dir):
-    print(dir)
-    print(command)
-    sys.stdout.flush()
-
-    sub = subprocess.Popen(' '.join(command), cwd=dir,
-                           stdout=subprocess.PIPE,
-                           stderr=subprocess.STDOUT)
-
-    for line in sub.stdout:
-        print(line.decode(sys.getdefaultencoding()).rstrip())
-
-    sub.wait()
-
-    return sub.returncode
-
-
-def find(name, path):
-    for root, dirs, files in os.walk(path):
-        if name in files:
-            return os.path.join(root, name)
-
-
-class msbuild_failure(Exception):
-    def __init__(self, value):
-        self.value = value
-    def __str__(self):
-        return repr(self.value)
-
-
-def msbuild(platform, configuration, target, file, args, dir):
-    vcvarsall = find('vcvarsall.bat', os.environ['VS'])
-
-    os.environ['MSBUILD_PLATFORM'] = platform
-    os.environ['MSBUILD_CONFIGURATION'] = configuration
-    os.environ['MSBUILD_TARGET'] = target
-    os.environ['MSBUILD_FILE'] = file
-    os.environ['MSBUILD_EXTRA'] = args
-    os.environ['MSBUILD_VCVARSALL'] = vcvarsall
-
-    bin = os.path.join(os.getcwd(), 'msbuild.bat')
-
-    status = shell([bin], dir)
-
-    if (status != 0):
-        raise msbuild_failure(configuration)
-
-
-def build_sln(name, release, arch, debug, vs):
-    configuration = get_configuration(release, debug)
-
-    if arch == 'x86':
-        platform = 'Win32'
-    elif arch == 'x64':
-        platform = 'x64'
-
-    msbuild(platform, configuration, 'Build', name + '.sln', '', vs)
-
-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, vs):
-    release = { 'vs2015':'Windows 10',
-                'vs2017':'Windows 10' }
-
-    configuration = get_configuration(release[vs], False)
-    platform = 'x64'
-
-    msbuild(platform, configuration, 'Build', name + '.vcxproj',
-            '', os.path.join(vs, name))
-
-    msbuild(platform, configuration, 'sdv', name + '.vcxproj',
-            '/p:Inputs="/clean"', os.path.join(vs, name))
-
-    msbuild(platform, configuration, 'sdv', name + '.vcxproj',
-            '/p:Inputs="/check:default.sdv /debug"', os.path.join(vs, name))
-
-    path = [vs, name, 'sdv', 'SDV.DVL.xml']
-    remove_timestamps(os.path.join(*path))
-
-    msbuild(platform, configuration, 'dvl', name + '.vcxproj',
-            '', os.path.join(vs, name))
-
-    path = [vs, name, name + '.DVL.XML']
-    shutil.copy(os.path.join(*path), dir)
-
-    path = [vs, name, 'refine.sdv']
-    if os.path.isfile(os.path.join(*path)):
-        msbuild(platform, configuration, 'sdv', name + '.vcxproj',
-                '/p:Inputs=/refine', os.path.join(vs, name))
-
-
-def symstore_del(name, age):
-    symstore_path = [os.environ['KIT'], 'Debuggers']
-    if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
-        symstore_path.append('x86')
-    else:
-        symstore_path.append('x64')
-    symstore_path.append('symstore.exe')
-
-    symstore = os.path.join(*symstore_path)
-
-    for id in get_expired_symbols(name, age):
-        command=['"' + symstore + '"']
-        command.append('del')
-        command.append('/i')
-        command.append(str(id))
-        command.append('/s')
-        command.append(os.environ['SYMBOL_SERVER'])
-
-        shell(command, None)
-
-
-def symstore_add(name, release, arch, debug, vs):
-    target_path = get_target_path(release, arch, debug, vs)
-
-    symstore_path = [os.environ['KIT'], 'Debuggers']
-    if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
-        symstore_path.append('x86')
-    else:
-        symstore_path.append('x64')
-    symstore_path.append('symstore.exe')
-
-    symstore = os.path.join(*symstore_path)
-
-    version = '.'.join([os.environ['MAJOR_VERSION'],
-                        os.environ['MINOR_VERSION'],
-                        os.environ['MICRO_VERSION'],
-                        os.environ['BUILD_NUMBER']])
-
-    command=['"' + symstore + '"']
-    command.append('add')
-    command.append('/s')
-    command.append(os.environ['SYMBOL_SERVER'])
-    command.append('/r')
-    command.append('/f')
-    command.append('*.pdb')
-    command.append('/t')
-    command.append(name)
-    command.append('/v')
-    command.append(version)
-
-    shell(command, target_path)
-
-
-def manifest():
-    cmd = ['git', 'ls-tree', '-r', '--name-only', 'HEAD']
-
-    sub = subprocess.Popen(cmd, stdout=subprocess.PIPE)
-    output = sub.communicate()[0]
-    ret = sub.returncode
-
-    if ret != 0:
-        raise(Exception("Error %d in : %s" % (ret, cmd)))
-
-    return output.decode('utf-8')
-
-
-def archive(filename, files, tgz=False):
-    access='w'
-    if tgz:
-        access='w:gz'
-    tar = tarfile.open(filename, access)
-    for name in files :
-        try:
-            tar.add(name)
-        except:
-            pass
-    tar.close()
-
-
-def getVsVersion():
-    vsenv = {}
-    vcvarsall= find('vcvarsall.bat', os.environ['VS'])
-
-    vars = subprocess.check_output([vcvarsall, 'x86_amd64', '&&', 'set'], 
shell=True)
-
-    for var in vars.splitlines():
-        k, _, v = map(str.strip, var.strip().decode('utf-8').partition('='))
-        if k.startswith('?'):
-            continue
-        vsenv[k] = v
-
-    mapping = { '14.0':'vs2015',
-                '15.0':'vs2017'}
-
-    return mapping[vsenv['VisualStudioVersion']]
-
-
-def main():
-    debug = { 'checked': True, 'free': False }
-    sdv = { 'nosdv': False, None: True }
-    driver = 'xenvkbd'
-    vs = getVsVersion()
-
-    if 'VENDOR_NAME' not in os.environ.keys():
-        os.environ['VENDOR_NAME'] = 'Xen Project'
-
-    if 'VENDOR_PREFIX' not in os.environ.keys():
-        os.environ['VENDOR_PREFIX'] = 'XP'
-
-    if 'PRODUCT_NAME' not in os.environ.keys():
-        os.environ['PRODUCT_NAME'] = 'Xen'
-
-    os.environ['MAJOR_VERSION'] = '9'
-    os.environ['MINOR_VERSION'] = '0'
-    os.environ['MICRO_VERSION'] = '0'
-
-    if 'BUILD_NUMBER' not in os.environ.keys():
-        os.environ['BUILD_NUMBER'] = next_build_number()
-
-    if 'GIT_REVISION' in os.environ.keys():
-        revision = open('revision', 'w')
-        print(os.environ['GIT_REVISION'], file=revision)
-        revision.close()
-
-    symstore_del(driver, 30)
-
-    release = { 'vs2015':'Windows 8',
-                'vs2017':'Windows 8' }
-
-    shutil.rmtree(driver, ignore_errors=True)
-
-    build_sln(driver, release[vs], 'x86', debug[sys.argv[1]], vs)
-
-    build_sln(driver, release[vs], 'x64', debug[sys.argv[1]], vs)
-
-    symstore_add(driver, release[vs], 'x86', debug[sys.argv[1]], vs)
-    symstore_add(driver, release[vs], 'x64', debug[sys.argv[1]], vs)
-
-    if len(sys.argv) <= 2 or sdv[sys.argv[2]]:
-        run_sdv('xenvkbd', driver, vs)
-
-    archive(driver + '\\source.tgz', manifest().splitlines(), tgz=True)
-    archive(driver + '.tar', [driver,'revision'])
-
-if __name__ == '__main__':
-    main()
diff --git a/clean.py b/clean.py
deleted file mode 100644
index 88d6ed6..0000000
--- a/clean.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-
-import os, sys, shutil
-
-if __name__ == '__main__':
-    file = os.popen('git status -u --porcelain')
-
-    for line in file:
-        item = line.split(' ')
-        if item[0] == '??':
-            path = ' '.join(item[1:]).rstrip()
-            print(path)
-            try:
-                if os.path.isfile(path):
-                    os.remove(path)
-                if os.path.isdir(path):
-                    shutil.rmtree(path)
-            except OSError:
-                None
-                
-    file.close()
diff --git a/kdfiles.py b/kdfiles.py
deleted file mode 100644
index 4a9e231..0000000
--- a/kdfiles.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!python -u
-
-import os, sys
-import subprocess
-import glob
-from pprint import pprint
-
-def regenerate_kdfiles(filename, arch, pkg, source):
-       cwd = os.getcwd()
-       file = open(filename, 'w')
-       os.chdir(pkg + '/' + arch)
-       drivers = glob.glob('*.sys')
-       pprint(drivers)
-       for driver in drivers:
-               file.write("map\n")
-               file.write('\SystemRoot\System32\drivers\\' + driver + '\n')
-               file.write(source + '\\' + pkg + '\\' + arch + '\\' + driver + 
'\n')
-               file.write('\n')
-       os.chdir(cwd)
-       file.close()
-
-if __name__ == '__main__':
-       pkg = 'xenvkbd'
-       source = os.getcwd()
-       regenerate_kdfiles('kdfiles32.txt', 'x86', pkg, source)
-       regenerate_kdfiles('kdfiles64.txt', 'x64', pkg, source)
diff --git a/msbuild.bat b/msbuild.bat
deleted file mode 100755
index a28f939..0000000
--- a/msbuild.bat
+++ /dev/null
@@ -1,10 +0,0 @@
-set MSBUILD_ROOT=%cd%
-call "%MSBUILD_VCVARSALL%" x86_amd64
-@echo on
-cd "%MSBUILD_ROOT%"
-msbuild.exe /m:1 /p:Configuration="%MSBUILD_CONFIGURATION%" 
/p:Platform="%MSBUILD_PLATFORM%" /t:"%MSBUILD_TARGET%" %MSBUILD_EXTRA% 
%MSBUILD_FILE%
-if errorlevel 1 goto error
-exit 0
-
-:error
-exit 1
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.