Skip to content

Commit edc1e17

Browse files
committed
doctest integration and some file rearrangement.
1 parent 7222ebc commit edc1e17

File tree

85 files changed

+974
-4405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+974
-4405
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ RUN apt-get update && \
99

1010
# add postgres user and make data dir
1111
RUN groupadd -r postgres && useradd --no-log-init -r -m -s /bin/bash -g postgres -G sudo postgres
12+
RUN echo "postgres ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \
13+
chmod 0440 /etc/sudoers.d/user
14+
1215
ENV PGDATA /home/postgres/data
1316
RUN /bin/rm -Rf "$PGDATA" && mkdir "$PGDATA"
1417
WORKDIR "/home/postgres"
@@ -26,7 +29,7 @@ RUN git clone --branch REL_${version}_STABLE https://github.com/postgres/postgre
2629
RUN chown postgres:postgres /home/postgres
2730

2831
RUN curl -s -L https://github.com/theory/pgtap/archive/v1.2.0.tar.gz | tar zxvf - && cd pgtap-1.2.0 && make && make install
29-
RUN curl -s -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz | tar zxvf - && cd libsodium-1.0.18 && ./configure && make check && make -j 4 install
32+
RUN curl -s -L https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz | tar zxvf - && cd libsodium-1.0.20 && ./configure && make check && make -j 4 install
3033
RUN cpan App::cpanminus && cpan TAP::Parser::SourceHandler::pgTAP && cpan App::prove
3134

3235
RUN git clone --depth 1 https://github.com/lacanoid/pgddl.git
@@ -43,7 +46,6 @@ RUN sed -i 's/exit//g' `pg_config --sharedir`/extension/pgsodium_getkey
4346
RUN chmod +x `pg_config --sharedir`/extension/pgsodium_getkey
4447
RUN cp `pg_config --sharedir`/extension/pgsodium_getkey /getkey
4548

46-
# chown just pggraphblas
4749
RUN chown -R postgres:postgres /home/postgres/pgsodium
4850
RUN chown -R postgres:postgres /home/postgres/data
4951

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
EXTENSION = pgsodium
44
PG_CONFIG ?= pg_config
5-
DATA = $(wildcard sql/*--*.sql)
5+
DATA = $(wildcard extension/*--*.sql)
66
PGXS := $(shell $(PG_CONFIG) --pgxs)
77
MODULE_big = pgsodium
88
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
99
SHLIB_LINK = -lsodium
1010
PG_CPPFLAGS = -O0
1111

12-
# TESTS = $(wildcard test/*.sql)
13-
# REGRESS = $(patsubst test/%.sql,%,$(TESTS))
14-
# REGRESS_OPTS = --inputdir=test --load-language=plpgsql
12+
TESTS = $(wildcard sql/*.sql)
13+
REGRESS = $(patsubst sql/%.sql,%,$(TESTS))
1514
include $(PGXS)
1615

1716
dist:

doc-notebook.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

docgen.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os
2+
import sys
3+
4+
5+
def process_file(path):
6+
with open(path, "r") as f:
7+
content = f.read()
8+
s = content.lstrip()
9+
if not s.startswith("/* doctest"):
10+
return
11+
end = s.find("*/")
12+
if end == -1:
13+
return
14+
comment = s[: end + 2]
15+
lines = comment.splitlines()
16+
if not lines:
17+
return
18+
first = lines[0]
19+
if not first.startswith("/* doctest"):
20+
return
21+
target = first[len("/* doctest"):].strip()
22+
if target.startswith("/"):
23+
target = target[1:]
24+
if not target:
25+
return
26+
target = target.replace('/', '_')
27+
stripped_comment = "\n".join(lines[1:-1]).strip() if len(lines) >= 3 else ""
28+
out_file = os.path.join("sql", target + ".sql")
29+
os.makedirs(os.path.dirname(out_file), exist_ok=True)
30+
with open(out_file, "w") as out:
31+
out.write(stripped_comment + "\n\n")
32+
33+
34+
def main():
35+
base = sys.argv[1] if len(sys.argv) > 1 else "."
36+
for root, _, files in os.walk(base):
37+
for f in files:
38+
if f.endswith(".c"):
39+
process_file(os.path.join(root, f))
40+
41+
42+
if __name__ == "__main__":
43+
main()

docs/Authenticated_Encryption_With_Additional_Data.ipynb

Lines changed: 0 additions & 98 deletions
This file was deleted.

docs/Authenticated_Encryption_With_Additional_Data.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/Configuration.ipynb

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)