From db33107c91b3b616d62b98f544ba5f43e048451a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 29 Jan 2020 18:43:11 +0100 Subject: Fix module dependencies after qt5.git changes When starting a new round of updates, consider the dependency information (required, optional) from qt5.git as authoritative, instead of re-using an existing dependencies.yaml file. This fixes the situation where after changes to qt5.git a previous optional dependency is not included in the default set anymore. Change-Id: Ic7a095951a960c3c491f85dcaf3f495d0932e2d7 Reviewed-by: Simon Hausmann --- src/qtmoduleupdater/module.go | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/qtmoduleupdater/module.go b/src/qtmoduleupdater/module.go index 0a0e6bf..a335028 100644 --- a/src/qtmoduleupdater/module.go +++ b/src/qtmoduleupdater/module.go @@ -193,35 +193,32 @@ func NewModule(moduleName string, branch string, qt5Modules map[string]*submodul return nil, fmt.Errorf("could not fetch repo tip %s of %s: %s", headRef, moduleName, err) } - yamlDependencies, _ := readDependenciesYAML(repoPath, repo, moduleTipCommit) - if yamlDependencies == nil { - yamlDependencies = &YAMLDependencies{} - yamlDependencies.Dependencies = make(map[string]*YAMLModule) + yamlDependencies := &YAMLDependencies{} + yamlDependencies.Dependencies = make(map[string]*YAMLModule) - subModule, ok := qt5Modules[moduleName] - if !ok { - return nil, fmt.Errorf("could not find %s in .gitmodules in qt5.git", moduleName) - } + subModule, ok := qt5Modules[moduleName] + if !ok { + return nil, fmt.Errorf("could not find %s in .gitmodules in qt5.git", moduleName) + } - populateDependencies := func(required bool, dependencies []string) { - for _, dependency := range dependencies { - _, knownModule := qt5Modules[dependency] - if !required && !knownModule { - continue - } + populateDependencies := func(required bool, dependencies []string) { + for _, dependency := range dependencies { + _, knownModule := qt5Modules[dependency] + if !required && !knownModule { + continue + } - var yamlModule YAMLModule - yamlModule.Required = required - yamlModule.Ref = string(subModule.headCommit) + var yamlModule YAMLModule + yamlModule.Required = required + yamlModule.Ref = string(subModule.headCommit) - yamlDependencies.Dependencies[dependency] = &yamlModule - } + yamlDependencies.Dependencies[dependency] = &yamlModule } - - populateDependencies(true, subModule.requiredDependencies) - populateDependencies(false, subModule.optionalDependencies) } + populateDependencies(true, subModule.requiredDependencies) + populateDependencies(false, subModule.optionalDependencies) + result := &Module{} result.RepoPath = repoPath result.Branch = branch -- cgit v1.2.1