changeset 6:d3545ac68b18

added debian packaging
author Simon Horman <horms@verge.net.au>
date Tue, 14 May 2002 10:38:00 +0900
parents 7964a2a26d75
children 385e4e7f7daa
files README configure.in debian/.cvsignore debian/Makefile.am debian/changelog debian/control debian/copyright debian/dpkg-checkbuild debian/perdition.conffiles debian/perdition.dirs debian/perdition.files debian/perdition.postinst debian/perdition.postrm debian/perdition.prerm debian/rules
diffstat 15 files changed, 472 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue May 14 10:19:08 2002 +0900
+++ b/README	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,49 @@
+README
+
+perdition-pbs
+POP before SMTP Tools
+Copyright (C) 2002  Horms <horms@vergenet.net>
+
+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.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc., 59
+Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
+----------------------------------------------------------------------
+
+
+Perdition-PBS is toolkit to provide pop before smtp support. It may be used
+with any pop server that provides logs that include the connection's source
+IP address when a user is authenticated. This includes perdition itself. At
+this stage the sendmail and qmail SMTP servers are supported. 
+
+perdition-pbs(8)
+
+
+LIBRARY REQUIREMENTS
+
+perdition requires the popt options parsing library available from
+ftp://ftp.rpm.org/pub/rpm/ and mirrors.
+
+popt requires gettext, the GNU internationalisation library available
+ftp://ftp.gnu.org/pub/gnu/gettext/ and mirrors.
+    
+perdition requires the vanessa_logger generic logging library
+available from
+ftp://ftp.vergenet.net/pub/vanessa/vanessa_logger/ and mirrors.
+
+perdition requires the vanessa_socket TCP socket interface library
+available from
+ftp://ftp.vergenet.net/pub/vanessa/vanessa_socket/ and mirrors.
+
+perdition requires the berkely DB library available from
+http://www.sleepycat.com/ and mirrors
--- a/configure.in	Tue May 14 10:19:08 2002 +0900
+++ b/configure.in	Tue May 14 10:38:00 2002 +0900
@@ -105,4 +105,5 @@
 etc/rc.d/Makefile 
 etc/rc.d/perdition-pbs.debian
 etc/rc.d/perdition-pbs.rh
+debian/Makefile
 INSTALL)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/.cvsignore	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+*.debhelper
