Skip to content

Bundle H3 source in release tarballs#209

Open
Komzpa wants to merge 3 commits into
mainfrom
fix-offline-release-tarball-206
Open

Bundle H3 source in release tarballs#209
Komzpa wants to merge 3 commits into
mainfrom
fix-offline-release-tarball-206

Conversation

@Komzpa

@Komzpa Komzpa commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

  • make release bundles produce h3-<version>.tar.gz alongside the PGXN zip
  • include the downloaded H3 core source under cmake/h3/upstream/ in that tarball
  • have CMake use the bundled upstream source when present, so Debian-style offline builds do not need FetchContent downloads
  • update the release checklist to attach the source tarball to GitHub releases

Fixes #206.

Test

  • scripts/bundle
  • tar -tzf h3-unreleased.tar.gz | rg '^(h3-unreleased/(cmake/h3/upstream/CMakeLists.txt|cmake/h3/upstream/src/h3lib/include/linkedGeo.h|cmake/BundleSource.cmake|META.json))$'
  • cmake -S /tmp/h3pg-offline-tarball/h3-unreleased -B /tmp/h3pg-offline-tarball/build -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_FULLY_DISCONNECTED=ON
  • cmake --build /tmp/h3pg-offline-tarball/build -j32

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a source bundle target and helper script that create a release tarball, stage bundled H3 sources when available, and update the bundle script, release text, and ignore rules.

Changes

Source bundle workflow

Layer / File(s) Summary
Bundle entry point
CMakeLists.txt, scripts/bundle
Adds the source_bundle target, enforces a clean tracked tree before bundling, and switches the bundle build to that target.
Tarball staging
cmake/BundleSource.cmake
Validates bundle inputs, archives HEAD, stages META_JSON and H3_SOURCE_DIR, and writes h3-${INSTALL_VERSION}.tar.gz.
Bundled H3 fallback
cmake/h3/CMakeLists.txt, scripts/release, .gitignore
Uses bundled H3 when present, falls back to the upstream tarball otherwise, updates release instructions, and ignores generated source tarballs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • postgis/h3-pg#197: Shares the release and scripts/bundle automation path that this PR updates to produce and publish the new tarball artifact.

Poem

🐇 I hopped through the build with a whisker of cheer,
A bundle appeared, crisp and bright, very near.
With H3 tucked in its nest,
The release notes name the treasure at best.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes bundling H3 source into release tarballs, which is the main change.
Description check ✅ Passed The description matches the code changes and release packaging/offline-build goals.
Linked Issues check ✅ Passed The PR ships the H3 source in release tarballs and makes CMake use it when bundled, supporting the offline Debian-style build objective.
Out of Scope Changes check ✅ Passed The changes are limited to bundling, build logic, release instructions, and ignore rules tied to the stated packaging goal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-offline-release-tarball-206

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CMakeLists.txt`:
- Around line 84-92: The source_bundle target is referencing h3_SOURCE_DIR from
the top-level CMakeLists.txt, but that variable is only set inside
cmake/h3/CMakeLists.txt and does not propagate out of the subdirectory scope.
Promote h3_SOURCE_DIR to a CACHE PATH variable in cmake/h3/CMakeLists.txt after
FetchContent_MakeAvailable(h3) so it is visible to the parent scope, and then
keep the source_bundle command using ${h3_SOURCE_DIR} as the source path for
BundleSource.cmake.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 968abe1e-0937-4557-ba14-6b9fc4e192f1

📥 Commits

Reviewing files that changed from the base of the PR and between adbade5 and bb145e5.

📒 Files selected for processing (5)
  • CMakeLists.txt
  • cmake/BundleSource.cmake
  • cmake/h3/CMakeLists.txt
  • scripts/bundle
  • scripts/release

Comment thread CMakeLists.txt

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb145e58ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CMakeLists.txt
COMMAND ${CMAKE_COMMAND}
-DARCHIVE_OUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/h3-${INSTALL_VERSION}.tar.gz
-DARCHIVE_PREFIX=h3-${INSTALL_VERSION}
-DH3_SOURCE_DIR=${h3_SOURCE_DIR}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Populate H3_SOURCE_DIR before invoking the bundle script

When running scripts/bundle, this expands to -DH3_SOURCE_DIR= because h3_SOURCE_DIR is populated by FetchContent_MakeAvailable(h3) inside cmake/h3/CMakeLists.txt; CMake variables set in a subdirectory do not propagate back to the parent. BundleSource.cmake treats an empty H3_SOURCE_DIR as fatal, so the new source_bundle target fails before producing the release tarball. Export the path from the subdirectory scope before passing it here.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/bundle`:
- Around line 10-15: The cleanup gate in require_clean_tracked_tree only checks
tracked and staged changes, so it can still proceed when untracked files exist
and are about to be removed by the later git clean -xdf step. Update
require_clean_tracked_tree in scripts/bundle to also detect untracked content
(or otherwise require explicit opt-in before destructive cleanup) so the script
fails before deleting local inputs or artifacts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0373d9d-8557-42dd-ac0d-7378b9e46f71

📥 Commits

Reviewing files that changed from the base of the PR and between f55ed62 and 7f3769d.

📒 Files selected for processing (2)
  • cmake/h3/CMakeLists.txt
  • scripts/bundle
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmake/h3/CMakeLists.txt

Comment thread scripts/bundle
Comment on lines +10 to +15
require_clean_tracked_tree() {
git diff --quiet || die "tracked worktree changes are present"
git diff --cached --quiet || die "staged changes are present"
}

require_clean_tracked_tree

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Also guard against untracked files before cleaning.

This only checks tracked/staged edits, but the next git clean -xdf will still delete untracked/ignored files after the script reports the tree as acceptable. That is an easy way to lose local packaging inputs or release artifacts. Either fail on untracked content here as well, or make the destructive clean step explicitly opt-in.

Suggested change
 require_clean_tracked_tree() {
   git diff --quiet || die "tracked worktree changes are present"
   git diff --cached --quiet || die "staged changes are present"
+  git status --porcelain --untracked-files=all | grep -q '^\?\?' &&
+    die "untracked files are present"
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
require_clean_tracked_tree() {
git diff --quiet || die "tracked worktree changes are present"
git diff --cached --quiet || die "staged changes are present"
}
require_clean_tracked_tree
require_clean_tracked_tree() {
git diff --quiet || die "tracked worktree changes are present"
git diff --cached --quiet || die "staged changes are present"
git status --porcelain --untracked-files=all | grep -q '^\?\?' &&
die "untracked files are present"
}
require_clean_tracked_tree
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/bundle` around lines 10 - 15, The cleanup gate in
require_clean_tracked_tree only checks tracked and staged changes, so it can
still proceed when untracked files exist and are about to be removed by the
later git clean -xdf step. Update require_clean_tracked_tree in scripts/bundle
to also detect untracked content (or otherwise require explicit opt-in before
destructive cleanup) so the script fails before deleting local inputs or
artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linking h3-pg against the system libh3

1 participant