[Amavisadmin-svn] SF.net SVN: amavisadmin: [57] amavisadmin/branches/documentation_1_0
Status: Beta
Brought to you by:
streindl
From: <str...@us...> - 2007-01-28 12:24:11
|
Revision: 57 http://amavisadmin.svn.sourceforge.net/amavisadmin/?rev=57&view=rev Author: streindl Date: 2007-01-28 04:24:03 -0800 (Sun, 28 Jan 2007) Log Message: ----------- Merge from Trunk Modified Paths: -------------- amavisadmin/branches/documentation_1_0/docs/Makefile amavisadmin/branches/documentation_1_0/tools/reposInfo.pl amavisadmin/branches/documentation_1_0/webapp/build.xml amavisadmin/branches/documentation_1_0/webapp/src/java/amavisadmin.properties.in amavisadmin/branches/documentation_1_0/webapp/src/java/de/sreindl/amavisadmin/bo/VersionInfo.java Added Paths: ----------- amavisadmin/branches/documentation_1_0/AUTHORS amavisadmin/branches/documentation_1_0/NOTES amavisadmin/branches/documentation_1_0/README amavisadmin/branches/documentation_1_0/TODO amavisadmin/branches/documentation_1_0/db/postgres/create_tables.sql amavisadmin/branches/documentation_1_0/db/postgres/initial_load.sql amavisadmin/branches/documentation_1_0/tools/build_script.pl amavisadmin/branches/documentation_1_0/tools/version.pm Property Changed: ---------------- amavisadmin/branches/documentation_1_0/ amavisadmin/branches/documentation_1_0/docs/ Property changes on: amavisadmin/branches/documentation_1_0 ___________________________________________________________________ Name: svn:ignore - dist build SESSIONS.ser + AmavisAdmin* dist build SESSIONS.ser Copied: amavisadmin/branches/documentation_1_0/AUTHORS (from rev 56, amavisadmin/trunk/AUTHORS) =================================================================== --- amavisadmin/branches/documentation_1_0/AUTHORS (rev 0) +++ amavisadmin/branches/documentation_1_0/AUTHORS 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,2 @@ +Stephen Reindl <sr...@sr...> +Project Lead and Maintainer Copied: amavisadmin/branches/documentation_1_0/NOTES (from rev 56, amavisadmin/trunk/NOTES) =================================================================== --- amavisadmin/branches/documentation_1_0/NOTES (rev 0) +++ amavisadmin/branches/documentation_1_0/NOTES 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1 @@ +... please read the LICENSE and README files for details Copied: amavisadmin/branches/documentation_1_0/README (from rev 56, amavisadmin/trunk/README) =================================================================== --- amavisadmin/branches/documentation_1_0/README (rev 0) +++ amavisadmin/branches/documentation_1_0/README 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,11 @@ +AmavisAdmin +=========== + +This tool helps administrating data stored by Amavisd-new in an Postgres SQL +database. + +... more to come + +for installation details, please refer to docs/txt/installationguide.txt. + + Copied: amavisadmin/branches/documentation_1_0/TODO (from rev 56, amavisadmin/trunk/TODO) =================================================================== --- amavisadmin/branches/documentation_1_0/TODO (rev 0) +++ amavisadmin/branches/documentation_1_0/TODO 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,20 @@ +The following things are open -*- outline -*- + +* User Interface + The user interface might be overhauled or even replaced by something + different than now. Currently the user interface is build on Rave, an WebUI + based on JSF/JSP by Sun/Netbeans + +* Database +** Support for Black/Whitelisting +** Support for MySQL + +* Security +** Role based security settings +** JAAS enabled login (for enterprise integration) + +* Documentation +* User Guide + +* ... more to come + Copied: amavisadmin/branches/documentation_1_0/db/postgres/create_tables.sql (from rev 56, amavisadmin/trunk/db/postgres/create_tables.sql) =================================================================== --- amavisadmin/branches/documentation_1_0/db/postgres/create_tables.sql (rev 0) +++ amavisadmin/branches/documentation_1_0/db/postgres/create_tables.sql 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,156 @@ +-- This file is part of AmavisAdmin +-- +-- Copyright (C) 2007 Stephen Reindl +-- +-- create initial data model +-- +-- Table: users +CREATE TABLE users +( + id serial NOT NULL, + priority int4 NOT NULL DEFAULT 7, + policy_id int4 NOT NULL DEFAULT 1, + email varchar(255) NOT NULL, + fullname varchar(255), + "local" char(1), + CONSTRAINT users_pkey PRIMARY KEY (id), + CONSTRAINT users_email_key UNIQUE (email) +); + +-- Table: wblist +CREATE TABLE wblist +( + rid int4 NOT NULL, + sid int4 NOT NULL, + wb varchar(10) NOT NULL, + CONSTRAINT wblist_pkey PRIMARY KEY (rid, sid) +); + +-- Table: maddr +CREATE TABLE maddr +( + id serial NOT NULL, + email varchar(255) NOT NULL, + "domain" varchar(255) NOT NULL, + CONSTRAINT maddr_pkey PRIMARY KEY (id), + CONSTRAINT maddr_email_ux UNIQUE (email) +); + +-- Table: mailaddr +CREATE TABLE mailaddr +( + id serial NOT NULL, + priority int4 NOT NULL DEFAULT 7, + email varchar(255) NOT NULL, + CONSTRAINT mailaddr_pkey PRIMARY KEY (id), + CONSTRAINT mailaddr_email_ux UNIQUE (email) +); + +-- Table: policy +CREATE TABLE policy +( + id serial NOT NULL, + policy_name varchar(32), + virus_lover char(1), + spam_lover char(1), + banned_files_lover char(1), + bad_header_lover char(1), + bypass_virus_checks char(1), + bypass_spam_checks char(1), + bypass_banned_checks char(1), + bypass_header_checks char(1), + spam_modifies_subj char(1), + virus_quarantine_to varchar(64), + spam_quarantine_to varchar(64), + banned_quarantine_to varchar(64), + bad_header_quarantine_to varchar(64), + clean_quarantine_to varchar(64), + other_quarantine_to varchar(64), + spam_tag_level float8, + spam_tag2_level float8, + spam_kill_level float8, + spam_dsn_cutoff_level float8, + spam_quarantine_cutoff_level float8, + addr_extension_virus varchar(64), + addr_extension_spam varchar(64), + addr_extension_banned varchar(64), + addr_extension_bad_header varchar(64), + warnvirusrecip char(1), + warnbannedrecip char(1), + warnbadhrecip char(1), + newvirus_admin varchar(64), + virus_admin varchar(64), + banned_admin varchar(64), + bad_header_admin varchar(64), + spam_admin varchar(64), + spam_subject_tag varchar(64), + spam_subject_tag2 varchar(64), + message_size_limit int4, + banned_rulenames varchar(64), + CONSTRAINT policy_pkey PRIMARY KEY (id) +); + +-- Table: msgs +CREATE TABLE msgs +( + mail_id varchar(12) NOT NULL, + secret_id varchar(12) DEFAULT '', + am_id varchar(20) NOT NULL, + time_num int4 NOT NULL, + time_iso timestamptz NOT NULL, + sid int4 NOT NULL, + policy varchar(255) DEFAULT '', + client_addr varchar(255) DEFAULT '', + size int4 NOT NULL, + content char(1), + quar_type char(1), + quar_loc varchar(255) DEFAULT ''; + dsn_sent char(1), + spam_level float8, + message_id varchar(255) DEFAULT '', + from_addr varchar(255) DEFAULT '', + subject varchar(255) DEFAULT '', + host varchar(255) NOT NULL, + CONSTRAINT msgs_pkey PRIMARY KEY (mail_id), + CONSTRAINT msgs_sid_fkey FOREIGN KEY (sid) + REFERENCES maddr (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE RESTRICT +); + +-- Index: msgs_idx_sid +CREATE INDEX msgs_idx_sid ON msgs USING btree (sid); + +-- Index: msgs_idx_time_iso +CREATE INDEX msgs_idx_time_iso ON msgs USING btree (time_iso); + +-- Table: quarantine +CREATE TABLE quarantine +( + mail_id varchar(12) NOT NULL, + chunk_ind int4 NOT NULL, + mail_text bytea NOT NULL, + CONSTRAINT quarantine_pkey PRIMARY KEY (mail_id, chunk_ind), + CONSTRAINT quarantine_mail_id_fkey FOREIGN KEY (mail_id) + REFERENCES msgs (mail_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE CASCADE +); + +-- Table: msgrcpt +CREATE TABLE msgrcpt +( + mail_id varchar(12) NOT NULL, + rid int4 NOT NULL, + ds char(1) NOT NULL, + rs char(1) NOT NULL, + bl char(1) DEFAULT ' '::bpchar, + wl char(1) DEFAULT ' '::bpchar, + bspam_level float8, + smtp_resp varchar(255) DEFAULT '', + CONSTRAINT msgrcpt_pkey PRIMARY KEY (mail_id, rid), + CONSTRAINT msgrcpt_mail_id_fkey FOREIGN KEY (mail_id) + REFERENCES msgs (mail_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE CASCADE, + CONSTRAINT msgrcpt_rid_fkey FOREIGN KEY (rid) + REFERENCES maddr (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE RESTRICT +); \ No newline at end of file Copied: amavisadmin/branches/documentation_1_0/db/postgres/initial_load.sql (from rev 56, amavisadmin/trunk/db/postgres/initial_load.sql) =================================================================== --- amavisadmin/branches/documentation_1_0/db/postgres/initial_load.sql (rev 0) +++ amavisadmin/branches/documentation_1_0/db/postgres/initial_load.sql 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,80 @@ +-- This file is part of AmavisAdmin +-- +-- Copyright (C) 2007 Stephen Reindl +-- +-- Perform an intial load for an empty database + +-- insert standard policies. +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Non-paying', 'N','N','N','N', 'Y','Y','Y','N', 'Y', 3.0, 7, 10); + +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Uncensored', 'Y','Y','Y','Y', 'N','N','N','N', 'N', 3.0, 999, 999); + +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Wants all spam','N','Y','N','N', 'N','N','N','N', 'Y', 3.0, 999, 999); + +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Wants viruses', 'Y','N','Y','Y', 'N','N','N','N', 'Y', 3.0, 6.9, 6.9); + +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Normal', 'N','N','N','N', 'N','N','N','N', 'Y', 3.0, 6.9, 6.9); +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Trigger happy', 'N','N','N','N', 'N','N','N','N', 'Y', 3.0, 5, 5); + +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('Permissive', 'N','N','N','Y', 'N','N','N','N', 'Y', 3.0, 10, 20); + +INSERT + INTO policy + (policy_name, virus_lover, spam_lover, banned_files_lover, + bad_header_lover, bypass_virus_checks, bypass_spam_checks, + bypass_banned_checks, bypass_header_checks, spam_modifies_subj, + spam_tag_level, spam_tag2_level, spam_kill_level) +VALUES ('6.5/7.8', 'N','N','N','N', 'N','N','N','N', 'N', 3.0, 6.5, 7.8); + +-- insert a catchall user that will be used to +-- define the profile in case no other match +-- was done. +INSERT + INTO users + (priority, policy_id, email, local) + SELECT id, 5, '@.', 'N' + FROM policy + WHERE policy_name = 'Normal'; + Property changes on: amavisadmin/branches/documentation_1_0/docs ___________________________________________________________________ Name: svn:ignore - installationguide installationguide.txt installationguide.fo installationguide.manifest* installationguide.html installationguide.pdf + installationguide installationguide.txt installationguide.fo installationguide.manifest* installationguide.html installationguide.pdf user_guide user_guide.txt user_guide.fo user_guide.manifest* user_guide.html user_guide.pdf Modified: amavisadmin/branches/documentation_1_0/docs/Makefile =================================================================== --- amavisadmin/branches/documentation_1_0/docs/Makefile 2007-01-28 11:22:04 UTC (rev 56) +++ amavisadmin/branches/documentation_1_0/docs/Makefile 2007-01-28 12:24:03 UTC (rev 57) @@ -197,15 +197,15 @@ # ** stylesheet for testing whether a file has a refentry # ----------------------------------------------------------------- REFENTRY_CHECK := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \ - version="1.0" \ - xmlns:db="http://docbook.org/ns/docbook" \ - > \ - <xsl:output method="text"/> \ - <xsl:template match="/"> \ - <xsl:if test="//refentry|//db:refentry"> \ - <xsl:text>true</xsl:text> \ - </xsl:if> \ - </xsl:template> \ + version="1.0" \ + xmlns:db="http://docbook.org/ns/docbook" \ + > \ +<xsl:output method="text"/> \ +<xsl:template match="/"> \ +<xsl:if test="//refentry|//db:refentry"> \ +<xsl:text>true</xsl:text> \ +</xsl:if> \ +</xsl:template> \ </xsl:stylesheet> # ----------------------------------------------------------------- @@ -214,44 +214,48 @@ # # for DBLaTeX DBX_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \ - version="1.0"> \ - <xsl:param name="co.linkends.show">0</xsl:param> \ - <xsl:param name="callout.markup.circled">1</xsl:param> \ - <xsl:param name="callout.linkends.hot">0</xsl:param> \ - <xsl:param name="doc.publisher.show">1</xsl:param> \ - <xsl:param name="term.breakline">1</xsl:param> \ - <xsl:param name="doc.alignment">left</xsl:param> \ - <xsl:param name="newtbl.use">1</xsl:param> \ - <xsl:param name="latex.hyperparam"/> \ - <xsl:param name="latex.style">docbook</xsl:param> \ - <xsl:param name="latex.biblio.output">all</xsl:param> \ - <xsl:param name="latex.bibfiles">""</xsl:param> \ - <xsl:param name="latex.bibwidelabel">WIDELABEL</xsl:param> \ - <xsl:param name="latex.output.revhistory">0</xsl:param> \ - <xsl:param name="latex.figure.position">[htbp]</xsl:param> \ - <xsl:param name="latex.figure.boxed">0</xsl:param> \ - <xsl:param name="latex.babel.use">1</xsl:param> \ - <xsl:param name="latex.babel.language"></xsl:param> \ - <xsl:param name="latex.class.options">twoside</xsl:param> \ - <xsl:param name="biblioentry.item.separator">, </xsl:param> \ - <xsl:param name="refentry.xref.manvolnum">1</xsl:param> \ - <xsl:param name="refsynopsis.title">Synopsis</xsl:param> \ - <xsl:param name="refnamediv.title"></xsl:param> \ - <xsl:param name="funcsynopsis.style">ansi</xsl:param> \ - <xsl:param name="funcsynopsis.decoration">1</xsl:param> \ - <xsl:param name="function.parens">0</xsl:param> \ - <xsl:param name="classsynopsis.default.language">java</xsl:param> \ - <xsl:param name="show.comments">0</xsl:param> \ + version="1.0"> \ +<xsl:param name="co.linkends.show">0</xsl:param> \ +<xsl:param name="callout.markup.circled">1</xsl:param> \ +<xsl:param name="callout.linkends.hot">0</xsl:param> \ +<xsl:param name="doc.publisher.show">1</xsl:param> \ +<xsl:param name="term.breakline">1</xsl:param> \ +<xsl:param name="doc.alignment">left</xsl:param> \ +<xsl:param name="newtbl.use">1</xsl:param> \ +<xsl:param name="latex.hyperparam"/> \ +<xsl:param name="latex.style">docbook</xsl:param> \ +<xsl:param name="latex.biblio.output">all</xsl:param> \ +<xsl:param name="latex.bibfiles">""</xsl:param> \ +<xsl:param name="latex.bibwidelabel">WIDELABEL</xsl:param> \ +<xsl:param name="latex.output.revhistory">0</xsl:param> \ +<xsl:param name="latex.figure.position">[htbp]</xsl:param> \ +<xsl:param name="latex.figure.boxed">0</xsl:param> \ +<xsl:param name="latex.babel.use">1</xsl:param> \ +<xsl:param name="latex.babel.language"></xsl:param> \ +<xsl:param name="latex.class.options">twoside</xsl:param> \ +<xsl:param name="biblioentry.item.separator">, </xsl:param> \ +<xsl:param name="refentry.xref.manvolnum">1</xsl:param> \ +<xsl:param name="refsynopsis.title">Synopsis</xsl:param> \ +<xsl:param name="refnamediv.title"></xsl:param> \ +<xsl:param name="funcsynopsis.style">ansi</xsl:param> \ +<xsl:param name="funcsynopsis.decoration">1</xsl:param> \ +<xsl:param name="function.parens">0</xsl:param> \ +<xsl:param name="classsynopsis.default.language">java</xsl:param> \ +<xsl:param name="show.comments">0</xsl:param> \ </xsl:stylesheet> # for FO output FO_CUSTOM := <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \ - xmlns:fo="http://www.w3.org/1999/XSL/Format" \ - version="1.0"> \ - <xsl:import href="$(DOCBOOK_XSL)/fo/docbook.xsl"/> \ - <xsl:include href="cust/titlepage.templates.xsl"/> \ - <xsl:param name="$(PDF_MAKER).extensions">1</xsl:param> \ - <xsl:param name="paper.type">A4</xsl:param> \ + xmlns:fo="http://www.w3.org/1999/XSL/Format" \ + version="1.0"> \ +<xsl:import href="$(DOCBOOK_XSL)/fo/docbook.xsl"/> \ +<xsl:include href="cust/titlepage.templates.xsl"/> \ +<xsl:param name="$(PDF_MAKER).extensions">1</xsl:param> \ +<xsl:param name="paper.type">A4</xsl:param> \ +<xsl:param name="callout.unicode">1</xsl:param> \ +<xsl:param name="callout.graphics">0</xsl:param> \ +<xsl:param name="admon.graphics">1</xsl:param> \ +<xsl:param name="admon.graphics.extension">.svg</xsl:param> \ <xsl:param name="draft.watermark.image"></xsl:param> \ <xsl:param name="hyphenation">false</xsl:param> \ <xsl:param name="hyphenate.verbatim">0</xsl:param> \ Copied: amavisadmin/branches/documentation_1_0/tools/build_script.pl (from rev 56, amavisadmin/trunk/tools/build_script.pl) =================================================================== --- amavisadmin/branches/documentation_1_0/tools/build_script.pl (rev 0) +++ amavisadmin/branches/documentation_1_0/tools/build_script.pl 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,502 @@ +#!/usr/bin/perl -w + +# Script to create a target distribution +# + +# it creates a directory dist in the current directory and compiles a ready to +# use war file, database scripts and compiled documentation as well as API +# documentation into this folder. + +use strict; +use English; + +BEGIN { + push @INC, "tools"; # for the version stuff +} + +use version; + +use Getopt::Long; +use Pod::Usage; + +use Archive::Tar; +use File::Path; +use File::stat; +use File::Basename; +use File::Find; +use File::Copy; + +use Cwd; + +use Date::Format; + +use SVN::Client; + +sub createTar(); +sub copy_dir($); +sub replaceParams(); +sub copy_file($$); +sub copy_doc_dir(); +sub create_file_list(); + +my $distdir = "%p-v%V"; +my $cleandir = 0; +my $help=0; +my $man=0; +my $compressbzip2 = 0; +my $compressgzip = 0; +my $createtar=undef; + +GetOptions("path|p=s" => \$distdir, + "tar|t:s" => \$createtar, + "clean|c!" => \$cleandir, + "bzip2" => \$compressbzip2, + "gzip" => \$compressgzip, + "help|h" => \$help, + "man|m" => \$man) or pod2usage (2); +pod2usage(1) if ($help); +pod2usage(-exitstatus => 0, -verbose => 2) if ($man); + +my $_info; + +sub funcRev { + my( $path, $info, $pool ) = @_; + $_info = $info; +}; + +my $modified = ""; + +my $funcStatus = sub { + $modified = "-modified"; +}; + +my $ctx = SVN::Client->new(); + +my $cwd = getcwd(); +$ctx->info( $cwd, undef, undef, \&funcRev, 0 ); +$ctx->status( $cwd, undef, $funcStatus, 1, 0, 0, 0); +my $revision = $_info->rev; +my $branch="unknown"; + +my $url = $_info->URL; +if ($url =~ /trunk/) { + $branch="trunk"; +} elsif ($url =~ /branches\/([^\/]+)/) { + $branch="b-$1"; +} elsif ($url =~ /tags\/([^\/]+)/) { + $branch="$1"; +} + +replaceParams(); + +if (defined $createtar) { + if ($createtar eq "") { + $createtar = $distdir . ".tar"; + } +} +my $tempdir = "$distdir/temp"; + + +my %files = ("LICENSE" => "LICENSE", + "README" => "README", + "TODO" => "TODO", + "NOTES" => "NOTES", + "AUTHORS" => "AUTHORS", + "$tempdir/AmavisAdmin.war" => "AmavisAdmin.war", + "\@db" => "db", + "$tempdir/docs/installationguide.pdf" => "docs/pdf/installationguide.pdf", + "$tempdir/docs/installationguide.txt" => "docs/txt/installationguide.txt", + "\!$tempdir/docs/installationguide/" => 'docs/html/installationguide/', + ); + + +print "Output to $distdir\n"; +if (defined $createtar) { + print "Creating tar file $createtar\n"; +} + +if (-d "$distdir") { + if ($cleandir) { + my $stat = stat($distdir); + if ($stat->uid() != $UID) { + die "Cannot delete other user's file (security)"; + } + rmtree($distdir); + if (-d "$distdir") { + die "Cannot remove $distdir"; + } + } else { + die "$distdir does already exist"; + } +} + +mkpath ($distdir) or die "Cannot create directory $distdir"; + +# step 0 +# create intermediate directories which will be deleted afterwards +mkdir $tempdir; + +# step 1: run ant +my @antArgs=("-Dbuild.dir=" . getcwd() . "/$tempdir", + "-Ddist.dir=" . getcwd() . "/$tempdir", + "-buildfile", "webapp/build.xml", + "clean", + "dist"); + +system "ant", @antArgs; + +if ($? != 0) { + die "Build failed. Please check before continuing"; +} + +# step 2: documentation +copy_doc_dir (); +system "cd $tempdir/docs && touch *.xml && make clean && make"; + +if ($? != 0) { + die "Documentation build failed. Please check before continuing"; +} + +my $copydir_target = ""; +my $skip_dir = 0; + +# step 3: Copy/Move files +foreach my $file (keys %files) { + if ($file =~ /^@.*/) { + my $from_file = substr($file, 1); + copy_dir($from_file); + } elsif ($file =~ /^!.*/) { + # special dir + my $from_file = substr($file, 1); + $skip_dir = length ($from_file); + $copydir_target = $files{$file}; + copy_dir($from_file); + $copydir_target = ""; # reset dir target + } else { + copy_file($file, $files{$file}); + } +} + +# step 4: cleanup temp dir +rmtree ("$tempdir"); + + +# step 5: create CONTENTS file + +my @file_list = (); +create_file_list (); +open OUT, ">$distdir/CONTENTS" or die "Cannot create contents file ($!)"; +print OUT + "This file contains a list of all files included in this distribution.\n"; +print OUT + "Please read the file LICENSE!\n"; + +foreach my $line (@file_list) { + print OUT $line, "\n"; +} +close OUT; + +# step 6: Tar and compression +if (defined $createtar) { + createTar(); + + if ($compressbzip2) { + my $mod = "IO::Compress::Bzip2"; + unless (eval "require $mod") { + die "Bzip2 compression is required from here\n"; + } + use IO::Compress::Bzip2 qw (bzip2 $Bzip2Error); + bzip2 $createtar => $createtar . ".bz2" + or die "bzip2 failed: $Bzip2Error\n"; + unlink $createtar; # remove tar file + } elsif ($compressgzip) { + my $mod = "IO::Compress::Gzip"; + unless (eval "require $mod") { + die "Gzip compression is required from here\n"; + } + use IO::Compress::Gzip qw (gzip $GzipError); + gzip $createtar => $createtar . ".bz2" + or die "gzip failed: $GzipError\n"; + unlink $createtar; # remove tar file + } + # in case of tar output, remove the distribution directory. + rmtree "$distdir"; +} + + +exit 0; + +sub createTar() { + my $tar = Archive::Tar->new; + + $tar->add_files(@file_list); + + $tar->write($createtar) or die "Cannot create tar file ($!)"; +} + +sub file_list_item() { + my $file = $File::Find::name; + + if (-f "$file") { + push @file_list, $file; + } +} + +sub create_file_list() { + find ({wanted => \&file_list_item, no_chdir => 1 }, $distdir); +} + +sub callback_doc_file() { + my $name = $File::Find::name; + return if ($name =~ /\.svn/); + my $stat = lstat($name); + if (-l $name) { + my $link = readlink ($name); + symlink ($link, "$tempdir/$name"); + } elsif (-d $name) { + mkdir "$tempdir/$name"; + } else { + copy ($name, "$tempdir/$name"); + } +} + + +sub copy_doc_dir () { + find({wanted => \&callback_doc_file, no_chdir => 1 }, "docs"); +} + + +sub callback_single_file() { + my $name = $File::Find::name; + return if ($name =~ /\.svn/); + my $to = $name; + + if ($copydir_target ne "") { + $to = $copydir_target . substr ($name, $skip_dir); + } + + if (-d $name) { + mkpath "$distdir/$to" or die "Cannot create $distdir/$to ($!)"; + } else { + copy_file($name, $to); + } +} + +sub copy_dir($) { + my $path = shift; + find({wanted => \&callback_single_file, no_chdir => 1 }, $path); +} + +sub copy_file($$) { + my ($from, $to) = @_; + $to = "$distdir/$to"; + print "Copy $from -> $to\n"; + my $dir = dirname($to); + if (! -e "$dir") { + mkpath ($dir) or die "Cannot create $dir ($!)"; + } + copy ($from, $to) or die "Copy failed ($!)"; +} + +sub replaceParams() { + $distdir =~ s/\%V/\%v-r\%r-\%T\%m/g; + my $version = $version::AmavisVersion; + $distdir =~ s/\%v/$version/g; + $distdir =~ s/\%r/$revision/g; + my $datestamp=time2str("%Y-%m-%d", time()); + my $timestamp=time2str("%Y%m%d%I%M%S", time()); + $distdir =~ s/\%d/$datestamp/g; + $distdir =~ s/\%t/$timestamp/g; + $distdir =~ s/\%T/$branch/g; + $distdir =~ s/\%m/$modified/g; + $distdir =~ s/\%p/AmavisAdmin/g; +} + + +__END__ + +=head1 NAME + +build_script.pl - Create distribution for AmavisAdmin + +=head1 SYNOPSIS + +build_script.pl [options...] + + Options: + -path=path Destination directory + -clean Clean destination directory if exist + -tar=[file] Create tar output file + -bzip2 Compress output file as bzip2 + -gzip Compress output file as gzip + -help brief help message + -man full documentation + +=head1 OPTIONS + +=over 8 + +=item B<-path> + +You can specify a different output directory for the destination where +the build script will put it's output. For example the command + + B<tools/build_script.pl> -path=I</tmp/dist> + +will build the output into the directory F</tmp/dist>. + +If the target directory does already exist, the script will die with an +error. This can be prevented by using the L</-clean> option. + +The target directory might contain several special tokens which will be +replaced before creating the actual directory. The following tokens are +defined: + +=over 8 + +=item B<%p> + +This token will be replaced by the application name (e.g. B<AmavisAdmin>). + +=item B<%v> + +This token will be replaced by the version (taken from +F<tools/version.pm>). The version will be in the form +C<major.minor>, e.g. B<1.0>. + +=item B<%V> + +The token will be replaced by the full version number including SVN revision +and branch type together with the information, if the build is based on +modified sources. As this is used in filenames, the version string will +not contain any spaces. An example for B<%V> might look like this: + + 1.0-r123-alpha2-modified + +where C<1.0> is the same as given by B<%v>, the string C<r123> gives the +current SVN revision, C<alpha2> denotes the current tag (see the description +for B<%T> for details).In case the build is based on uncommitted changes to +the repository, the term C<-modified> will be added to the version. This token +is actually a shortcut for + + %v-r%r-%T%m + +=item B<%r> + +This token will be replaced by the subversion revision number (e.g. C<123>). + +=item B<%T> + +This token will be replaced by the branch that is going to be build. In case +of building the trunk you will see the string C<trunk> here, for working in +branches you will see C<branch-> followed by the branch-name +(e.g. C<branch-V1_X>). If you build a tagged version (located under the +F<tags> folder in the subversion repository), only the tag-name itself is +returned (e.g. C<V_1_3_1>). + +=item B<%m> + +This token will be replaced with the string C<-modified> in case the current +working directory has been modified (i.e. the command C<svn status> returns +any output). + +=item B<%d> + +This token will be replaced by the date in the form C<YYYY-MM-DD>. + +=item B<%t> + +This token will be replaced by the current timestamp in the form +C<YYYYMMDDhhmmss>. + +=back + +=item B<-clean> + +If the target directory does already exist, delete the contents before +continuing. This option does nothing if the target directory does not +exist. + +=item B<-tar> + +If set, create a tar file with the contents of the directory just being build. +If the argument is passed without a parameter, the filename will be the name +of the B<-path> parameter followed by C<.tar>. In case no path is given on the +command line, the name will be C<dist.tar>. Please look also for B<-bzip2> and +B<-gzip> for compression. + +The filename can contain the same tokens as defined in the B<-path> option. + +=item B<-bzip2> + +If B<-tar> was given the output tar file will be compressed by using the +L<bzip2> tool. The output file type will be renamed to C<.tar.bzip2>. + +=item B<-bzip2> + +If B<-tar> was given the output tar file will be compressed by using the +L<gzip> tool. The output file type will be renamed to C<.tar.gz>. + +=item B<-help> + +Print a brief help message and exits. + +=item B<-man> + +Prints the manual page and exits. + +=back + +=head1 DESCRIPTION + +This script is used to create a distribution directory and (optionally) a tar +file containing the distribution. + +The script is compiling the web application and creating out of the generated +.war file and other files a directory which follows the following structure: + + path + +---+-LICENSE + +-README + +-NOTES + +-TODO + +-CONTENTS (list of files in directory) + +-AmavisAdmin.war + +-db (contents of the db sub directory) + +-docs + +----+pdf (generated PDF documentation) + +html(generated HTML documentation) + +txt (generated TXT documentation) + +=head2 File copying + +Files are copied according to the hash %files. This hash maps a source file +related to the project base directory to the target folder. To copy files created during the process, use the C<$tempdir> variable for reference. For example, the mapping + + "$tempdir/AmavisAdmin.war" => "AmavisAdmin.war" + +copies the generated war file from it's temporary location to the target +location. + +=head3 Special copy commands + +There's the option to copy complete trees out of the source tree to the target tree. This can be done by prefixing the source tree key by an B<@> sign. The following line copies the complete C<db> folder: + + "\@db" => "db" + +The mapping result is not used in this case. If you want to copy a directory +from another location (e.g. the C<$tempdir>) path, you should use the special +indicator B<!>. The following example copies all files from the location +B<$tempdir/docs/installationguide/> to the location +B<docs/html/installationguide/>. + + "\!$tempdir/docs/installationguide/" => 'docs/html/installationguide/' + + +=head1 AUTHOR + +Stephen Reindl <sr...@sr...> + +=head1 BUGS + +Probably many as this tool is used for development purposes only. Modified: amavisadmin/branches/documentation_1_0/tools/reposInfo.pl =================================================================== --- amavisadmin/branches/documentation_1_0/tools/reposInfo.pl 2007-01-28 11:22:04 UTC (rev 56) +++ amavisadmin/branches/documentation_1_0/tools/reposInfo.pl 2007-01-28 12:24:03 UTC (rev 57) @@ -13,12 +13,18 @@ # this is an development version. use strict; +BEGIN { + push @INC, "../tools"; # for ant + push @INC, "tools"; # for root dir +} + use SVN::Client; use SVK::Command::Info; use SVK; use SVK::XD; use Cwd; +use version; my $op = shift; @@ -40,13 +46,10 @@ my $cwd = getcwd(); $ctx->info( $cwd, undef, undef, \&funcRev, 0 ); $ctx->status( $cwd, undef, $funcStatus, 1, 0, 0, 0); +print "version=", $version::AmavisVersion, "\n"; +print "dbversion=", $version::DatabaseVersion, "\n"; print "revision=", $_info->rev, "\n"; print "clean_build=", $statusChanged ? "false" : "true", "\n"; -if ($cwd =~ /\/home\//) { - print "build_type=private\n"; -} else { - print "build_type=batch\n"; -} my $url = $_info->URL; if ($url =~ /trunk/) { Copied: amavisadmin/branches/documentation_1_0/tools/version.pm (from rev 56, amavisadmin/trunk/tools/version.pm) =================================================================== --- amavisadmin/branches/documentation_1_0/tools/version.pm (rev 0) +++ amavisadmin/branches/documentation_1_0/tools/version.pm 2007-01-28 12:24:03 UTC (rev 57) @@ -0,0 +1,37 @@ +# This file has only one purpose: In contains the version string used to build +# conficuration files and other topics where the version number is important. + +package version; + +use strict; +use warnings; + +BEGIN { + use Exporter(); + + our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); + + # Version of this module (not related to the AmavisAdmin version) + $VERSION = 1.00; + + @ISA=qw(Exporter); + + @EXPORT=(); + %EXPORT_TAGS=(); + @EXPORT_OK= qw ($AmavisVersion $DatabaseVersion); +} + +our @EXPORT_OK; + +our $AmavisVersion; +our $DatabaseVersion; + +# Here the version is set +#>>>>>>>>>>>>>>>>>>>>>>>> +$AmavisVersion = "1.0"; +$DatabaseVersion = "1"; +#<<<<<<<<<<<<<<<<<<<<<<<< + +END { } + +1; Modified: amavisadmin/branches/documentation_1_0/webapp/build.xml =================================================================== --- amavisadmin/branches/documentation_1_0/webapp/build.xml 2007-01-28 11:22:04 UTC (rev 56) +++ amavisadmin/branches/documentation_1_0/webapp/build.xml 2007-01-28 12:24:03 UTC (rev 57) @@ -84,8 +84,8 @@ <format property="build.timestamp" pattern="yyyyMMdd'T'HHmmssZ" locale="en"/> </tstamp> - <exec executable="/usr/bin/perl"> - <arg value="tools/reposInfo.pl" /> + <exec executable="/usr/bin/perl" failonerror="true"> + <arg value="../tools/reposInfo.pl" /> <redirector output="reposinfo.properties" /> </exec> <copy file="${src.dir}/amavisadmin.properties.in" @@ -100,7 +100,7 @@ </target> <target name="-pre-dist"> - <copy file="LICENSE" + <copy file="../LICENSE" tofile="${build.web.dir}/LICENSE" filtering="false" overwrite="true"> </copy> Modified: amavisadmin/branches/documentation_1_0/webapp/src/java/amavisadmin.properties.in =================================================================== --- amavisadmin/branches/documentation_1_0/webapp/src/java/amavisadmin.properties.in 2007-01-28 11:22:04 UTC (rev 56) +++ amavisadmin/branches/documentation_1_0/webapp/src/java/amavisadmin.properties.in 2007-01-28 12:24:03 UTC (rev 57) @@ -1,35 +1,31 @@ -##/* -## * Copyright (C) 2006,2007 Stephen Reindl. -## * -## * Licensed under the Apache License, Version 2.0 (the "License"); -## * you may not use this file except in compliance with the License. -## * You may obtain a copy of the License at -## * -## * http://www.apache.org/licenses/LICENSE-2.0 -## * -## * Unless required by applicable law or agreed to in writing, software -## * distributed under the License is distributed on an "AS IS" BASIS, -## * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## * See the License for the specific language governing permissions and -## * limitations under the License. -## */ - - -# AmavisAdmin properties file -# This file contains basic settings - -amavisadmin.major = 0 -amavisadmin.minor = 1 - -# those fields are translated automatically -amavisadmin.branch = @branch@ -amavisadmin.build = @revision@ -amavisadmin.build_type = @build_type@ -amavisadmin.clean_build = @clean_build@ - -# If you ever change the datamodel, please increase this value -# and provide an upgrade script in the db topic -amavisadmin.db_version = 1 - -# Build time -amavisadmin.buildtime = @TSTAMP@ +##/* +## * Copyright (C) 2006,2007 Stephen Reindl. +## * +## * Licensed under the Apache License, Version 2.0 (the "License"); +## * you may not use this file except in compliance with the License. +## * You may obtain a copy of the License at +## * +## * http://www.apache.org/licenses/LICENSE-2.0 +## * +## * Unless required by applicable law or agreed to in writing, software +## * distributed under the License is distributed on an "AS IS" BASIS, +## * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## * See the License for the specific language governing permissions and +## * limitations under the License. +## */ + + +# AmavisAdmin properties file +# This file contains basic settings + +amavisadmin.version = @version@ + +# those fields are translated automatically +amavisadmin.branch = @branch@ +amavisadmin.build = @revision@ +amavisadmin.clean_build = @clean_build@ + +amavisadmin.db_version = @dbversion@ + +# Build time +amavisadmin.buildtime = @TSTAMP@ Modified: amavisadmin/branches/documentation_1_0/webapp/src/java/de/sreindl/amavisadmin/bo/VersionInfo.java =================================================================== --- amavisadmin/branches/documentation_1_0/webapp/src/java/de/sreindl/amavisadmin/bo/VersionInfo.java 2007-01-28 11:22:04 UTC (rev 56) +++ amavisadmin/branches/documentation_1_0/webapp/src/java/de/sreindl/amavisadmin/bo/VersionInfo.java 2007-01-28 12:24:03 UTC (rev 57) @@ -85,14 +85,8 @@ if (_localVersion == null) { initProps(); StringBuffer str = new StringBuffer(20); - str.append(props.getProperty("amavisadmin.major", "Unknown")); - str.append('.'); - str.append(props.getProperty("amavisadmin.minor", "unknown")); + str.append(props.getProperty("amavisadmin.version", "Unknown")); - String buildType = props.getProperty("amavisadmin.build_type"); - if (buildType.equals("local")) { - str.append (" local"); - } str.append (" build "); str.append (props.getProperty("amavisadmin.build")); str.append (" ("); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |