diff --git a/pgxntool/CLAUDE.md b/pgxntool/CLAUDE.md index cfa7b8d..9d4c24b 100644 --- a/pgxntool/CLAUDE.md +++ b/pgxntool/CLAUDE.md @@ -188,9 +188,10 @@ When tests fail, examine the diff output carefully. The actual test output in `t - Validates repo is clean before tagging ### Subtree Sync Support -- `make pgxntool-sync` pulls latest release -- Multiple sync targets: release, stable, local variants -- Uses `git subtree pull --squash` +- `make pgxntool-sync` pulls the latest release (the `release` tag) from the canonical repo +- `pgxntool/pgxntool-sync.sh [ []]` does the work and can be run without make +- `make pgxntool-sync-` pulls from the `pgxntool-sync-` variable (` `) +- Uses `git subtree pull --squash`, then `update-setup-files.sh` for a 3-way merge of copied files - Requires clean repo (no uncommitted changes) ### pg_tle Support diff --git a/pgxntool/HISTORY.asc b/pgxntool/HISTORY.asc index 8cd1f7b..a3e912b 100644 --- a/pgxntool/HISTORY.asc +++ b/pgxntool/HISTORY.asc @@ -1,3 +1,11 @@ +2.0.3 +----- +== Fix pgxntool-sync remote, and make it runnable without make +`make pgxntool-sync` pointed at the old SSH URL, which fails without +GitHub SSH keys; it now uses `https://github.com/Postgres-Extensions/pgxntool.git` +over HTTPS (still the `release` tag). The subtree pull + `update-setup-files.sh` +logic moved into `pgxntool/pgxntool-sync.sh`, which the make targets now wrap, so +you can also sync without `make` by running it directly. 2.0.2 ----- @@ -81,7 +89,6 @@ appropriate API calls for each range. See README for usage. == Use git tags for distribution versioning The `tag` and `rmtag` targets now create/delete git tags instead of branches. - == Support 13+ The `--load-language` option was removed from `pg_regress` in 13. diff --git a/pgxntool/README.asc b/pgxntool/README.asc index ae81dd0..03b9acc 100644 --- a/pgxntool/README.asc +++ b/pgxntool/README.asc @@ -223,11 +223,13 @@ WARNING: You will be very unhappy if you forget to update the .control file for NOTE: Part of the `clean` recipe is cleaning up these .zip files. If you accidentally clean before uploading, just run `make dist-only`. === pgxntool-sync -This rule will pull down the latest released version of PGXNtool via `git subtree pull`. +This rule will pull down the latest released version of PGXNtool via `git subtree pull` and then reconcile the files `setup.sh` copied into your project (`.gitignore`, `test/deps.sql`) with a 3-way merge. NOTE: Your repository must be clean (no modified files) in order to run this. Running this command will produce a git commit of the merge. -TIP: There is also a `pgxntool-sync-%` rule if you need to do more advanced things. +TIP: The actual work is done by `pgxntool/pgxntool-sync.sh`, so you can run it directly (`pgxntool/pgxntool-sync.sh`) if you'd rather not go through `make`. It optionally takes `` and `` arguments to pull from somewhere other than the default. + +TIP: There is also a `pgxntool-sync-%` rule if you need to do more advanced things. `make pgxntool-sync-` pulls from the ` ` defined by the `pgxntool-sync-` make variable. === distclean `make distclean` removes generated configuration files (`META.json`, `meta.mk`, `control.mk`) that survive a normal `make clean`. diff --git a/pgxntool/README.html b/pgxntool/README.html index d669085..a46c633 100644 --- a/pgxntool/README.html +++ b/pgxntool/README.html @@ -926,7 +926,7 @@

4.9. pgxntool-sync

-

This rule will pull down the latest released version of PGXNtool via git subtree pull.

+

This rule will pull down the latest released version of PGXNtool via git subtree pull and then reconcile the files setup.sh copied into your project (.gitignore, test/deps.sql) with a 3-way merge.

@@ -947,7 +947,19 @@

Tip