+*.substvars
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/Makefile.am	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,40 @@
+######################################################################
+# Makefile.am                                            November 2000
+# Horms                                             horms@vergenet.net
+#
+# perdition
+# Mail retrieval proxy server
+# Copyright (C) 1999-2002  Horms <horms@vergenet.net>
+# 
+# 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.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307  USA
+#
+######################################################################
+
+EXTRA_DIST = \
+changelog \
+control \
+copyright \
+perdition.dirs \
+perdition.files \
+perdition.postinst \
+perdition.postrm \
+rules \
+dpkg-checkbuild
+
+clean-local:
+	rm -f *.substvars *.debhelper files
+	rm -r -f perdition perdition-dev perdition-ldap perdition-mysql \
+		perdition-postgresql tmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/changelog	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,10 @@
+perdition (0.0.0-1) unstable; urgency=low
+
+  * A release.
+
+ -- Simon Horman <horms@vergenet.net>  Tue, 14 May 2002 11:21:16 +1000
+
+Local variables:
+mode: debian-changelog
+End:
+eoch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/control	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,16 @@
+Source: perdition-pbs
+Build-Depends: libvanessa-logger-dev (>= 0.0.2), libvanessa-socket-dev (>= 0.0.3), libpopt-dev, libdb3-dev, debhelper, libtool, automake, gzip
+Section: non-US
+Priority: optional
+Maintainer: Simon Horman <horms@vergenet.net>
+Standards-Version: 3.5.2
+
+Package: perdition
+Architecture: any
+Depends: ${shlibs:Depends}
+Conflicts: libvanessa-socket0 (<= 0.0.3), libvanessa-adt0 (<= 0.0.2), libvanessa-logger0 (<= 0.0.2)
+Description: POP3 before SMTP Tool
+ Perdition-PBS is toolkit to provide pop before smtp support. It may be
+ used with any pop server that provides logs that include the connection's
+ source IP address when a user is authenticated. This includes perdition
+ itself. At this stage the sendmail and qmail SMTP servers are supported. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/copyright	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,20 @@
+perdition-pbs
+POP before SMTP Tools
+Copyright (C) 2002  Horms <horms@vergenet.net>
+
+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.
+
+The full text of this licence can be found in the file
+/usr/share/common-licenses/GPL ; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+This package is available by FTP from:
+ftp://ftp.vergenet.net/pub/perdition/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/dpkg-checkbuild	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,196 @@
+#!/usr/bin/perl -w
+# GPL copyright 2001 by Joey Hess <joeyh@debian.org>
+
+use strict;
+use Getopt::Long;
+
+sub usage {
+	print STDERR <<EOF;
+Usage: dpkg-checkbuild [-B] [control-file]
+	-B		binary-only, ignore -Indep
+	control-file	control file to process [Default: debian/control]
+EOF
+}
+
+my ($me)=$0=~m:.*/(.+):;
+
+my $binary_only=0;
+if (! GetOptions('-B' => \$binary_only)) {
+	usage();
+	exit(2);
+}
+my $control=shift || "debian/control";
+
+open (CONTROL, $control) || die "$control: $!\n";
+my @status=parse_status();
+my (@unmet, @conflicts);
+while (<CONTROL>) {
+	chomp;
+	last if $_ eq ''; # end of first stanza
+
+	if (/^Build-Depends:\s+(.*)/i) {
+		push @unmet, build_depends($1, @status);
+	}
+	elsif (/^Build-Conflicts:\s+(.*)/i) {
+		push @conflicts, build_conflicts($1, @status);
+	}
+	elsif (! $binary_only && /^Build-Depends-Indep:\s+(.*)/i) {
+		push @unmet, build_depends($1, @status);
+	}
+	elsif (! $binary_only && /^Build-Conflicts-Indep:\s+(.*)/i) {
+		push @conflicts, build_conflicts($1, @status);
+	}
+}
+close CONTROL;
+
+if (@unmet) {
+	print STDERR "$me: Unmet build dependancies: ";
+	print STDERR join(", ", @unmet), "\n";
+}
+if (@conflicts) {
+	print STDERR "$me: Build conflicts: ";
+	print STDERR join(", ", @conflicts), "\n";
+}
+exit 1 if @unmet || @conflicts;
+
+# This part could be replaced. Silly little status file parser.
+# thanks to Matt Zimmerman. Returns two hash references that
+# are exactly what the other functions need...
+sub parse_status {
+	my $status=shift || "/var/lib/dpkg/status";
+	
+	my %providers;
+	my %version;
+	local $/ = '';
+	open(STATUS, "<$status") || die "$status: $!\n";
+	while (<STATUS>) {
+		next unless /^Status: .*ok installed$/m;
+	
+		my ($package) = /^Package: (.*)$/m;
+		push @{$providers{$package}}, $package;
+		($version{$package}) = /^Version: (.*)$/m;
+	
+		if (/^Provides: (.*)$/m) {
+			foreach (split(/,\s+/, $1)) {
+				push @{$providers{$_}}, $package;
+			}
+		}
+	}
+	close STATUS;
+
+	return \%version, \%providers;
+}
+
+# This function checks the build dependancies passed in as the first
+# parameter. If they are satisfied, returns false. If they are unsatisfied,
+# an list of the unsatisfied depends is returned.
+#
+# Additional parameters that must be passed:
+# * A reference to a hash of all "ok installed" the packages on the system,
+#   with the hash key being the package name, and the value being the 
+#   installed version.
+# * A reference to a hash, where the keys are package names, and the
+#   value is a true value iff some package installed on the system provides
+#   that package (all installed packages provide themselves)
+#
+# Optionally, the architecture the package is to be built for can be passed
+# in as the 4th parameter. If not set, dpkg will be queried for the build
+# architecture.
+sub build_depends {
+	return check_line(1, @_);
+}
+
+# This function is exactly like unmet_build_depends, except it
+# checks for build conflicts, and returns a list of the packages
+# that are installed and are conflicted with.
+sub build_conflicts {
+	return check_line(0, @_);
+}
+
+# This function does all the work. The first parameter is 1 to check build
+# deps, and 0 to check build conflicts.
+sub check_line {
+	my $build_depends=shift;
+	my $line=shift;
+	my %version=%{shift()};
+	my %providers=%{shift()};
+	my $build_arch=shift || `dpkg --print-architecture`;
+	chomp $build_arch;
+
+	my @unmet=();
+	foreach my $dep (split(/,\s+/, $line)) {
+		my $ok=0;
+		my @possibles=();
+ALTERNATE:	foreach my $alternate (split(/\s*\|\s*/, $dep)) {
+			my ($package, $rest)=split(/\s+/, $alternate, 2);
+	
+			# Check arch specifications.
+			if (defined $rest && $rest=~m/\[(.*?)\]/) {
+				my $arches=lc($1);
+				my $seen_arch='';
+				foreach my $arch (split(' ', $arches)) {
+					if ($arch eq $build_arch) {
+						$seen_arch=1;
+						next;
+					}
+					elsif ($arch eq "!$build_arch") {
+						next ALTERNATE;
+					}
+					elsif ($arch =~ /!/) {
+						# This is equivilant to
+						# having seen the current arch,
+						# unless the current arch
+						# is also listed..
+						$seen_arch=1;
+					}
+				}
+				if (! $seen_arch) {
+					next;
+				}
+			}
+			
+			# This is a possibile way to meet the dependancy.
+			# Remove the arch stuff from $alternate.
+			$alternate=~s/\s+\[.*?\]//;
+			push @possibles, $alternate;
+	
+			# Check version.
+			if (defined $rest && $rest=~m/\((..)\s+(.*?)\)/) {
+				my $relation=$1;
+				my $version=$2;
+				
+				if (! exists $version{$package}) {
+					# Not installed at all, so fail.
+					next;
+				}
+				else {
+					# Compare installed and needed
+					# version number.
+					system("dpkg", "--compare-versions",
+						$version{$package}, $relation,
+						 $version);
+					if (($? >> 8) != 0) {
+						next; # fail
+					}
+				}
+			}
+			elsif (! defined $providers{$package}) {
+				# It's not a versioned dependancy, and
+				# nothing provides it, so fail.
+				next;
+			}
+	
+			# If we get to here, the dependancy was met.
+			$ok=1;
+		}
+	
+		if (@possibles && (($build_depends && ! $ok) ||
+		                   (! $build_depends && $ok))) {
+			# TODO: this could return a more complex
+			# data structure instead to save re-parsing.
+			push @unmet, join (" | ", @possibles);
+		}
+	}
+
+	return @unmet;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/perdition.conffiles	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,1 @@
+/etc/init.d/perdition-pbs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/perdition.dirs	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,1 @@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/perdition.files	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,14 @@
+etc/init.d/perdition-pbs
+usr/sbin/perdition-pbs
+usr/sbin/perdition-pbs-daemon
+usr/sbin/perdition-pbs-list
+usr/sbin/perdition-pbs-insert
+usr/sbin/perdition-pbs-remove
+usr/sbin/perdition-pbs-setenv
+usr/sbin/perdition-pbs-purge
+/usr/share/man/man8/perdition-pbs-daemon.8
+/usr/share/man/man8/perdition-pbs-list.8
+/usr/share/man/man8/perdition-pbs-insert.8
+/usr/share/man/man8/perdition-pbs-remove.8
+/usr/share/man/man8/perdition-pbs-setenv.8
+/usr/share/man/man8/perdition-pbs-purge.8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/perdition.postinst	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,16 @@
+#! /bin/sh
+# postinst script for perdition-pbs
+
+#DEBHELPER#
+
+if [ "$1" = "configure" ]; then
+    ldconfig
+    if [ -d /usr/doc -a ! -e /usr/doc/perdition-pbs -a -d /usr/share/doc/perdition-pbs ]; then
+      ln -sf ../share/doc/perdition-pbs /usr/doc/perdition-pbs
+    fi
+    update-rc.d perdition-pbs defaults >/dev/null
+fi
+
+exit 0
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/perdition.postrm	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,13 @@
+#! /bin/sh
+# postrm script for perdition-pbs
+
+#DEBHELPER#
+
+if [ "$1" = "remove" ]; then
+	ldconfig
+	update-rc.d -f perdition-pbs remove >/dev/null
+fi
+
+exit 0
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/perdition.prerm	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,8 @@
+#! /bin/sh
+# prerm script for perdition
+
+#DEBHELPER#
+
+exit 0
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/rules	Tue May 14 10:38:00 2002 +0900
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+export DH_COMPAT=2
+
+pwd:=$(shell pwd)
+cfg:=--prefix=/usr --sysconfdir=/etc --with-group=nogroup --mandir=/usr/share/man
+
+build: checkbuild build-stamp
+build-stamp:
+	dh_testdir
+	./configure $(cfg)
+	# Lame libtool workaround that lintian seems keen on
+	sed < libtool > libtool-2 \
+		-e 's/^hardcode_libdir_flag_spec.*$$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' \
+		-e '/^archive_cmds="/s/"$$/ \\$$deplibs"/'
+	mv libtool-2 libtool 
+	chmod 755 libtool
+	$(MAKE)
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	-$(MAKE) distclean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	$(MAKE) \
+	  DESTDIR=$(pwd)/debian/tmp \
+  	  install
+
+	./mkinstalldirs $(pwd)/debian/tmp/etc/init.d
+	install -c -m 755 etc/rc.d/init.d/perdition-pbs.debian \
+	  $(pwd)/debian/tmp/etc/init.d/perdition-pbs
+
+	./mkinstalldirs $(pwd)/debian/tmp/usr/share/doc/perdition-pbs
+	install -c -m 644 README \
+	  $(pwd)/debian/tmp/usr/share/doc/perdition-pbs/README
+	gzip --best $(pwd)/debian/tmp/usr/share/doc/perdition-pbs/README
+	install -c -m 644 ChangeLog \
+	  $(pwd)/debian/tmp/usr/share/doc/perdition-pbs/changelog
+	gzip --best $(pwd)/debian/tmp/usr/share/doc/perdition-pbs/changelog
+	install -c -m 644 TODO \
+	  $(pwd)/debian/tmp/usr/share/doc/perdition-pbs/TODO
+	gzip --best $(pwd)/debian/tmp/usr/share/doc/perdition-pbs/TODO
+
+	dh_movefiles --source=debian/tmp
+
+binary-indep: build install
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installchangelogs
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+
+checkbuild:
+	chmod u+x ./debian/dpkg-checkbuild
+	./debian/dpkg-checkbuild debian/control
+
+.PHONY: build clean binary-indep binary-arch binary install checkbuild