Skip to content

Commit 7c26e8b

Browse files
olksdrnyurik
andauthored
[deb] build packages for Ubuntu/Debian (#3)
* [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]>
1 parent 33b640b commit 7c26e8b

16 files changed

+140
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ tmp_check/
1212
tmp_check_iso/
1313
output_iso/
1414
log/
15+
target/
16+
build*
17+
*.bc

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM debian:sid
2+
3+
RUN apt-get update -qq && \
4+
apt-get install -y \
5+
build-essential \
6+
fakeroot \
7+
pkg-config \
8+
devscripts \
9+
zlib1g-dev \
10+
postgresql-server-dev-all
11+
12+
WORKDIR /build/pgsql-gzip

Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Make sure we do not run any code when using deb-in-docker target
2+
ifneq ($(MAKECMDGOALS),"deb-in-docker")
13

24
# Detect pkg-config on the path
35
PKGCONFIG := $(shell type -p pkg-config || echo NONE)
@@ -36,3 +38,18 @@ endif
3638
PGXS := $(shell $(PG_CONFIG) --pgxs)
3739
include $(PGXS)
3840

41+
endif
42+
43+
44+
.PHONY: deb
45+
deb:
46+
dpkg-buildpackage -B
47+
48+
.PHONY: deb-in-docker
49+
deb-in-docker: .image
50+
mkdir -p "$$(pwd)/target"
51+
docker run --rm -ti -v"$$(pwd)/target:/build" -v "$$(pwd):/build/pgsql-gzip" deb-builder make deb
52+
53+
.PHONY: .image
54+
.image:
55+
docker build -t deb-builder .

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,18 @@ To convert a `bytea` back into an equivalent `text` you must use the `encode()`
6464
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`.
6565

6666
If your `libz` is installed in a non-standard location, you may need to edit `ZLIB_PATH` in the `Makefile`.
67+
68+
#### Debain/Ubuntu
69+
70+
To build the DEB package make use you have following dependencies installed as well:
71+
72+
```bash
73+
> apt-get install build-essential fakeroot devscripts
74+
```
75+
76+
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`
77+
78+
79+
#### In Docker
80+
81+
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.

debian/changelog

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pgsql-gzip (1.0.0) unstable; urgency=medium
2+
3+
* Initial release of the DEB package
4+
5+
-- Oleksandr Kylymnychenko <[email protected]> Fri, 20 Mar 2020 13:18:29 +0000

debian/compat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

debian/control

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Source: pgsql-gzip
2+
Section: database
3+
Priority: optional
4+
Maintainer: Paul Ramsey <[email protected]>
5+
Uploaders: Oleksandr Kylymnychenko <[email protected]>,
6+
Build-Depends: debhelper (>= 9), postgresql-server-dev-all (>= 153~)
7+
Standards-Version: 4.5.0
8+
Vcs-Browser: https://github.com/pramsey/pgsql-gzip
9+
Vcs-Git: https://github.com/pramsey/pgsql-gzip.git
10+
11+
Package: postgresql-12-gzip
12+
Architecture: any
13+
Depends: postgresql-12, ${misc:Depends}, ${shlibs:Depends}
14+
Description: PostgreSQL extension code
15+
Sometimes you just need to compress your bytea object before you return it to the client.
16+
Sometimes you receive a compressed bytea from the client, and you have to uncompress it before you can work with it.
17+
This extension is for that.

debian/control.in

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Source: pgsql-gzip
2+
Section: database
3+
Priority: optional
4+
Maintainer: Paul Ramsey <[email protected]>
5+
Uploaders: Oleksandr Kylymnychenko <[email protected]>,
6+
Build-Depends: debhelper (>= 9), postgresql-server-dev-all (>= 153~)
7+
Standards-Version: 4.5.0
8+
Vcs-Browser: https://github.com/pramsey/pgsql-gzip
9+
Vcs-Git: https://github.com/pramsey/pgsql-gzip.git
10+
11+
Package: postgresql-PGVERSION-gzip
12+
Architecture: any
13+
Depends: postgresql-12, ${misc:Depends}, ${shlibs:Depends}
14+
Description: PostgreSQL extension code
15+
Sometimes you just need to compress your bytea object before you return it to the client.
16+
Sometimes you receive a compressed bytea from the client, and you have to uncompress it before you can work with it.
17+
This extension is for that.

debian/copyright

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: pgsql-gzip
3+
#Source: @URL@
4+
5+
Files: *
6+
Copyright: Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
7+
Portions Copyright (c) 1994, The Regents of the University of California
8+
License: PostgreSQL
9+
Permission to use, copy, modify, and distribute this software and its
10+
documentation for any purpose, without fee, and without a written agreement
11+
is hereby granted, provided that the above copyright notice and this
12+
paragraph and the following two paragraphs appear in all copies.
13+
.
14+
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
15+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
16+
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
17+
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
18+
POSSIBILITY OF SUCH DAMAGE.
19+
.
20+
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22+
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23+
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
24+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

debian/gitlab-ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: https://salsa.debian.org/postgresql/postgresql-common/raw/master/gitlab/gitlab-ci.yml

debian/pgversions

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
all

debian/rules

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/make -f
2+
3+
# Makefile only uses -Wno-maybe-uninitialized (needed on Ubuntu ppc64el) if CC=gcc
4+
export CC = gcc
5+
6+
include /usr/share/postgresql-common/pgxs_debian_control.mk
7+
8+
override_dh_auto_build:
9+
10+
override_dh_auto_test:
11+
12+
override_dh_auto_install:
13+
+pg_buildext loop postgresql-%v-gzip
14+
15+
override_dh_installdocs:
16+
dh_installdocs --all README.*
17+
18+
%:
19+
dh $@

debian/source/format

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (quilt)

debian/tests/control

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Depends: @, postgresql-server-dev-all
2+
Tests: installcheck
3+
Restrictions: allow-stderr

debian/tests/installcheck

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
pg_buildext installcheck

debian/watch

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#version=4
2+
#https://github.com/pramsey/pgsql-gzip/releases .*/v(.*).tar.gz

0 commit comments

Comments
 (0)