+ +
-There is also a pgxntool-sync-% rule if you need to do more advanced things. +The actual work is done by pgxntool/pgxntool-sync.sh, so you can run it directly (pgxntool/pgxntool-sync.sh) if you’d rather not go through make. It optionally takes <repo> and <ref> arguments to pull from somewhere other than the default. +
+
+
+ + + +
+
Tip
+
+There is also a pgxntool-sync-% rule if you need to do more advanced things. make pgxntool-sync-<name> pulls from the <repo> <ref> defined by the pgxntool-sync-<name> make variable.
diff --git a/pgxntool/base.mk b/pgxntool/base.mk index 2fc4d9b..fc9923e 100644 --- a/pgxntool/base.mk +++ b/pgxntool/base.mk @@ -52,7 +52,6 @@ TESTDIR ?= test TESTOUT ?= $(TESTDIR) TEST_SQL_FILES += $(wildcard $(TESTDIR)/sql/*.sql) TEST_RESULT_FILES = $(patsubst $(TESTDIR)/sql/%.sql,$(TESTDIR)/expected/%.out,$(TEST_SQL_FILES)) - TEST_FILES = $(TEST_SQL_FILES) REGRESS = $(sort $(notdir $(TEST_FILES:.sql=))) REGRESS_OPTS = --inputdir=$(TESTDIR) --outputdir=$(TESTOUT) # See additional setup below @@ -206,7 +205,6 @@ ifeq ($(GE91),yes) all: $(EXTENSION_VERSION_FILES) endif - ifeq ($(call test, $(MAJORVER), -lt, 130), yes) REGRESS_OPTS += --load-language=plpgsql endif @@ -484,27 +482,29 @@ print-% : ; $(info $* is $(flavor $*) variable set to "$($*)") @true # # subtree sync support # -# This is setup to allow any number of pull targets by defining special -# variables. pgxntool-sync-release is an example of this. +# All the real work (git subtree pull + update-setup-files.sh) lives in +# pgxntool/pgxntool-sync.sh so it can be run directly, without make. These +# targets are thin wrappers around that script. +# +# `make pgxntool-sync` pulls the latest released version from the canonical +# repository (the script's built-in default). # -# After the subtree pull, we run update-setup-files.sh to handle files that -# were initially copied by setup.sh (like .gitignore). This script does a -# 3-way merge if both you and pgxntool changed the file. -.PHONY: pgxntool-sync-% +# `make pgxntool-sync-` pulls from the " " defined by the +# pgxntool-sync- variable, allowing any number of custom pull sources. +.PHONY: pgxntool-sync pgxntool-sync-% +pgxntool-sync: + @pgxntool/pgxntool-sync.sh pgxntool-sync-%: - @old_commit=$$(git log -1 --format=%H -- pgxntool/) && \ - git subtree pull -P pgxntool --squash -m "Pull pgxntool from $($@)" $($@) && \ - pgxntool/update-setup-files.sh "$$old_commit" -pgxntool-sync: pgxntool-sync-release + @pgxntool/pgxntool-sync.sh $($@) # DANGER! Use these with caution. They may add extra crap to your history and # could make resolving merges difficult! -pgxntool-sync-release := git@github.com:decibel/pgxntool.git release -pgxntool-sync-stable := git@github.com:decibel/pgxntool.git stable -pgxntool-sync-master := git@github.com:decibel/pgxntool.git master -pgxntool-sync-local := ../pgxntool release # Not the same as PGXNTOOL_DIR! -pgxntool-sync-local-stable := ../pgxntool stable # Not the same as PGXNTOOL_DIR! -pgxntool-sync-local-master := ../pgxntool master # Not the same as PGXNTOOL_DIR! +# `pgxntool-sync` (no suffix) already pulls the canonical release; these are the +# alternatives. `-master` pulls the bleeding edge; `-local*` pull from a sibling +# ../pgxntool checkout (not the same as PGXNTOOL_DIR!). +pgxntool-sync-master := https://github.com/Postgres-Extensions/pgxntool.git master +pgxntool-sync-local := ../pgxntool release +pgxntool-sync-local-master := ../pgxntool master # PGXS doesn't provide any special support for distclean (it just depends on # clean), so we roll our own. Files that should only be removed by distclean diff --git a/pgxntool/pgxntool-sync.sh b/pgxntool/pgxntool-sync.sh new file mode 100755 index 0000000..c61e60a --- /dev/null +++ b/pgxntool/pgxntool-sync.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# pgxntool-sync.sh - Pull the latest pgxntool via git subtree and reconcile setup files +# +# This performs the two steps needed to update pgxntool inside a project: +# +# 1. git subtree pull -P pgxntool ... (update the embedded pgxntool copy) +# 2. update-setup-files.sh (3-way merge files setup.sh copied out, +# like .gitignore and test/deps.sql) +# +# It is invoked by the `make pgxntool-sync` targets, but can also be run directly +# so you never need make to update pgxntool. +# +# Usage: pgxntool-sync.sh [ []] +# +# repo Git URL (or path) to pull pgxntool from. Defaults to the canonical +# pgxntool repository. +# ref Branch, tag, or commit to pull. Defaults to the `release` tag, which +# always points at the latest released version. +# +# Run from the root of your project (the directory containing pgxntool/). + +set -o errexit -o errtrace -o pipefail +trap 'echo "Error on line ${LINENO}"' ERR + +PGXNTOOL_DIR="$(dirname "${BASH_SOURCE[0]}")" +source "$PGXNTOOL_DIR/lib.sh" + +# Canonical source for pgxntool. `release` is a floating tag that the release +# process force-moves to each new version, so it always names the latest +# released version -- exactly what a plain sync should track. +DEFAULT_REPO="https://github.com/Postgres-Extensions/pgxntool.git" +DEFAULT_REF="release" + +repo=${1:-$DEFAULT_REPO} +ref=${2:-$DEFAULT_REF} + +# We must run from the project root: git subtree pull operates on the pgxntool/ +# prefix and update-setup-files.sh resolves paths relative to the current dir. +[[ -d "pgxntool" ]] || die 1 "pgxntool directory not found. Run from your project root." +[[ -d ".git" ]] || die 1 "Not in a git repository. Run from your project root." + +# The old commit is the pgxntool subtree HEAD before the pull; update-setup-files.sh +# needs it as the merge base for files that were copied out of pgxntool. +old_commit=$(git log -1 --format=%H -- pgxntool/) + +git subtree pull -P pgxntool --squash -m "Pull pgxntool from $repo $ref" "$repo" "$ref" + +"$PGXNTOOL_DIR/update-setup-files.sh" "$old_commit"