gather: Improve logging for gathering
Adding arch and variant to log message to make it clearer. JIRA: COMPOSE-4009 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
		
							parent
							
								
									9b101d554f
								
							
						
					
					
						commit
						12828849d6
					
				| @ -223,7 +223,8 @@ def gather_packages(compose, arch, variant, package_sets, fulltree_excludes=None | ||||
|             GatherMethod = get_gather_method(method_name) | ||||
|             method = GatherMethod(compose) | ||||
|             method.source_name = source_name | ||||
|             compose.log_debug("Gathering source %s, method %s" % (source_name, method_name)) | ||||
|             compose.log_debug( | ||||
|                 "Gathering source %s, method %s (arch: %s, variant: %s)" % (source_name, method_name, arch, variant)) | ||||
|             pkg_map = method(arch, variant, packages, groups, filter_packages, | ||||
|                              multilib_whitelist, multilib_blacklist, package_sets, | ||||
|                              fulltree_excludes=fulltree_excludes, | ||||
|  | ||||
| @ -201,5 +201,6 @@ def check_deps(compose, arch, variant, missing_deps): | ||||
| 
 | ||||
|     if missing_deps: | ||||
|         for pkg in sorted(missing_deps): | ||||
|             compose.log_error("Unresolved dependencies in package %s: %s" % (pkg, sorted(missing_deps[pkg]))) | ||||
|             compose.log_error( | ||||
|                 "Unresolved dependencies for %s.%s in package %s: %s" % (variant, arch, pkg, sorted(missing_deps[pkg]))) | ||||
|         raise RuntimeError("Unresolved dependencies detected") | ||||
|  | ||||
| @ -268,10 +268,10 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase): | ||||
|             env = os.environ.copy() | ||||
|             env["G_MESSAGES_PREFIXED"] = "" | ||||
|             env["XDG_CACHE_HOME"] = cache_dir | ||||
|             self.compose.log_debug("[BEGIN] Running fus") | ||||
|             self.compose.log_debug("[BEGIN] Running fus (arch: %s, variant: %s)" % (arch, variant)) | ||||
|             run(cmd, logfile=logfile, show_cmd=True, env=env) | ||||
|             output, out_modules = fus.parse_output(logfile) | ||||
|             self.compose.log_debug("[DONE ] Running fus") | ||||
|             self.compose.log_debug("[DONE ] Running fus (arch: %s, variant: %s)" % (arch, variant)) | ||||
|             # No need to resolve modules again. They are not going to change. | ||||
|             modules = [] | ||||
|             # Reset input packages as well to only solve newly added things. | ||||
|  | ||||
| @ -112,3 +112,30 @@ class TestRaiseOnInvalidSigkeys(helpers.PungiTestCase): | ||||
|         } | ||||
|         with self.assertRaises(RuntimeError): | ||||
|             deps.raise_on_invalid_sigkeys('', '', [pkgset], result) | ||||
| 
 | ||||
| class TestCheckDeps(helpers.PungiTestCase): | ||||
| 
 | ||||
|     def setUp(self): | ||||
|         super(TestCheckDeps, self).setUp() | ||||
|         self.compose = helpers.DummyCompose(self.topdir, {}) | ||||
|         self.arch = 'x86_64' | ||||
|         self.variant = self.compose.variants['Server'] | ||||
| 
 | ||||
|     def test_not_check_deps(self): | ||||
|         self.compose.conf["check_deps"] = False | ||||
|         self.assertIsNone(deps.check_deps(self.compose, self.arch, self.variant, {})) | ||||
| 
 | ||||
|     def test_missing_deps(self): | ||||
|         self.compose.conf["check_deps"] = True | ||||
|         missing_deps = {'foo.noarch': set(['bar = 1.1'])} | ||||
|         with self.assertRaises(RuntimeError) as ctx: | ||||
|             deps.check_deps(self.compose, self.arch, self.variant, missing_deps) | ||||
|         self.assertEqual(str(ctx.exception), 'Unresolved dependencies detected') | ||||
|         self.assertEqual( | ||||
|             self.compose.log_error.call_args_list, | ||||
|             [ | ||||
|                 mock.call( | ||||
|                     "Unresolved dependencies for %s.%s in package foo.noarch: ['bar = 1.1']" % (self.variant, self.arch) | ||||
|                 ) | ||||
|             ] | ||||
|         ) | ||||
|  | ||||
| @ -365,6 +365,13 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): | ||||
|                 ) | ||||
|             ], | ||||
|         ) | ||||
|         self.assertEqual( | ||||
|             self.compose.log_debug.call_args_list, | ||||
|             [ | ||||
|                 mock.call('[BEGIN] Running fus (arch: x86_64, variant: Server)'), | ||||
|                 mock.call('[DONE ] Running fus (arch: x86_64, variant: Server)') | ||||
|             ] | ||||
|         ) | ||||
| 
 | ||||
|     def test_with_modules_with_devel(self, run, gc, po, wc): | ||||
|         self.compose.has_comps = False | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user