diff --git a/.gitignore b/.gitignore index 22ae860..1322e78 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ tmp_check/ tmp_check_iso/ output_iso/ log/ +target/ +build* +*.bc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..69aeff3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM debian:sid + +RUN apt-get update -qq && \ + apt-get install -y \ + build-essential \ + fakeroot \ + pkg-config \ + devscripts \ + zlib1g-dev \ + postgresql-server-dev-all + +WORKDIR /build/pgsql-gzip diff --git a/Makefile b/Makefile index 50402ab..0fe1b51 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# Make sure we do not run any code when using deb-in-docker target +ifneq ($(MAKECMDGOALS),"deb-in-docker") # Detect pkg-config on the path PKGCONFIG := $(shell type -p pkg-config || echo NONE) @@ -36,3 +38,18 @@ endif PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) +endif + + +.PHONY: deb +deb: + dpkg-buildpackage -B + +.PHONY: deb-in-docker +deb-in-docker: .image + mkdir -p "$$(pwd)/target" + docker run --rm -ti -v"$$(pwd)/target:/build" -v "$$(pwd):/build/pgsql-gzip" deb-builder make deb + +.PHONY: .image +.image: + docker build -t deb-builder . diff --git a/README.md b/README.md index 4e5d86b..8563e73 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,18 @@ To convert a `bytea` back into an equivalent `text` you must use the `encode()` If you have PostgreSQL devel packages and zlib installed, you should have `pg_config` on your path, so you should be able to just run `make`, then `make install`, then in your database `CREATE EXTENSION gzip`. If your `libz` is installed in a non-standard location, you may need to edit `ZLIB_PATH` in the `Makefile`. + +#### Debain/Ubuntu + +To build the DEB package make use you have following dependencies installed as well: + +```bash +> apt-get install build-essential fakeroot devscripts +``` + +And you will be able to run the `make deb` and get the packege wich can be installed with `dpkg -i .deb` + + +#### In Docker + +Makefile has a special target for building the DEB packager directly in the docker by running `make deb-in-docker`. Where the `debian:sid` will be used to prepare the image with all the dependencies and the `make deb` target will be run inside it. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b9ea08c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +pgsql-gzip (1.0.0) unstable; urgency=medium + + * Initial release of the DEB package + + -- Oleksandr Kylymnychenko Fri, 20 Mar 2020 13:18:29 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..20c5634 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: pgsql-gzip +Section: database +Priority: optional +Maintainer: Paul Ramsey +Uploaders: Oleksandr Kylymnychenko , +Build-Depends: debhelper (>= 9), postgresql-server-dev-all (>= 153~) +Standards-Version: 4.5.0 +Vcs-Browser: https://github.com/pramsey/pgsql-gzip +Vcs-Git: https://github.com/pramsey/pgsql-gzip.git + +Package: postgresql-12-gzip +Architecture: any +Depends: postgresql-12, ${misc:Depends}, ${shlibs:Depends} +Description: PostgreSQL extension code + Sometimes you just need to compress your bytea object before you return it to the client. + Sometimes you receive a compressed bytea from the client, and you have to uncompress it before you can work with it. + This extension is for that. diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 0000000..a285b1d --- /dev/null +++ b/debian/control.in @@ -0,0 +1,17 @@ +Source: pgsql-gzip +Section: database +Priority: optional +Maintainer: Paul Ramsey +Uploaders: Oleksandr Kylymnychenko , +Build-Depends: debhelper (>= 9), postgresql-server-dev-all (>= 153~) +Standards-Version: 4.5.0 +Vcs-Browser: https://github.com/pramsey/pgsql-gzip +Vcs-Git: https://github.com/pramsey/pgsql-gzip.git + +Package: postgresql-PGVERSION-gzip +Architecture: any +Depends: postgresql-12, ${misc:Depends}, ${shlibs:Depends} +Description: PostgreSQL extension code + Sometimes you just need to compress your bytea object before you return it to the client. + Sometimes you receive a compressed bytea from the client, and you have to uncompress it before you can work with it. + This extension is for that. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..db1ef7b --- /dev/null +++ b/debian/copyright @@ -0,0 +1,24 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pgsql-gzip +#Source: @URL@ + +Files: * +Copyright: Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group + Portions Copyright (c) 1994, The Regents of the University of California +License: PostgreSQL + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose, without fee, and without a written agreement + is hereby granted, provided that the above copyright notice and this + paragraph and the following two paragraphs appear in all copies. + . + IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING + LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS + DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + . + THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO + PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml new file mode 100644 index 0000000..67e4816 --- /dev/null +++ b/debian/gitlab-ci.yml @@ -0,0 +1 @@ +include: https://salsa.debian.org/postgresql/postgresql-common/raw/master/gitlab/gitlab-ci.yml diff --git a/debian/pgversions b/debian/pgversions new file mode 100644 index 0000000..0702cb5 --- /dev/null +++ b/debian/pgversions @@ -0,0 +1 @@ +all diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..440de50 --- /dev/null +++ b/debian/rules @@ -0,0 +1,19 @@ +#!/usr/bin/make -f + +# Makefile only uses -Wno-maybe-uninitialized (needed on Ubuntu ppc64el) if CC=gcc +export CC = gcc + +include /usr/share/postgresql-common/pgxs_debian_control.mk + +override_dh_auto_build: + +override_dh_auto_test: + +override_dh_auto_install: + +pg_buildext loop postgresql-%v-gzip + +override_dh_installdocs: + dh_installdocs --all README.* + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..b0dc4e8 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Depends: @, postgresql-server-dev-all +Tests: installcheck +Restrictions: allow-stderr diff --git a/debian/tests/installcheck b/debian/tests/installcheck new file mode 100755 index 0000000..32dafbc --- /dev/null +++ b/debian/tests/installcheck @@ -0,0 +1,2 @@ +#!/bin/sh +pg_buildext installcheck diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..41455b5 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +#version=4 +#https://github.com/pramsey/pgsql-gzip/releases .*/v(.*).tar.gz