From 9ec363949d2457d37af502e00fc2414eaad579be Mon Sep 17 00:00:00 2001 From: Sindre Stephansen Date: Tue, 8 Aug 2023 09:31:21 +0200 Subject: [PATCH] Fix handling of BOMs --- package-list.yaml | 2 ++ sync/src/maven/packages.py | 2 ++ sync/src/maven/pom.py | 9 ++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package-list.yaml b/package-list.yaml index a5bf366..de408e3 100644 --- a/package-list.yaml +++ b/package-list.yaml @@ -35,3 +35,5 @@ configurations: _default: ['3.3.0', '3.2.2'] koin-core: [] koin-ktor: ['default', '-3.3.0', '3.2.1'] + + io.ktor:ktor-bom: "latest" diff --git a/sync/src/maven/packages.py b/sync/src/maven/packages.py index f96fa4f..1507a94 100644 --- a/sync/src/maven/packages.py +++ b/sync/src/maven/packages.py @@ -42,9 +42,11 @@ async def get_dependencies(package: Package, mirrors: Iterable[str]) -> list[Pac if pom := await fetch_pom(package, mirrors): if pom.is_bom: + logger.debug(f'{package} is BOM') try: packages.extend(pom.dependency_management) except PropertyMissing as e1: + logger.debug(f'{package}: Properties not found, checking parent') parent_props = await get_parent_props(pom.parent, mirrors) if parent_props: pom.set_properties(parent_props) diff --git a/sync/src/maven/pom.py b/sync/src/maven/pom.py index 0928f73..9599274 100644 --- a/sync/src/maven/pom.py +++ b/sync/src/maven/pom.py @@ -44,18 +44,25 @@ class PackagePOM: self.parent = None if (parent_tag := self._raw_root.find('parent', ns)) is not None: + logger.debug(f'{self.name}: Found parent tag') parent_group = pom_find_tag_text(parent_tag, 'groupId') parent_artifact = pom_find_tag_text(parent_tag, 'artifactId') parent_version = pom_find_tag_text(parent_tag, 'version') if parent_group is None or parent_artifact is None or parent_version is None: + logger.warning(f'{self.name}: Could not resolve parent') raise PackageError(f'Invalid parent {parent_group}:{parent_artifact}:{parent_version}') else: self.parent = Package(parent_group, parent_artifact, parent_version) + logger.debug(f'{self.name}: Parent is {self.parent}') + else: + logger.debug(f'{self.name}: No parent tag found') - if (packaging := self._raw_root.find('packaging', ns)) is not None: + if (packaging := pom_find_tag_text(self._raw_root, 'packaging')) is not None: + logger.debug(f'{self.name}: Packaging is {packaging}') self.is_bom = packaging == 'pom' else: + logger.debug(f'{self.name}: Could not find packaging in POM') self.is_bom = False self.set_properties({})