You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/07/02 15:08:54 UTC
(tooling-trusted-releases) branch arm updated: #1355 - take account of airflow release patterns
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/arm by this push:
new a0217670 #1355 - take account of airflow release patterns
a0217670 is described below
commit a0217670eca9dd1b1e1bc1a09b7acc60cca4c115
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Thu Jul 2 16:08:29 2026 +0100
#1355 - take account of airflow release patterns
---
atr/svn/catalog.py | 52 ++++++++++++++++++++++++++++++++++++++++++++
atr/svn/dist.py | 37 +++++++++++++++++++++++++++++--
tests/unit/test_decompose.py | 4 ++--
3 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/atr/svn/catalog.py b/atr/svn/catalog.py
index 7a00b5be..e53bbd06 100644
--- a/atr/svn/catalog.py
+++ b/atr/svn/catalog.py
@@ -70,6 +70,7 @@ async def catalogue_commit(commit: dict) -> None:
log.warning(f"dist commit payload has unexpected changed shape: {type(changed).__name__}")
return
added, removed = _structural_changes(changed)
+ added = _collapse_airflow_providers(added)
if not (added or removed):
return
date = _commit_date(commit)
@@ -285,3 +286,54 @@ def _structural_changes(
if file_type is classify.FileType.SOURCE:
bundle.has_source = True
return {key: bundle for key, bundle in added.items() if bundle.has_source}, removed
+
+
+def _airflow_bundle_area(bundle: _ReleaseFiles) -> str | None:
+ if bundle.committee != "airflow":
+ return None
+ for dirpath, _name, _kind in bundle.files:
+ # dirpath is under the release root and leads with the committee, so drop that segment
+ area = dist.airflow_provider_area("airflow", tuple(dirpath.split("/")[1:]))
+ if area is not None:
+ return area
+ return None
+
+
+def _airflow_file_kind(name: str, kind: classify.FileType) -> classify.FileType:
+ # The batch source stays the release's source; a provider package that classified as source is a
+ # binary of the batch, and companions keep their kind
+ if dist.airflow_calver_date(name) is not None:
+ return classify.FileType.SOURCE
+ if kind is classify.FileType.SOURCE:
+ return classify.FileType.BINARY
+ return kind
+
+
+def _collapse_airflow_providers(
+ added: dict[tuple[str, str | None, str], _ReleaseFiles],
+) -> dict[tuple[str, str | None, str], _ReleaseFiles]:
+ # Airflow ships its providers as a calver batch: a dated source plus that day's provider
+ # packages, flat in one dir. Collapse the per-provider bundles this commit produced into one
+ # release per area keyed by the batch's calver date, source kept as source and the rest binaries.
+ # A commit with no batch source is left as it decomposed
+ date_by_area: dict[str, str] = {}
+ keys_by_area: dict[str, list[tuple[str, str | None, str]]] = {}
+ for key, bundle in added.items():
+ area = _airflow_bundle_area(bundle)
+ if area is None:
+ continue
+ keys_by_area.setdefault(area, []).append(key)
+ for _dirpath, name, _kind in bundle.files:
+ date = dist.airflow_calver_date(name)
+ if date is not None:
+ date_by_area[area] = date
+ for area, date in date_by_area.items():
+ merged = _ReleaseFiles("airflow", area, date)
+ for key in keys_by_area[area]:
+ for dirpath, name, kind in added.pop(key).files:
+ merged_kind = _airflow_file_kind(name, kind)
+ merged.files.append((dirpath, name, merged_kind))
+ if merged_kind is classify.FileType.SOURCE:
+ merged.has_source = True
+ added[("airflow", area, date)] = merged
+ return added
diff --git a/atr/svn/dist.py b/atr/svn/dist.py
index 9fc8eeac..6b9dbf03 100644
--- a/atr/svn/dist.py
+++ b/atr/svn/dist.py
@@ -72,6 +72,39 @@ _SEMVER_FILE_RE: Final[re.Pattern[str]] = re.compile(
# Calver dates (2026-01-27 or 20050330), limited to 19xx/20xx
_CALVER_FILE_RE: Final[re.Pattern[str]] = re.compile(r"(?<!\d)(\d{4}-\d{2}-\d{2}|(?:19|20)\d{6})(?!\d)")
+# Airflow ships its providers as flat calver batches: a dated source alongside every provider
+# package, in one dir with no version subdir. These spot the drop area and the batch source so the
+# watcher and cataloguer can collapse the per-provider subprojects into one project keyed by calver
+AIRFLOW_PROVIDER_AREAS: Final[frozenset[str]] = frozenset({"providers", "backport-providers"})
+_AIRFLOW_CALVER_SOURCE_RE: Final[re.Pattern[str]] = re.compile(
+ r"^apache[-_]airflow[-_](?:backport[-_])?providers-(\d{4})[-.](\d{1,2})[-.](\d{1,2})-source\.tar\.gz$"
+)
+_AIRFLOW_PROVIDER_FILE_RE: Final[re.Pattern[str]] = re.compile(r"^apache[-_]airflow[-_](?:backport[-_])?providers[-_]")
+
+
+def airflow_provider_area(committee: str, parts: tuple[str, ...]) -> str | None:
+ # The airflow provider area a file sits under (airflow/<area>/), or None
+ if committee != "airflow":
+ return None
+ if parts and (parts[0] in AIRFLOW_PROVIDER_AREAS):
+ return parts[0]
+ return None
+
+
+def is_airflow_provider_filename(filename: str) -> bool:
+ # A provider package or its batch source, by name - used to skip the stray copies of these that
+ # sit directly under airflow/ (duplicates of the ones under airflow/providers/)
+ return _AIRFLOW_PROVIDER_FILE_RE.match(filename) is not None
+
+
+def airflow_calver_date(filename: str) -> str | None:
+ # The calver date of a providers batch source, normalised to YYYY-MM-DD, or None
+ match = _AIRFLOW_CALVER_SOURCE_RE.match(filename)
+ if match is None:
+ return None
+ year, month, day = match.groups()
+ return f"{year}-{int(month):02d}-{int(day):02d}"
+
@dataclasses.dataclass(frozen=True)
class Decomposed:
@@ -83,8 +116,8 @@ class Decomposed:
def candidate_keys(committee: str, subproject: str | None) -> list[str]:
# Dist layout and projects.json keys don't always line up (commons/lang -> commons-lang, but
# accumulo/accumulo-access is already its key), so try the obvious shapes. apache-/apache_ come
- # off and underscores become hyphens, so a dist name like apache_airflow_providers_alibaba lines
- # up with the registry's airflow-providers-alibaba instead of seeding an underscore duplicate
+ # off and underscores become hyphens, so an underscored dist name lines up with the registry's
+ # hyphenated key instead of seeding an underscore duplicate
if not subproject:
return [committee]
bare = subproject.removeprefix("apache-").removeprefix("apache_").replace("_", "-")
diff --git a/tests/unit/test_decompose.py b/tests/unit/test_decompose.py
index 04a4c6af..86431be4 100644
--- a/tests/unit/test_decompose.py
+++ b/tests/unit/test_decompose.py
@@ -201,8 +201,8 @@ def test_repos_subtree_is_not_a_release() -> None:
def test_candidate_keys_bridge_underscore_package_names() -> None:
- # A dist filename's underscore package name lines up with the registry's hyphenated key, so
- # the airflow providers resolve to airflow-providers-<name> rather than seeding a duplicate
+ # An underscored dist package name bridges to the registry's hyphenated key, so candidate_keys
+ # offers the hyphenated form rather than only the underscore duplicate
assert "airflow-providers-alibaba" in dist.candidate_keys("airflow", "apache_airflow_providers_alibaba")
assert "airflow-providers" in dist.candidate_keys("airflow", "apache_airflow_providers")
# An apache- prefixed name still strips to the bare key, as before
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org