Skip to content

Commit

Permalink
Reorganized repository structure (#77)
Browse files Browse the repository at this point in the history
Reorganized structure of repository to make managing of files easier for
the build process. Adapted from methods used in
https://github.com/pgpartman/pg_partman.

Updates moved into `updates` folder
C code moved into `src` folder
SQL code moved into `sql` folder
Moved test sql script into `test` folder and renamed for clarity
compared to the extension core code file

Removed testing for versions of PostgreSQL no longer in community
support
  • Loading branch information
keithf4 authored Jan 25, 2023
1 parent 5dc1397 commit 35e9f3f
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ WORKDIR /src/set_user
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install postgresql-server-dev-${DEVPKG} make gcc
RUN make USE_PGXS=1 install
RUN make install
2 changes: 1 addition & 1 deletion .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pgver: [9.4, 9.5, 9.6, 10, 11, 12, 13, 14, 15]
pgver: [12, 13, 14, 15]

steps:
- name: Checkout set_user repo
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ results

# Generated documentation
*.pdf

# Generated extension file
extension/set_user--*.sql
11 changes: 11 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
4.0.1

NEW FEATURES
============
- Reorganized repository structure to allow for easier management of extension files during build process.
- Added NO_PGXS build flag to allow building of extension without PGXS. Restores ability to build on Windows.
- No changes to extension code.

BUGFIXES
========
- None
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
MODULES = set_user

EXTENSION = set_user
DATA = set_user--3.0.sql set_user--2.0--3.0.sql set_user--1.6--2.0.sql set_user--1.5--1.6.sql set_user--1.4--1.5.sql set_user--1.1--1.4.sql set_user--1.0--1.1.sql set_user--4.0.0rc1--4.0.0.sql set_user--4.0.0.sql set_user--3.0--4.0.0.sql
EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
LDFLAGS_SL += $(filter -lm, $(LIBS))
MODULES = src/set_user
PG_CONFIG = pg_config
PGFILEDESC = "set_user - similar to SET ROLE but with added logging"

REGRESS = set_user

LDFLAGS_SL += $(filter -lm, $(LIBS))
all: extension/$(EXTENSION)--$(EXTVERSION).sql

extension/$(EXTENSION)--$(EXTVERSION).sql: extension/set_user.sql
cat $^ > $@

DATA = $(wildcard updates/*--*.sql) extension/$(EXTENSION)--$(EXTVERSION).sql
EXTRA_CLEAN = extension/$(EXTENSION)--$(EXTVERSION).sql

ifdef NO_PGXS
subdir = contrib/set_user
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
else
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
endif
Expand All @@ -25,7 +31,7 @@ install: install-headers

install-headers:
$(MKDIR_P) "$(DESTDIR)$(includedir)"
$(INSTALL_DATA) "set_user.h" "$(DESTDIR)$(includedir)"
$(INSTALL_DATA) "src/set_user.h" "$(DESTDIR)$(includedir)"

uninstall: uninstall-headers

Expand Down
File renamed without changes.
44 changes: 0 additions & 44 deletions set_user--1.6.sql

This file was deleted.

53 changes: 0 additions & 53 deletions set_user--3.0.sql

This file was deleted.

2 changes: 1 addition & 1 deletion set_user.control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# set_user extension
comment = 'similar to SET ROLE but with added logging'
default_version = '4.0.0'
default_version = '4.0.1'
module_pathname = '$libdir/set_user'
relocatable = false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions updates/set_user--4.0.0--4.0.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* set-user--4.0.0--4.0.1.sql */

-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION set_user UPDATE" to load this file. \quit

-- just bumping our version to 4.0.1. no new SQL features here, so nothing to do.
File renamed without changes.
File renamed without changes.

0 comments on commit 35e9f3f

Please sign in to comment.