зеркало из https://github.com/microsoft/pbuild.git
Validate the subproject name when --subproject is specified
Also removed sourceDirectory from project list (not needed)
This commit is contained in:
Родитель
8e07084ec0
Коммит
fbab629e65
|
@ -194,12 +194,6 @@ class BuildHost(threading.Thread):
|
|||
# Change into the user directory for build purposes (it better exist by now!)
|
||||
queue.append('cd %s || exit $?' % self.path)
|
||||
|
||||
# Verify that the clone operation gave us bits where we expect them to be
|
||||
queue.append('if [ ! -d %s ]; then' % self.projectDefs.GetSourceDirectory())
|
||||
queue.append(' echo "Error: \'%s\' subdirectory does not exist!"' % self.projectDefs.GetBuildDirectory())
|
||||
queue.append(' exit -1')
|
||||
queue.append('fi')
|
||||
|
||||
# We only need to clean up the repo if we didn't just clone it ...
|
||||
queue.append('if [ $DID_WE_CLONE -eq 0 ]; then')
|
||||
self.BuildQueueCleanup(queue)
|
||||
|
|
38
config.py
38
config.py
|
@ -540,6 +540,44 @@ class Configuration:
|
|||
if key in self.machineKeys and fAllHosts:
|
||||
self.machineKeys.remove(key)
|
||||
|
||||
# Verify if the subproject list is sensical for selected hosts
|
||||
# We validate based on the machines, we're actually building with
|
||||
# (either the ones specified at launch, or all of the machines in configuraiton)
|
||||
#
|
||||
# Note that we can only validate the subproject name, not the branch.
|
||||
# That is, a subproject looks like: "<dir>:<branch>". We are validating
|
||||
# the <dir>. To validate the <branch>, we would need to integrate with
|
||||
# GitHub API, and that doesn't seem worth it right now.
|
||||
|
||||
if self.options.subproject:
|
||||
# Get the list of machnines we're actually going to build with
|
||||
machineList = [ ]
|
||||
if len(self.machineKeys):
|
||||
for entry in sorted(self.machineKeys):
|
||||
machineList.append(entry)
|
||||
else:
|
||||
for key in sorted(self.machines.keys()):
|
||||
machineList.append(key)
|
||||
|
||||
# We're probably building just one project, but in case we are not,
|
||||
# validate the subproject list with every machine we're building.
|
||||
|
||||
for entry in machineList:
|
||||
projectName = self.machines[entry].GetProject()
|
||||
factory = ProjectFactory(projectName)
|
||||
assert factory.Validate()
|
||||
project = factory.Create()
|
||||
|
||||
subprojectList = self.options.subproject.split(',')
|
||||
for subproject in subprojectList:
|
||||
# Subproject spec looks like: <dir>:<branch>
|
||||
subprojectElements = subproject.split(':')
|
||||
|
||||
if not project.ValidateSubproject(subprojectElements[0]):
|
||||
sys.stderr.write('Invalid subproject \'%s\' for project \'%s\'\n'
|
||||
% (subprojectElements[0], projectName) )
|
||||
sys.exit(-1)
|
||||
|
||||
# Okay, we're done. State of the world:
|
||||
#
|
||||
# If self.machineKeys is empty, then all machines should be processed
|
||||
|
|
32
project.py
32
project.py
|
@ -51,10 +51,9 @@ class Project:
|
|||
def __init__(self):
|
||||
self.buildDirectory = ""
|
||||
self.cloneSource = ""
|
||||
self.dependentProjects = [ ]
|
||||
self.subProjects = []
|
||||
self.makeDependencies = False
|
||||
self.projectName = ""
|
||||
self.sourceDirectory = ""
|
||||
self.targets = []
|
||||
|
||||
##
|
||||
|
@ -75,6 +74,15 @@ class Project:
|
|||
def GetCloneSource(self):
|
||||
return self.cloneSource
|
||||
|
||||
##
|
||||
# Is the subproject (passed in) valid for this project?
|
||||
#
|
||||
def ValidateSubproject(self, sub):
|
||||
if sub.lower() in self.subProjects:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
##
|
||||
# Does the project require a separate 'make depend' step?
|
||||
#
|
||||
|
@ -87,14 +95,6 @@ class Project:
|
|||
def GetProjectName(self):
|
||||
return self.projectName.lower()
|
||||
|
||||
##
|
||||
# Directory where sources are stored. This is only used to verify if we
|
||||
# must initially fetch all files from source control, and can be any
|
||||
# directory under source control for the project.
|
||||
#
|
||||
def GetSourceDirectory(self):
|
||||
return self.sourceDirectory
|
||||
|
||||
##
|
||||
# Get the default list of targets to build (make <targets>)
|
||||
#
|
||||
|
@ -111,9 +111,9 @@ class ProjectApache(Project):
|
|||
def __init__(self):
|
||||
self.buildDirectory = "apache/build"
|
||||
self.cloneSource = "git@github.com:Microsoft/Build-Apache-Provider.git"
|
||||
self.subProjects = ["apache", "omi", "pal"]
|
||||
self.makeDependencies = False
|
||||
self.projectName = "apache"
|
||||
self.sourceDirectory = "apache/source"
|
||||
self.targets = "all test"
|
||||
|
||||
class ProjectMySQL(Project):
|
||||
|
@ -122,9 +122,9 @@ class ProjectMySQL(Project):
|
|||
def __init__(self):
|
||||
self.buildDirectory = "mysql/build"
|
||||
self.cloneSource = "git@github.com:Microsoft/Build-MySQL-Provider.git"
|
||||
self.subProjects = ["mysql", "omi", "pal"]
|
||||
self.makeDependencies = False
|
||||
self.projectName = "mysql"
|
||||
self.sourceDirectory = "mysql/source"
|
||||
self.targets = "all test"
|
||||
|
||||
class ProjectOM(Project):
|
||||
|
@ -133,9 +133,9 @@ class ProjectOM(Project):
|
|||
def __init__(self):
|
||||
self.buildDirectory = "opsmgr/build"
|
||||
self.cloneSource = "git@github.com:Microsoft/Build-SCXcore.git"
|
||||
self.subProjects = ["omi", "opsmgr", "pal"]
|
||||
self.makeDependencies = False
|
||||
self.projectName = "om"
|
||||
self.sourceDirectory = "opsmgr/source"
|
||||
self.targets = "all test"
|
||||
|
||||
class ProjectOMI(Project):
|
||||
|
@ -144,9 +144,9 @@ class ProjectOMI(Project):
|
|||
def __init__(self):
|
||||
self.buildDirectory = "Unix"
|
||||
self.cloneSource = "git@github.com:Microsoft/omi.git"
|
||||
self.subProjects = [ ]
|
||||
self.makeDependencies = False
|
||||
self.projectName = "omi"
|
||||
self.sourceDirectory = "Unix"
|
||||
self.targets = "all"
|
||||
|
||||
class ProjectOMS(Project):
|
||||
|
@ -155,9 +155,9 @@ class ProjectOMS(Project):
|
|||
def __init__(self):
|
||||
self.buildDirectory = "omsagent/build"
|
||||
self.cloneSource = "git@github.com:Microsoft/Build-OMS-Agent-for-Linux.git"
|
||||
self.subProjects = ["dsc", "omi", "omsagent", "opsmgr", "pal"]
|
||||
self.makeDependencies = False
|
||||
self.projectName = "oms"
|
||||
self.sourceDirectory = "omsagent/source"
|
||||
self.targets = "all"
|
||||
|
||||
class ProjectPAL(Project):
|
||||
|
@ -166,8 +166,8 @@ class ProjectPAL(Project):
|
|||
def __init__(self):
|
||||
self.buildDirectory = "build"
|
||||
self.cloneSource = "git@github.com:Microsoft/pal.git"
|
||||
self.subProjects = [ ]
|
||||
self.makeDependencies = False
|
||||
self.projectName = "pal"
|
||||
self.sourceDirectory = "source"
|
||||
self.targets = "all test"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче