Commit 176174e3 authored by Roger Leigh's avatar Roger Leigh

Initial import into git from sbuild.git

parents
*~
*.1
*.5
*.7
*.8
*-stamp
Makefile
Makefile.in
ChangeLog
config.h
config.h.in
config.log
config.status
stamp-h1
aclocal.m4
autom4te.cache
configure
m4
INSTALL
*.o
.deps
.libs
*.tar.*
\#*
.#*
The list of contributors, in alphabetical order, is as follows. The
principal areas that each contributed to are listed in addition.
Roger Leigh <rleigh@debian.org>
initial implementation in C++ (based on
PostgreSQLcontrib/citext and James Troup's sql-aptvc.cc)
SQL wrapper code (based on contrib/citext)
autotools
This diff is collapsed.
# postgresql-debversion Makefile template
#
#
# Copyright © 2004-2009 Roger Leigh <rleigh@debian.org>
#
# postgresql-debversion 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 3 of
# the License, or (at your option) any later version.
#
# postgresql-debversion 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
#####################################################################
SUBDIRS = debversion
dist-hook:
# Remove junk from the generated tarball.
$(FIND) $(distdir) -name '.*' -print | $(XARGS) xargs $(RM) -rf
$(FIND) $(distdir) -name '#*' -print | $(XARGS) $(RM) -rf
$(FIND) $(distdir) -name '*~' -print | $(XARGS) $(RM) -rf
# Generate ChangeLog
if [ -d .git ]; then \
git log > $(distdir)/ChangeLog; \
fi
EXTRA_DIST = \
bootstrap \
debian \
scripts/debversion_release.m4.in
DISTCHECK_CONFIGURE_FLAGS = \
--enable-pg-server-libdir=\$${prefix}/postgresql/lib \
--enable-pg-server-sharedir=\$${prefix}/postgresql/share
NEWS -*- outline -*-
----
Welcome to postgresql-debversion 1.0.0. Please read these release
notes carefully.
Full installation instructions are provided in the INSTALL file. The
README file also contains more specific notes regarding building and
configuration.
* Major changes in 1.0.0:
1) Initial revision.
postgresql-debversion
=====================
Build Dependencies
------------------
You will need libapt-pkg and the PostgreSQL server development
headers and libraries installed.
Building
--------
See INSTALL for the full instructions.
-- Roger Leigh <rleigh@debian.org> Wed, 04 Mar 2009 21:49:38 +0000
\ No newline at end of file
#!/bin/sh
if [ -d m4 ]; then
:
else
mkdir m4
fi
if [ -d scripts ]; then
:
else
mkdir scripts
fi
sed -e "s/@RELEASE_DATE@/`date '+%d %b %Y'`/" -e "s/@RELEASE_UDATE@/`date '+%s'`/" scripts/debversion_release.m4.in > m4/debversion_release.m4
# To satisfy automake
touch ChangeLog
echo "libtoolize"
libtoolize --force --copy
echo "aclocal -I m4"
aclocal -I m4
echo "autoheader"
autoheader
echo "automake"
automake --add-missing --gnu --force --copy
echo "autoconf"
autoconf
# -*- Autoconf -*-
# Copyright © 2004-2008 Roger Leigh <rleigh@debian.org>
#
# debversion 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 3 of the License, or
# (at your option) any later version.
#
# debversion 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
#####################################################################
#
# Process this file with autoconf to produce a configure script.
#
#####################################################################
pushdef([DEBVERSION_NAME], [debversion])
pushdef([DEBVERSION_MAJOR_VERSION], [1])
pushdef([DEBVERSION_MINOR_VERSION], [0])
pushdef([DEBVERSION_MICRO_VERSION], [0])
pushdef([DEBVERSION_EXTRA_VERSION], [])
pushdef([DEBVERSION_VERSION], DEBVERSION_MAJOR_VERSION.DEBVERSION_MINOR_VERSION.DEBVERSION_MICRO_VERSION[]DEBVERSION_EXTRA_VERSION)
dnl
dnl The minimum version of autoconf required.
AC_PREREQ(2.59)
dnl Initialise autoconf with the package name, version and
dnl bug-reporting address.
AC_INIT(DEBVERSION_NAME, DEBVERSION_VERSION, [buildd-tools-devel@lists.alioth.debian.org])
dnl For safety, check we are in the right directory by
dnl checking for a known unique file.
AC_CONFIG_SRCDIR([debversion/debversion.cc])
dnl Place auxilliary scripts here.
AC_CONFIG_AUX_DIR([scripts])
dnl Put macro definitions here.
AC_CONFIG_HEADER([config.h])
AC_COPYRIGHT(
[
Copyright © 2004-2009 Roger Leigh <rleigh@debian.org>
Parts of this configure script come from the 'configure.ac' file, and
are not based on freely-redistributable m4 macros; 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 3 of the License, or (at your option) any later version.
This software 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
])
[DEBVERSION_MAJOR_VERSION]=DEBVERSION_MAJOR_VERSION
[DEBVERSION_MINOR_VERSION]=DEBVERSION_MINOR_VERSION
[DEBVERSION_MICRO_VERSION]=DEBVERSION_MICRO_VERSION
[DEBVERSION_EXTRA_VERSION]=DEBVERSION_EXTRA_VERSION
[DEBVERSION_VERSION]=DEBVERSION_VERSION
popdef([DEBVERSION_MAJOR_VERSION])
popdef([DEBVERSION_MINOR_VERSION])
popdef([DEBVERSION_MICRO_VERSION])
popdef([DEBVERSION_EXTRA_VERSION])
popdef([DEBVERSION_NAME])
popdef([DEBVERSION_VERSION])
AC_SUBST([DEBVERSION_MAJOR_VERSION])
AC_SUBST([DEBVERSION_MINOR_VERSION])
AC_SUBST([DEBVERSION_MICRO_VERSION])
AC_SUBST([DEBVERSION_VERSION])
dnl Initialise automake stuff.
AM_INIT_AUTOMAKE([1.9 gnu check-news tar-pax])
AM_MAINTAINER_MODE
DEBVERSION_RELEASE_DATE
AC_MSG_CHECKING([whether to enable debugging messages])
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Enable debugging messages])],
[ case "${enableval}" in
yes) enable_debug="yes" ;;
no) enable_debug="no" ;;
unset) enable_debug="no" ;;
*) AC_MSG_RESULT([unknown])
AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac ],
[ enable_debug="no" ])
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" = "yes"; then
AC_DEFINE_UNQUOTED([DEBVERSION_DEBUG], [1], [Enable debugging])
fi
# Checks for programs.
AC_PROG_CXX
AC_LANG([C++])
AC_DISABLE_STATIC
AC_ENABLE_SHARED
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_PATH_PROG([PG_CONFIG], [pg_config])
AC_MSG_CHECKING([for PostgreSQL server include directory])
pg_server_includedir=`"$PG_CONFIG" --includedir-server`
AC_ARG_ENABLE([pg-server-includedir], [AS_HELP_STRING([--enable-pg-server-includedir], [PostgreSQL server include directory])],
[pg_server_includedir="${enableval}"])
AC_MSG_RESULT([$pg_server_includedir])
AC_SUBST([pg_server_includedir])
AC_MSG_CHECKING([for PostgreSQL server module directory])
pg_server_libdir=`"$PG_CONFIG" --pkglibdir`
AC_ARG_ENABLE([pg-server-libdir], [AS_HELP_STRING([--enable-pg-server-libdir], [PostgreSQL server module directory])],
[pg_server_libdir="${enableval}"])
AC_MSG_RESULT([$pg_server_libdir])
AC_SUBST([pg_server_libdir])
AC_MSG_CHECKING([for PostgreSQL architecture-independent support files directory])
pg_server_sharedir=`"$PG_CONFIG" --sharedir`
AC_ARG_ENABLE([pg-server-sharedir], [AS_HELP_STRING([--enable-pg-server-sharedir], [PostgreSQL architecture-independent support files directory])],
[pg_server_sharedir="${enableval}"])
AC_MSG_RESULT([$pg_server_sharedir])
AC_SUBST([pg_server_sharedir])
pg_contribdir="$pg_server_sharedir/contrib"
AC_SUBST([pg_contribdir])
AC_MSG_CHECKING([for debVS in -lapt-pkg])
saved_ldflags="${LDFLAGS}"
LDFLAGS="${LDFLAGS} -lapt-pkg"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <apt-pkg/debversion.h>],
[int result = debVS.CmpVersion ("1", "2");])],
[AC_MSG_RESULT([yes])
APT_PKG_LIBS="-lapt-pkg"],
[AC_MSG_RESULT([no])
AC_MSG_FAILURE([libapt-pkg (APT) is not installed, but is required by debversion])])
LDFLAGS="${saved_ldflags}"
AC_SUBST([APT_PKG_LIBS])
AM_CONDITIONAL([BUILD_DEBVERSION],
[test -x "$PG_CONFIG" && test -n "$APT_PKG_LIBS"])
dnl Configure which files to generate.
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([debversion/Makefile])
dnl Output the generated config.status script.
AC_OUTPUT
postgresql-8.3-debversion
files
build
install
*.substvars
*.log
postgresql-debversion (1.0.0-1) UNRELEASED; urgency=low
* Initial release.
-- Roger Leigh <rleigh@debian.org> Wed, 04 Mar 2009 21:32:14 +0000
Source: postgresql-debversion
Section: misc
Priority: extra
Maintainer: Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>
Uploaders: Michael Banck <mbanck@debian.org>, Roger Leigh <rleigh@debian.org>, Francesco Paolo Lovergine <frankie@debian.org>
Build-Depends: debhelper (>> 7.0.0), libapt-pkg-dev, postgresql-server-dev-8.3
Standards-Version: 3.8.0
Vcs-Browser: http://git.debian.org/?p=buildd-tools/postgresql-debversion.git
Vcs-Git: git://git.debian.org/git/buildd-tools/postgresql-debversion
Package: postgresql-8.3-debversion
Architecture: any
Depends: ${shlibs:Depends}
Description: Debian version number type for PostgreSQL
Debian version numbers, used to version Debian packages, have a
specified format, including specifications for how versions
should be compared in order to sort them. This package
provides a debversion type for PostgreSQL, including operators
for version comparison and index operator classes for creating
indexes on the debversion type.
postgresql-debversion is maintained by the Debian buildd-tools project team.
It was downloaded from
git://git.debian.org/git/buildd-tools/postgresql-debversion.git.
Team information and mailing list are available at
http://alioth.debian.org/projects/buildd-tools/.
Upstream Authors:
Roger Leigh - initial implementation based upon
the old
Copyright:
© 2009 Roger Leigh <rleigh@debian.org>
All program code, manuals, and documentation are licensed under the
terms of the GNU General Public License, version 3 or later:
postgresql-debversion 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 3 of
the License, or (at your option) any later version.
postgresql-debversion 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see
<http://www.gnu.org/licenses/>.
On Debian systems, the complete text of the GNU General Public
License, version 3, can be found in /usr/share/common-licenses/GPL-3.
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
debian/build/config.status: configure
dh_testdir
[ -r scripts/config.sub.orig ] || \
cp -f scripts/config.sub scripts/config.sub.orig
[ -r scripts/config.guess.orig ] || \
cp -f scripts/config.guess scripts/config.guess.orig
[ ! -r /usr/share/misc/config.sub ] || \
cp -f /usr/share/misc/config.sub scripts/config.sub
[ ! -r /usr/share/misc/config.guess ] || \
cp -f /usr/share/misc/config.guess scripts/config.guess
mkdir debian/build; \
cd debian/build; \
CFLAGS="$(CFLAGS)" ../../configure \
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/share \
--localstatedir=/var --mandir=\$${prefix}/share/man \
--with-postgresql
build: debian/build/config.status debian/build-stamp
debian/build-stamp: debian/build/config.status
dh_testdir
cd debian/build; \
$(MAKE) all
touch debian/build-stamp
clean:
dh_testdir
dh_testroot
rm -rf debian/build
rm -rf debian/install
rm -f debian/build-stamp
[ ! -r scripts/config.guess.orig ] || \
mv -f scripts/config.guess.orig scripts/config.guess || :
[ ! -r scripts/config.sub.orig ] || \
mv -f scripts/config.sub.orig scripts/config.sub || :
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
cd debian/build; \
$(MAKE) install DESTDIR=$(CURDIR)/debian/install
dh_install
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installchangelogs -i ChangeLog
dh_installdocs -i -A debian/cvslogs.old
dh_installexamples -i
dh_installman -i
dh_perl -i
dh_link -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -a
dh_testroot -a
dh_installchangelogs -a ChangeLog
dh_installdocs -a -A debian/cvslogs.old
dh_installexamples -a
dh_installman -a
dh_link -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
debversion.sql
*.la
*.lo
MODULES = debversion
DATA_built = debversion.sql
DATA = uninstall_debversion.sql
#REGRESS = debversion
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
CXXFLAGS := $(CPPFLAGS)
debversion.so: debversion.o
$(CXX) $(LDFLAGS) -shared -o $@ $^ -lapt-pkg
debversion.o: debversion.cc
$(COMPILE.cc) $(CFLAGS_SL) $(OUTPUT_OPTION) $<
# postgresql-debversion Makefile template
#
#
# Copyright © 2004-2009 Roger Leigh <rleigh@debian.org>
#
# postgresql-debversion 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 3 of
# the License, or (at your option) any later version.
#
# postgresql-debversion 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
#####################################################################
if BUILD_DEBVERSION
pg_server_lib_LTLIBRARIES = \
debversion.la
debversion_la_SOURCES = \
debversion.cc
debversion_la_CXXFLAGS = -I$(pg_server_includedir)
debversion_la_LDFLAGS = -module -avoid-version $(APT_PKG_LIBS)
pg_contrib_DATA = \
debversion.sql \
uninstall_debversion.sql
endif
debversion.sql: debversion.sql.in
sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@
CLEANFILES = \
debversion.sql
EXTRA_DIST = \
db.sql \
debversion.sql.in \
uninstall_debversion.sql \
Makefile-pgxs
/*
* debversion: PostgreSQL functions for debversion type
* Copyright © 2009 Roger Leigh <rleigh@debian.org>
* schroot 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 3 of the License, or
* (at your option) any later version.
*
* schroot 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*
*********************************************************************/
#include <apt-pkg/debversion.h>
extern "C"
{
#include <postgres.h>
#include <fmgr.h>
#include <access/hash.h>
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
extern Datum debversion_cmp (PG_FUNCTION_ARGS);
extern Datum debversion_hash (PG_FUNCTION_ARGS);
extern Datum debversion_eq (PG_FUNCTION_ARGS);
extern Datum debversion_ne (PG_FUNCTION_ARGS);
extern Datum debversion_gt (PG_FUNCTION_ARGS);
extern Datum debversion_ge (PG_FUNCTION_ARGS);
extern Datum debversion_lt (PG_FUNCTION_ARGS);
extern Datum debversion_le (PG_FUNCTION_ARGS);
extern Datum debversion_smaller (PG_FUNCTION_ARGS);
extern Datum debversion_larger (PG_FUNCTION_ARGS);
}
namespace
{
int32
debversioncmp (text *left,
text *right)
{
int32 result;
int32 lsize, rsize;
char *lstr, *rstr;
lsize = VARSIZE_ANY_EXHDR(left);
lstr = (char *) palloc(lsize+1);
memcpy(lstr, VARDATA_ANY(left), lsize);
lstr[lsize] = '\0';
rsize = VARSIZE_ANY_EXHDR(right);
rstr = (char *) palloc(rsize+1);
memcpy(rstr, VARDATA_ANY(right), rsize);
rstr[rsize] = '\0';
result = debVS.CmpVersion (lstr, rstr);
pfree (lstr);
pfree (rstr);
return (result);
}
}
extern "C"
{
PG_FUNCTION_INFO_V1(debversion_cmp);
Datum
debversion_cmp(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
int32 result;
result = debversioncmp(left, right);
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_INT32(result);
}
PG_FUNCTION_INFO_V1(debversion_hash);
Datum
debversion_hash(PG_FUNCTION_ARGS)
{
int32 txt_size;
text *txt = PG_GETARG_TEXT_PP(0);
char *str;
Datum result;
txt_size = VARSIZE_ANY_EXHDR(txt);
str = (char *) palloc(txt_size+1);
memcpy(str, VARDATA_ANY(txt), txt_size);
str[txt_size] = '\0';
result = hash_any((unsigned char *) str, txt_size);
pfree(str);
PG_FREE_IF_COPY(txt, 0);
PG_RETURN_DATUM(result);
}
PG_FUNCTION_INFO_V1(debversion_eq);
Datum
debversion_eq(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
bool result;
result = debversioncmp(left, right) == 0;
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_BOOL(result);
}
PG_FUNCTION_INFO_V1(debversion_ne);
Datum
debversion_ne(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
bool result;
result = debversioncmp(left, right) != 0;
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_BOOL(result);
}
PG_FUNCTION_INFO_V1(debversion_lt);
Datum
debversion_lt(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
bool result;
result = debversioncmp(left, right) < 0;
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_BOOL(result);
}
PG_FUNCTION_INFO_V1(debversion_le);
Datum
debversion_le(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
bool result;
result = debversioncmp(left, right) <= 0;
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_BOOL(result);
}
PG_FUNCTION_INFO_V1(debversion_gt);
Datum
debversion_gt(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
bool result;
result = debversioncmp(left, right) > 0;
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_BOOL(result);
}
PG_FUNCTION_INFO_V1(debversion_ge);
Datum
debversion_ge(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
bool result;
result = debversioncmp(left, right) >= 0;
PG_FREE_IF_COPY(left, 0);
PG_FREE_IF_COPY(right, 1);
PG_RETURN_BOOL(result);
}
PG_FUNCTION_INFO_V1(debversion_smaller);
Datum
debversion_smaller(PG_FUNCTION_ARGS)
{
text *left = PG_GETARG_TEXT_PP(0);
text *right = PG_GETARG_TEXT_PP(1);
text *result;
result = debversioncmp(left, right) < 0 ? left : right;
PG_RETURN_TEXT_P(result);
}
PG_FUNCTION_INFO_V1(debversion_larger);
Datum
debversion_larger(PG_FUNCTION_ARGS)
{