diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-11-23 23:58:19 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-11-23 23:58:19 +0100 |
commit | 1f9a4d8ea73e2ffa2cf4df87c0d57b4c312c0c80 (patch) | |
tree | 67a278d47a59824e5220d31e704869a033c83eb0 /community | |
parent | 5518842d8e238fae34429ada5b438c5cecd93297 (diff) | |
download | aports-1f9a4d8ea73e2ffa2cf4df87c0d57b4c312c0c80.tar.bz2 aports-1f9a4d8ea73e2ffa2cf4df87c0d57b4c312c0c80.tar.xz |
community/postgresql-pglogical: move from testing
Diffstat (limited to 'community')
-rw-r--r-- | community/postgresql-pglogical/001-fix-stdin-handling.patch | 51 | ||||
-rw-r--r-- | community/postgresql-pglogical/APKBUILD | 29 |
2 files changed, 80 insertions, 0 deletions
diff --git a/community/postgresql-pglogical/001-fix-stdin-handling.patch b/community/postgresql-pglogical/001-fix-stdin-handling.patch new file mode 100644 index 0000000000..8ba3f6c958 --- /dev/null +++ b/community/postgresql-pglogical/001-fix-stdin-handling.patch @@ -0,0 +1,51 @@ +diff --git a/pglogical_apply_spi.c b/pglogical_apply_spi.c +index 3eaccc4..111a4eb 100644 +--- a/pglogical_apply_spi.c ++++ b/pglogical_apply_spi.c +@@ -454,7 +454,7 @@ static void + pglogical_proccess_copy(pglogical_copyState *pglcstate) + { + uint64 processed; +- FILE *save_stdin; ++ int save_stdin; + + if (!pglcstate->copy_parsetree || !pglcstate->copy_buffered_tuples) + return; +@@ -489,8 +489,16 @@ pglogical_proccess_copy(pglogical_copyState *pglcstate) + * for this relation. Before that we save the current 'stdin' stream and + * restore it back when the COPY is done + */ +- save_stdin = stdin; +- stdin = pglcstate->copy_read_file; ++ save_stdin = dup(fileno(stdin)); ++ if (save_stdin < 0) ++ ereport(FATAL, ++ (errcode_for_file_access(), ++ errmsg("could not save stdin: %m"))); ++ ++ if (dup2(fileno(pglcstate->copy_read_file), fileno(stdin)) < 0) ++ ereport(FATAL, ++ (errcode_for_file_access(), ++ errmsg("could not redirect stdin: %m"))); + + /* COPY may call into SPI (triggers, ...) and we already are in SPI. */ + SPI_push(); +@@ -501,10 +509,17 @@ pglogical_proccess_copy(pglogical_copyState *pglcstate) + + /* Clean up SPI state */ + SPI_pop(); ++ /* ++ * Also close the read end of the pipe and restore 'stdin' to its original ++ * value ++ */ ++ if (dup2(save_stdin, fileno(stdin)) < 0) ++ ereport(FATAL, ++ (errcode_for_file_access(), ++ errmsg("could not restore stdin: %m"))); + + fclose(pglcstate->copy_read_file); + pglcstate->copy_read_file = NULL; +- stdin = save_stdin; + + /* Ensure we processed correct number of tuples */ + Assert(processed == pglcstate->copy_buffered_tuples); diff --git a/community/postgresql-pglogical/APKBUILD b/community/postgresql-pglogical/APKBUILD new file mode 100644 index 0000000000..9dee5e2a36 --- /dev/null +++ b/community/postgresql-pglogical/APKBUILD @@ -0,0 +1,29 @@ +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Contributor: Eugene Pirogov <iamexile@gmail.com> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +pkgname=postgresql-pglogical +_pkgname=pglogical +pkgver=2.1.0 +pkgrel=1 +pkgdesc="Logical Replication extension for PostgreSQ" +url="https://2ndquadrant.com/en/resources/pglogical/" +arch="all" +license="custom" +depends="postgresql" +makedepends="libedit-dev libxml2-dev postgresql-dev zlib-dev" +source="http://packages.2ndquadrant.com/pglogical/tarballs/$_pkgname-$pkgver.tar.bz2 + 001-fix-stdin-handling.patch" +builddir="$srcdir/$_pkgname-$pkgver" + +build() { + cd "$builddir" + make USE_PGXS=1 all +} + +package() { + cd "$builddir" + make USE_PGXS=1 DESTDIR="$pkgdir" install +} + +sha512sums="48f39831de137cd329717165b9bbe38c732809d0604851947ecc1b3c0f59201b9811ea72d24facfd0f977d99460d4d1d0a258767cc560c73a97f42b33c1ac616 pglogical-2.1.0.tar.bz2 +89df4ed3992f43a0a37eebb5e06dedd2668b6acfad987b3c37e647c05718a9eb0d330d195f4f4426ffc5fad3e1fc7f156c10d3ea6dc7ee778bc2a5b27c6f138f 001-fix-stdin-handling.patch" |