--- archivemail-0.7.0.orig/debian/rules +++ archivemail-0.7.0/debian/rules @@ -0,0 +1,47 @@ +#!/usr/bin/make -f + +build: build-stamp +build-stamp: + dh_testdir + ./setup.py build + ln -s archivemail archivemail.py + ./test_archivemail.py + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + ./setup.py clean --all + dh_clean archivemail.py archivemail.pyc + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + ./setup.py install --root=`pwd`/debian/`dh_listpackages` --no-compile \ + --install-data=usr/share + +binary-arch: build install + +binary-indep: build install + dh_testdir + dh_testroot + dh_installchangelogs CHANGELOG + dh_installdocs README TODO FAQ + dh_installexamples examples/* + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_pysupport + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- archivemail-0.7.0.orig/debian/changelog +++ archivemail-0.7.0/debian/changelog @@ -0,0 +1,186 @@ +archivemail (0.7.0-2) unstable; urgency=low + + * Apply patch for upstream bug #1670422, python 2.5 does not have + message.fp.name and should instead use message.fp._file.name. + + -- Joey Hess Sun, 06 May 2007 16:30:16 -0400 + +archivemail (0.7.0-1) unstable; urgency=low + + * New upstream release, with many fixes, including these fixes to Debian + bugs: + - Fixed IMAP --delete which didn't work at all. (Thanks Anand) + Closes: #203282 + - Terminate each message in newly written mbox with an empty line if the + message source is not an mbox-format folder. (Thanks Chung-chieh Shan) + Closes: #250410 + - Mangle From_ in message body if the message source is not an mbox-format + folder. (Thanks Chung-chieh Shan) Closes: #250402 + - Also merges most of my changes to the Debian package. + * Re-enable test suite which works again. + + -- Joey Hess Fri, 10 Nov 2006 17:09:28 -0500 + +archivemail (0.6.2-5) unstable; urgency=low + + * Switch to using python-support, although there are no library files for it + to deal with. + + -- Joey Hess Sun, 1 Oct 2006 12:56:28 -0400 + +archivemail (0.6.2-4) unstable; urgency=low + + * Man page update from Nikolaus Schulz to document --pwfile and + --filter-append and SSL/IMAPS support. Closes: #386907 + * Patch from Nikolaus Schulz to fix the --pwfile and --filter-append + option parsing. Closes: #386908 + * Patch from Nikolaus Schulz to fix issues in IMAP authentication + introduced in 0.6.2. Closes: #386903 + + -- Joey Hess Sun, 10 Sep 2006 21:23:09 -0400 + +archivemail (0.6.2-3) unstable; urgency=low + + * Fix a regression in CRLF conversion for IMAP messages introduced in 0.6.2. + Thanks, Nikolaus Schulz. Closes: #386858 + + -- Joey Hess Sun, 10 Sep 2006 14:27:56 -0400 + +archivemail (0.6.2-2) unstable; urgency=HIGH + + * Fix a number of temporary file security holes in archivemail and its + test suite. CVE-2006-4245 Closes: #385253 + + -- Joey Hess Wed, 30 Aug 2006 00:09:13 -0400 + +archivemail (0.6.2-1) unstable; urgency=low + + * New upstream release. + * SSL support. Closes: #368117 + * Alternative fix for #297732. + * Disabled the test suite, which was not updated to follow changes to + --suffix behavior, and which also seems to have race conditions. + For example, some code in it calulates a date N days ago, does some + operations with that date, then constructs a file based on a date N + days ago -- which can be a different day if run around midnight! + + -- Joey Hess Tue, 25 Jul 2006 23:38:18 -0400 + +archivemail (0.6.1-7) unstable; urgency=low + + * Patch from Nikolaus Schulz to fix code that is used (in some cases) + to generate the From_ header for a mbox. Closes: #367017 + * Patch from Nikolaus Schulz to fix CRLF conversion from IMAP. + Closes: #367033 + + -- Joey Hess Wed, 24 May 2006 18:42:09 -0400 + +archivemail (0.6.1-6) unstable; urgency=low + + * Patch from Falko Trojahn to break up deletion of IMAP mail into multiple + commands, to avoid problems with line length on some IMAP server. + Closes: #297732 + + -- Joey Hess Fri, 3 Feb 2006 15:10:31 -0500 + +archivemail (0.6.1-5) unstable; urgency=low + + * Switch watchfile to sf.net redirector. + + -- Joey Hess Sun, 17 Jul 2005 16:50:17 +0300 + +archivemail (0.6.1-4) unstable; urgency=low + + * Patch from Brian Thomas Sniffen to fix comparisons of rfc822.message + objects, which fixes problems with maildirs appearing empty. + Closes: #305902 + + -- Joey Hess Thu, 26 May 2005 19:41:31 -0400 + +archivemail (0.6.1-3) unstable; urgency=low + + * Move deps from build-depends-indep to build-depends, to meet current + policy. + * Don't assign to None. Closes: #206397 + + -- Joey Hess Tue, 30 Sep 2003 15:00:26 -0400 + +archivemail (0.6.1-2) unstable; urgency=low + + * Use dh_python. + + -- Joey Hess Thu, 21 Nov 2002 00:17:53 -0500 + +archivemail (0.6.1-1) unstable; urgency=low + + * New upstream release (no changes). + + -- Joey Hess Thu, 31 Oct 2002 13:46:28 -0500 + +archivemail (0.6.0-4) unstable; urgency=low + + * Turned off failing weird_headers test (patch from upstream). + Closes: #167088 + + -- Joey Hess Thu, 31 Oct 2002 13:26:00 -0500 + +archivemail (0.6.0-3) unstable; urgency=low + + * Don't qualify archivemail in archivemail_all. Closes: #165647 + + -- Joey Hess Wed, 30 Oct 2002 11:09:05 -0500 + +archivemail (0.6.0-2) unstable; urgency=low + + * Updated package description to mention IMAP. + + -- Joey Hess Fri, 11 Oct 2002 15:55:50 -0400 + +archivemail (0.6.0-1) unstable; urgency=low + + * New upstream release with IMAP support. + + -- Joey Hess Sun, 6 Oct 2002 11:48:41 -0400 + +archivemail (0.5.1-1) unstable; urgency=low + + * New upstream release fixing tempfile bug. Closes: #152024, #162047 + + -- Joey Hess Mon, 23 Sep 2002 20:01:09 -0400 + +archivemail (0.4.9-1) unstable; urgency=low + + * New upstream release, with more robust directory name support. + Closes: #156267 + + -- Joey Hess Sun, 18 Aug 2002 12:16:49 -0400 + +archivemail (0.4.8-1) unstable; urgency=low + + * New upstream release, with better temp file creation. Closes: #146594 + + -- Joey Hess Tue, 21 May 2002 21:53:24 -0400 + +archivemail (0.4.7-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Thu, 9 May 2002 12:30:20 -0400 + +archivemail (0.4.5-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Wed, 1 May 2002 20:39:05 -0400 + +archivemail (0.4.3-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Thu, 25 Apr 2002 14:14:30 -0400 + +archivemail (0.4.0-1) unstable; urgency=low + + * First release. + + -- Joey Hess Wed, 17 Apr 2002 11:45:33 -0400 --- archivemail-0.7.0.orig/debian/compat +++ archivemail-0.7.0/debian/compat @@ -0,0 +1 @@ +4 --- archivemail-0.7.0.orig/debian/control +++ archivemail-0.7.0/debian/control @@ -0,0 +1,16 @@ +Source: archivemail +Section: mail +Priority: optional +Maintainer: Joey Hess +Build-Depends: debhelper (>= 4.1.24), python, python-dev, docbook-utils, python-support (>= 0.4) +Standards-Version: 3.7.2 +XS-Vcs-Svn: svn://svn.kitenet.net/joey/trunk/src/packages/archivemail + +Package: archivemail +Architecture: all +Depends: ${python:Depends}, ${misc:Depends} +Description: archive and compress your old email + Archivemail moves old mail out of a mailbox (in Maildir, MH, or + mbox format, or via IMAP) and archives it in a compressed mbox-format + mailbox file. It is well suited to be run from cron for automatic + archiving of your old mail. --- archivemail-0.7.0.orig/debian/copyright +++ archivemail-0.7.0/debian/copyright @@ -0,0 +1,26 @@ +This is a Debian prepackaged version of the archivemail utility. + +This package was put together by Joey Hess , using +sources from: + http://prdownloads.sourceforge.net/archivemail/ + +The following copyright applies to this package: + +# Copyright (C) 2002 Paul Rodger +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +On Debian systems, the complete text of the GPL is in +/usr/share/common-licenses/GPL. --- archivemail-0.7.0.orig/debian/watch +++ archivemail-0.7.0/debian/watch @@ -0,0 +1,2 @@ +version=2 +http://qa.debian.org/watch/sf.php/archivemail/ archivemail-(.*).tar.gz --- archivemail-0.7.0.orig/examples/archivemail_all +++ archivemail-0.7.0/examples/archivemail_all @@ -10,7 +10,7 @@ # set -e -ARCMAIL="/usr/local/bin/archivemail --quiet --output-dir=$HOME/Mail/Archive/ " +ARCMAIL="archivemail --quiet --output-dir=$HOME/Mail/Archive/ " $ARCMAIL --days 14 $HOME/Mail/debian-user \ $HOME/Mail/linux-kernel \ --- archivemail-0.7.0.orig/archivemail +++ archivemail-0.7.0/archivemail @@ -165,6 +165,7 @@ class Options: """Class to store runtime options, including defaults""" archive_suffix = "_archive" + archive_name = None days_old_max = 180 date_old_max = None delete_old_mail = 0 @@ -203,6 +204,7 @@ ["date=", "days=", "delete", "dry-run", "help", "include-flagged", "no-compress", "output-dir=", "filter-append=", "pwfile=", "dont-mangle", + "archive-name=", "preserve-unread", "quiet", "size=", "suffix=", "verbose", "version", "warn-duplicate"]) except getopt.error, msg: @@ -252,6 +254,8 @@ self.mangle_from = 0 if o in ('-v', '--verbose'): self.verbose = 1 + if o == '--archive-name': + self.archive_name = a; if o in ('-V', '--version'): print __version__ + "\n\n" + __copyright__ sys.exit(0) @@ -337,7 +341,7 @@ msg -- rfc822 message object to be written """ - assert(msg) + assert(msg != None) assert(self.mbox_file) vprint("saving message to file '%s'" % self.mbox_file_name) @@ -620,7 +624,7 @@ def warn_if_dupe(self, msg): """Print a warning message if the message has already appeared""" - assert(msg) + assert(msg != None) message_id = msg.get('Message-ID') assert(message_id) if self.seen_ids.has_key(message_id): @@ -724,7 +728,7 @@ message -- the rfc822 message object """ - assert(message) + assert(message != None) address = guess_return_path(message) time_message = guess_delivery_time(message) gm_date = time.gmtime(time_message) @@ -736,7 +740,7 @@ def guess_return_path(message): """Return a guess at the Return Path address of an rfc822 message""" - assert(message) + assert(message != None) for header in ('Return-path', 'From'): address_header = message.get(header) @@ -753,7 +757,7 @@ def guess_delivery_time(message): """Return a guess at the delivery date of an rfc822 message""" - assert(message) + assert(message != None) # try to guess the delivery date from various headers # get more desparate as we go through the array for header in ('Delivery-date', 'Date', 'Resent-Date'): @@ -779,7 +783,10 @@ # the headers have no valid dates -- last resort, try the file timestamp # this will not work for mbox mailboxes try: - file_name = message.fp.name + if sys.version_info[1] >= 5: + file_name = message.fp._file.name + else: + file_name = message.fp.name except AttributeError: # we are looking at a 'mbox' mailbox - argh! # Just return the current time - this will never get archived :( @@ -788,7 +795,10 @@ if not os.path.isfile(file_name): unexpected_error("mailbox file name '%s' has gone missing" % \ file_name) - time_message = os.path.getmtime(message.fp.name) + if sys.version_info[1] >= 5: + time_message = os.path.getmtime(message.fp._file.name) + else: + time_message = os.path.getmtime(message.fp.name) vprint("using valid time found from '%s' last-modification time" % \ file_name) return time_message @@ -806,7 +816,11 @@ """ status = "" x_status = "" - match = re.search(":2,(.+)$", message.fp.name) + if sys.version_info[1] >= 5: + fpname = message.fp._file.name + else: + fpname = message.fp.name + match = re.search(":2,(.+)$", fpname) if match: flags = match.group(1) for flag in flags: @@ -825,7 +839,7 @@ # files in the maildir 'cur' directory are no longer new, # they are the same as messages with 'Status: O' headers in mbox - last_dir = os.path.basename(os.path.dirname(message.fp.name)) + (ignore, last_dir) = os.path.split(os.path.dirname(fpname)) if last_dir == "cur": status = status + "O" @@ -941,7 +955,7 @@ def is_smaller(message, size): """Return true if the message is smaller than size bytes, false otherwise""" - assert(message) + assert(message != None) assert(size > 0) message_size = sizeof_message(message) if message_size < size: @@ -1080,6 +1094,8 @@ final_archive_name = mailbox_name.split('/')[-1] + parsed_suffix else: final_archive_name = mailbox_name + parsed_suffix + if options.archive_name: + final_archive_name = options.archive_name if options.output_dir: final_archive_name = os.path.join(options.output_dir, os.path.basename(final_archive_name)) @@ -1171,7 +1187,7 @@ msg = original.next() if not msg and (original.starting_size > 0): user_error("'%s' is not a valid mbox-format mailbox" % mailbox_name) - while (msg): + while (msg != None): msg_size = sizeof_message(msg) stats.another_message(msg_size) vprint("processing message '%s'" % msg.get('Message-ID')) @@ -1251,7 +1267,7 @@ cache = IdentityCache(mailbox_name) msg = original.next() - while (msg): + while (msg != None): msg_size = sizeof_message(msg) stats.another_message(msg_size) vprint("processing message '%s'" % msg.get('Message-ID')) @@ -1269,8 +1285,12 @@ if type == "maildir": add_status_headers(msg) archive.write(msg) - if not options.dry_run: delete_queue.append(msg.fp.name) - else: + if sys.version_info[1] >= 5: + fpname = msg.fp._file.name + else: + fpname = msg.fp.name + if not options.dry_run: delete_queue.append(fpname) + else: vprint("decision: retain message") msg = original.next() vprint("finished reading messages")