summaryrefslogtreecommitdiffstats
path: root/dh_make_pgxs
diff options
context:
space:
mode:
Diffstat (limited to 'dh_make_pgxs')
-rw-r--r--dh_make_pgxs/debian/control.in23
-rw-r--r--dh_make_pgxs/debian/copyright24
-rw-r--r--dh_make_pgxs/debian/gitlab-ci.yml1
-rw-r--r--dh_make_pgxs/debian/pgversions1
-rwxr-xr-xdh_make_pgxs/debian/rules36
-rw-r--r--dh_make_pgxs/debian/source/format1
-rw-r--r--dh_make_pgxs/debian/tests/control5
-rwxr-xr-xdh_make_pgxs/debian/tests/installcheck3
-rw-r--r--dh_make_pgxs/debian/watch2
-rwxr-xr-xdh_make_pgxs/dh_make_pgxs136
-rw-r--r--dh_make_pgxs/dh_make_pgxs.pod43
11 files changed, 275 insertions, 0 deletions
diff --git a/dh_make_pgxs/debian/control.in b/dh_make_pgxs/debian/control.in
new file mode 100644
index 0000000..090ac72
--- /dev/null
+++ b/dh_make_pgxs/debian/control.in
@@ -0,0 +1,23 @@
+Source: @SOURCE@
+Section: database
+Priority: optional
+Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
+Uploaders:
+ @MAINTAINER_NAME@ <@DEBEMAIL@>,
+Build-Depends:
+ debhelper-compat (= @COMPAT@),
+ postgresql-all (>= 217~),
+Standards-Version: @STANDARDS_VERSION@
+Rules-Requires-Root: no
+Homepage: @URL@
+Vcs-Browser: https://salsa.debian.org/postgresql/@SOURCE@
+Vcs-Git: https://salsa.debian.org/postgresql/@SOURCE@.git
+
+Package: postgresql-PGVERSION-@EXTNAME@
+Architecture: any
+Depends:
+ ${misc:Depends},
+ ${postgresql:Depends},
+ ${shlibs:Depends},
+Description: FIXME PostgreSQL extension @SOURCE@
+ FIXME long description here
diff --git a/dh_make_pgxs/debian/copyright b/dh_make_pgxs/debian/copyright
new file mode 100644
index 0000000..60ca5f0
--- /dev/null
+++ b/dh_make_pgxs/debian/copyright
@@ -0,0 +1,24 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: @NAME@
+Source: @URL@
+
+Files: *
+Copyright: Portions Copyright (c) 1996-@YEAR@, 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/dh_make_pgxs/debian/gitlab-ci.yml b/dh_make_pgxs/debian/gitlab-ci.yml
new file mode 100644
index 0000000..67e4816
--- /dev/null
+++ b/dh_make_pgxs/debian/gitlab-ci.yml
@@ -0,0 +1 @@
+include: https://salsa.debian.org/postgresql/postgresql-common/raw/master/gitlab/gitlab-ci.yml
diff --git a/dh_make_pgxs/debian/pgversions b/dh_make_pgxs/debian/pgversions
new file mode 100644
index 0000000..0702cb5
--- /dev/null
+++ b/dh_make_pgxs/debian/pgversions
@@ -0,0 +1 @@
+all
diff --git a/dh_make_pgxs/debian/rules b/dh_make_pgxs/debian/rules
new file mode 100755
index 0000000..5c0ff40
--- /dev/null
+++ b/dh_make_pgxs/debian/rules
@@ -0,0 +1,36 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@ --with pgxs
+
+override_dh_installdocs:
+ dh_installdocs --all README.*
+
+# if the package does not support building from subdirectories, use
+# `--with pgxs_loop` above.
+#
+# change the way tests are run:
+# override_dh_pgxs_test:
+# +pg_buildext installcheck . . postgresql-%v-@EXTNAME@
+
+# classic `pg_buildext` interface:
+
+#include /usr/share/postgresql-common/pgxs_debian_control.mk
+#
+#override_dh_auto_build:
+# +pg_buildext build build-%v
+#
+#override_dh_auto_test:
+# # nothing to do here, see debian/tests/* instead
+#
+#override_dh_auto_install:
+# +pg_buildext install build-%v postgresql-%v-@EXTNAME@
+#
+#override_dh_installdocs:
+# dh_installdocs --all README.*
+#
+#override_dh_auto_clean:
+# +pg_buildext clean build-%v
+#
+#%:
+# dh $@
diff --git a/dh_make_pgxs/debian/source/format b/dh_make_pgxs/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/dh_make_pgxs/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/dh_make_pgxs/debian/tests/control b/dh_make_pgxs/debian/tests/control
new file mode 100644
index 0000000..74b0464
--- /dev/null
+++ b/dh_make_pgxs/debian/tests/control
@@ -0,0 +1,5 @@
+Depends:
+ make,
+ @,
+Tests: installcheck
+Restrictions: allow-stderr
diff --git a/dh_make_pgxs/debian/tests/installcheck b/dh_make_pgxs/debian/tests/installcheck
new file mode 100755
index 0000000..5a20e78
--- /dev/null
+++ b/dh_make_pgxs/debian/tests/installcheck
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pg_buildext installcheck
diff --git a/dh_make_pgxs/debian/watch b/dh_make_pgxs/debian/watch
new file mode 100644
index 0000000..acfb2a8
--- /dev/null
+++ b/dh_make_pgxs/debian/watch
@@ -0,0 +1,2 @@
+version=4
+@URL@/tags .*/(.*).tar.gz
diff --git a/dh_make_pgxs/dh_make_pgxs b/dh_make_pgxs/dh_make_pgxs
new file mode 100755
index 0000000..6c59b8a
--- /dev/null
+++ b/dh_make_pgxs/dh_make_pgxs
@@ -0,0 +1,136 @@
+#!/bin/bash
+
+# (C) 2015-2020 Christoph Berg <myon@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+set -eu
+
+# basic variables
+
+template_dir="/usr/share/postgresql-common/dh_make_pgxs/debian"
+
+DIRECTORY="$(basename $PWD)"
+NAME="${DIRECTORY%-*}" # Upstream name
+VERSION="${DIRECTORY##*-}"
+URL="https://FIXME/$NAME"
+
+# options
+
+while getopts "fh:n:v:" opt ; do
+ case $opt in
+ f) FORCE=yes ;;
+ h) URL="$OPTARG" ;;
+ n) NAME="$OPTARG" ;;
+ v) VERSION="$OPTARG" ;;
+ *) exit 5 ;;
+ esac
+done
+shift $((OPTIND - 1)) # shift away args
+
+# more variables
+
+SOURCE="${NAME//_/-}" # Debian name
+EXTNAME="$(echo $SOURCE | sed -e 's/^\(postgresql\|pgsql\|pg\)-//')" # binary package name suffix
+DHVERSION="$(dpkg-query --showformat '${Version}' --show debhelper)"
+COMPAT="${DHVERSION%%.*}"
+STANDARDS_VERSION="$(apt-cache show debian-policy | sed -n 's/Version: \(.*\)\..*/\1/p' | head -n1)"
+USERNAME=${LOGNAME:-${USER:-root}}
+MAINTAINER_NAME=$(getent passwd $USERNAME | cut -d : -f 5 | sed -e 's/,.*//')
+: ${DEBEMAIL:=$USERNAME@localhost}
+YEAR=$(date +%Y)
+
+echo "Upstream (-n): $NAME"
+echo "Version (-v): $VERSION"
+echo "Source: $SOURCE ($VERSION-1)"
+echo "Binaries: postgresql-PGVERSION-$EXTNAME ($VERSION-1)"
+echo "Uploader: $MAINTAINER_NAME <$DEBEMAIL>"
+echo "Homepage (-h): $URL"
+echo
+if [ -t 0 ]; then
+ echo -n "Press Enter to continue, ^C to abort "
+ read
+fi
+
+# install files
+
+install_dir ()
+{
+ local directory="debian/$1"
+ #[ -z "$directory" ] && return
+ [ -d "$directory" ] && return
+ echo "Creating $directory/"
+ mkdir "$directory"
+}
+
+install_template ()
+{
+ local template="$1"
+
+ if [ "${FORCE:-}" ] || ! [ -e debian/$template ]; then
+ echo "Installing debian/$template"
+ sed -e "s/@COMPAT@/$COMPAT/g" \
+ -e "s/@EXTNAME@/$EXTNAME/g" \
+ -e "s/@NAME@/$NAME/g" \
+ -e "s/@STANDARDS_VERSION@/$STANDARDS_VERSION/g" \
+ -e "s/@SOURCE@/$SOURCE/g" \
+ -e "s/@MAINTAINER_NAME@/$MAINTAINER_NAME/g" \
+ -e "s/@DEBEMAIL@/$DEBEMAIL/g" \
+ -e "s;@URL@;$URL;g" \
+ -e "s/@YEAR@/$YEAR/g" \
+ "$template_dir/$template" > "debian/$template"
+ if [ -x $template_dir/$template ]; then
+ chmod +x "debian/$template"
+ fi
+ else
+ echo "Keeping existing debian/$template"
+ fi
+}
+
+mkdir -p debian
+
+for template in $(find $template_dir -mindepth 1 | sort); do
+ case $template in
+ *.swp|*~) continue ;; # skip vim stuff
+ esac
+ basename=${template##$template_dir/}
+ if [ -d $template ]; then
+ install_dir "$basename"
+ else
+ install_template "$basename"
+ fi
+done
+
+if [ "$COMPAT" -lt "12" ]; then
+ sed -i -e "s/debhelper-compat[^,]*/debhelper (>= $COMPAT)/" debian/control*
+ echo "$COMPAT" > debian/compat
+fi
+
+echo "Updating debian/control from debian/control.in"
+pg_buildext updatecontrol
+
+if [ "${FORCE:-}" ] || ! [ -e debian/changelog ]; then
+ rm -f debian/changelog
+ echo "Creating debian/changelog"
+ if [ -x /usr/bin/dch ]; then
+ dch --create --package "$SOURCE" --newversion "$VERSION-1"
+ else
+ cat > debian/changelog <<-EOT
+ $SOURCE ($VERSION-1) UNRELEASED; urgency=medium
+
+ * Initial release. (Closes: #XXXXXX)
+
+ -- $MAINTAINER_NAME <$DEBEMAIL> $(date -R)
+ EOT
+ fi
+else
+ echo "Keeping existing debian/changelog"
+fi
diff --git a/dh_make_pgxs/dh_make_pgxs.pod b/dh_make_pgxs/dh_make_pgxs.pod
new file mode 100644
index 0000000..8efd172
--- /dev/null
+++ b/dh_make_pgxs/dh_make_pgxs.pod
@@ -0,0 +1,43 @@
+=head1 NAME
+
+dh_make_pgxs - Create a new Debian source package for a PGXS PostgreSQL extension
+
+=head1 SYNOPSIS
+
+B<dh_make_pgxs> [B<-f>] [B<-h> I<URL>] [B<-n> I<name>] [B<-v> I<version>]
+
+=head1 DESCRIPTION
+
+B<dh_make_pgxs> creates a F<debian/> directory tree for PostgreSQL extension
+packages using the PGXS build system. The B<pg_buildext> tool is used for the
+build process.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-f>
+
+Overwrite existing files.
+
+=item B<-h> I<URL>
+
+Package upstream homepage.
+
+=item B<-n> I<name>
+
+Package name to use. Default is to extract it from the current directory's name.
+
+=item B<-v> I<version>
+
+Package version to use. Default is to extract it from the current directory's name.
+
+=back
+
+=head1 SEE ALSO
+
+dh_make(1), pg_buildext(1).
+
+=head1 AUTHOR
+
+Christoph Berg L<E<lt>myon@debian.orgE<gt>>