Skip to content

Commit

Permalink
[deb] build packages for Ubuntu/Debian (#3)
Browse files Browse the repository at this point in the history
* [deb] build packages for Ubuntu/Debian

* [deb] add full name and fix repo path

* allow docker build without pg dependencies

Co-authored-by: Yuri Astrakhan <[email protected]>
  • Loading branch information
olksdr and nyurik authored Mar 20, 2020
1 parent 33b640b commit 7c26e8b
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ tmp_check/
tmp_check_iso/
output_iso/
log/
target/
build*
*.bc
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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 .
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path to package>.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.
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pgsql-gzip (1.0.0) unstable; urgency=medium

* Initial release of the DEB package

-- Oleksandr Kylymnychenko <[email protected]> Fri, 20 Mar 2020 13:18:29 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
17 changes: 17 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Source: pgsql-gzip
Section: database
Priority: optional
Maintainer: Paul Ramsey <[email protected]>
Uploaders: Oleksandr Kylymnychenko <[email protected]>,
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.
17 changes: 17 additions & 0 deletions debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Source: pgsql-gzip
Section: database
Priority: optional
Maintainer: Paul Ramsey <[email protected]>
Uploaders: Oleksandr Kylymnychenko <[email protected]>,
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.
24 changes: 24 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions debian/gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: https://salsa.debian.org/postgresql/postgresql-common/raw/master/gitlab/gitlab-ci.yml
1 change: 1 addition & 0 deletions debian/pgversions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
all
19 changes: 19 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -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 $@
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
3 changes: 3 additions & 0 deletions debian/tests/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Depends: @, postgresql-server-dev-all
Tests: installcheck
Restrictions: allow-stderr
2 changes: 2 additions & 0 deletions debian/tests/installcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
pg_buildext installcheck
2 changes: 2 additions & 0 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#version=4
#https://github.com/pramsey/pgsql-gzip/releases .*/v(.*).tar.gz

0 comments on commit 7c26e8b

Please sign in to comment.