[Python-apps-commits] r1768 - in packages/archivemail/trunk/debian (15 files)

sez-guest at users.alioth.debian.org sez-guest at users.alioth.debian.org
Sun Sep 7 23:06:55 UTC 2008


    Date: Sunday, September 7, 2008 @ 23:06:53
  Author: sez-guest
Revision: 1768

* Do not overwrite <mailbox>_archive.gz when it is a symbolic link.
  Closes: #349068.
* Add, document and test --archive-all option. Closes: #470675.
* Add, document and test --prefix option for archive name. Closes: #247340.
* Switch patch management from dpatch to quilt.
* Re-add ${misc:Depends} in control file.
* Add Uploaders and Vcs-* fields as it is now maintained as part of the
  python-apps team.

Added:
  packages/archivemail/trunk/debian/patches/add-archive-all-switch.diff
  packages/archivemail/trunk/debian/patches/add-archive-name-switch.diff
  packages/archivemail/trunk/debian/patches/add-prefix-switch.diff
  packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.diff
  packages/archivemail/trunk/debian/patches/fix-path-in-example.diff
  packages/archivemail/trunk/debian/patches/preserve-symlinks.diff
  packages/archivemail/trunk/debian/patches/series
Modified:
  packages/archivemail/trunk/debian/changelog
  packages/archivemail/trunk/debian/clean
  packages/archivemail/trunk/debian/control
  packages/archivemail/trunk/debian/rules
Deleted:
  packages/archivemail/trunk/debian/patches/00list
  packages/archivemail/trunk/debian/patches/add-archive-name-switch.dpatch
  packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.dpatch
  packages/archivemail/trunk/debian/patches/fix-path-in-example.dpatch

Modified: packages/archivemail/trunk/debian/changelog
===================================================================
--- packages/archivemail/trunk/debian/changelog	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/changelog	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,3 +1,16 @@
+archivemail (0.7.2-6) UNRELEASED; urgency=low
+
+  * Do not overwrite <mailbox>_archive.gz when it is a symbolic link.
+    Closes: #349068.
+  * Add, document and test --archive-all option. Closes: #470675.
+  * Add, document and test --prefix option for archive name. Closes: #247340.
+  * Switch patch management from dpatch to quilt.
+  * Re-add ${misc:Depends} in control file.
+  * Add Uploaders and Vcs-* fields as it is now maintained as part of the
+    python-apps team.
+
+ -- Serafeim Zanikolas <serzan at hellug.gr>  Sun, 07 Sep 2008 23:15:47 +0100
+
 archivemail (0.7.2-5) unstable; urgency=low
 
   * New maintainer. Closes: #489448.

Modified: packages/archivemail/trunk/debian/clean
===================================================================
--- packages/archivemail/trunk/debian/clean	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/clean	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,3 +1,3 @@
 archivemail.py
 archivemail.pyc
-manpage.refs
+debian/manpage.refs

Modified: packages/archivemail/trunk/debian/control
===================================================================
--- packages/archivemail/trunk/debian/control	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/control	2008-09-07 23:06:53 UTC (rev 1768)
@@ -3,13 +3,15 @@
 Priority: optional
 Maintainer: Serafeim Zanikolas <serzan at hellug.gr>
 Uploaders: Python Applications Packaging Team <python-apps-team at lists.alioth.debian.org>
-Build-Depends: debhelper (>= 7.0.2), python, python-dev, docbook, docbook-utils, python-support (>= 0.4), dpatch
+Build-Depends: debhelper (>= 7.0.2), python, python-dev, docbook, docbook-utils, python-support (>= 0.4), quilt
 Standards-Version: 3.8.0
+Vcs-Svn: svn://svn.debian.org/python-apps/packages/archivemail/trunk
+Vcs-Browser: http://svn.debian.org/wsvn/python-apps/packages/archivemail
 Homepage: http://archivemail.sourceforge.net/
 
 Package: archivemail
 Architecture: all
-Depends: ${python:Depends}
+Depends: ${misc:Depends}, ${python:Depends}
 Description: archive and compress or delete 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

Deleted: packages/archivemail/trunk/debian/patches/00list
===================================================================
--- packages/archivemail/trunk/debian/patches/00list	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/patches/00list	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,3 +0,0 @@
-add-archive-name-switch.dpatch
-empty-mailbox-objects-fix.dpatch
-fix-path-in-example.dpatch

Added: packages/archivemail/trunk/debian/patches/add-archive-all-switch.diff
===================================================================
--- packages/archivemail/trunk/debian/patches/add-archive-all-switch.diff	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/add-archive-all-switch.diff	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,135 @@
+Index: archivemail/archivemail
+===================================================================
+--- archivemail.orig/archivemail	2008-09-06 15:11:32.000000000 +0100
++++ archivemail/archivemail	2008-09-06 15:14:23.000000000 +0100
+@@ -179,6 +179,7 @@
+     delete_old_mail      = 0
+     dry_run              = 0
+     filter_append        = None
++    archive_all          = 0
+     include_flagged      = 0
+     lockfile_attempts    = 5  
+     lockfile_extension   = ".lock"
+@@ -209,14 +210,14 @@
+ 
+         """
+         try:
+-            opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uvp:', 
++            opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uvp:',
+                              ["date=", "days=", "delete", "dry-run", "help",
+                              "include-flagged", "no-compress", "output-dir=",
+                              "archive-name=",
+                              "filter-append=", "pwfile=", "dont-mangle",
+                              "preserve-unread", "quiet", "size=", "suffix=",
+                              "verbose", "version", "warn-duplicate", "copy",
+-                             "prefix="])
++                             "prefix=", "archive-all"])
+         except getopt.error, msg:
+             user_error(msg)
+ 
+@@ -227,6 +228,8 @@
+                 if self.copy_old_mail: 
+                     user_error("found conflicting options --copy and --delete")
+                 self.delete_old_mail = 1
++            if o == ('--archive-all'):
++                self.archive_all = 1
+             if o == '--include-flagged':
+                 self.include_flagged = 1
+             if o == '--no-compress':
+@@ -277,6 +280,9 @@
+             if o in ('-V', '--version'):
+                 print __version__ + "\n\n" + __copyright__
+                 sys.exit(0)
++        if self.archive_all and archive_by:
++            user_error("--archive-all must not be used with other " +
++                       "filtering options")
+         return args
+ 
+     def sanity_check(self):
+@@ -681,6 +687,8 @@
+ mailbox compressed with gzip. 
+ 
+ Options are as follows:
++      --archive-all     archive all messages (not to be used along with other
++                        filter switches; use with caution)
+   -d, --days=NUM        archive messages older than NUM days (default: %d)
+   -D, --date=DATE       archive messages older than DATE
+   -o, --output-dir=DIR  directory to store archives (default: same as original)
+@@ -1009,6 +1017,8 @@
+ 
+ def should_archive(message):
+     """Return true if we should archive the message, false otherwise"""
++    if options.archive_all:
++        return 1
+     old = 0
+     time_message = guess_delivery_time(message)
+     if options.date_old_max == None:
+Index: archivemail/archivemail.sgml
+===================================================================
+--- archivemail.orig/archivemail.sgml	2008-09-06 15:11:32.000000000 +0100
++++ archivemail/archivemail.sgml	2008-09-06 15:16:25.000000000 +0100
+@@ -119,6 +119,15 @@
+ 
+ <VarListEntry>
+ <Term>
++    <Option>--archive-all</Option>
++</Term>
++<ListItem><Para>
++Archive _all_ messages. Not to be combined with other filter switches.
++</Para></ListItem>
++</VarListEntry>
++
++<VarListEntry>
++<Term>
+     <Option>-d <Replaceable/NUM/, --days=<Replaceable/NUM/</Option>
+ </Term>
+ <ListItem><Para>Archive messages older than <Replaceable/NUM/ days.  
+Index: archivemail/test_archivemail.py
+===================================================================
+--- archivemail.orig/test_archivemail.py	2008-09-06 15:13:17.000000000 +0100
++++ archivemail/test_archivemail.py	2008-09-06 19:58:49.000000000 +0100
+@@ -974,6 +974,44 @@
+         super(TestArchiveDryRun, self).tearDown()
+ 
+ 
++class TestArchiveAll(TestCaseInTempdir):
++    """make sure the 'archive-all' option works"""
++    def setUp(self):
++        super(TestArchiveAll, self).setUp()
++        archivemail.options.quiet = 1
++
++    def testValidUse(self):
++        """test that it works when used without any other archive_by option"""
++        for execute in ("package", "system_long"):
++            self.setUp()
++            self.mbox_name = make_mbox(messages=3, hours_old=(24 * 12))
++            self.mbox = archivemail.Mbox(self.mbox_name)
++            if execute == "package":
++                archivemail.options.archive_all = 1
++                archivemail.archive(self.mbox_name)
++            elif execute == "system_long":
++                run = "./archivemail.py --archive-all --quiet "\
++                        + "%s 2>&1 >/dev/null" % self.mbox_name
++                self.assertEqual(os.system(run), 0)
++            else:
++                sys.exit(1)
++            assert(os.path.exists(self.mbox_name))
++            self.assertTrue(self.mbox.is_empty())
++            self.tearDown()
++
++    def testInvalidUses(self):
++        """test that it gives up with invoked with either -d or -D"""
++        for arg in ["-d 30", "--days=30",\
++                    "-D 2008-07-30", "--date=2008-07-30"]:
++            run = ("./archivemail.py --archive-all %s --quiet "\
++                    + "whatever >/dev/null 2>&1") % arg
++            self.assertEqual(os.system(run), 256)
++
++    def tearDown(self):
++        archivemail.options.archive_all = 0
++        archivemail.options.quiet = 0
++        super(TestArchiveAll, self).tearDown()
++
+ class TestArchiveDays(TestCaseInTempdir):
+     """make sure the 'days' option works"""
+     def setUp(self):

Added: packages/archivemail/trunk/debian/patches/add-archive-name-switch.diff
===================================================================
--- packages/archivemail/trunk/debian/patches/add-archive-name-switch.diff	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/add-archive-name-switch.diff	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,67 @@
+Index: archivemail/archivemail
+===================================================================
+--- archivemail.orig/archivemail	2008-08-15 20:38:03.000000000 +0100
++++ archivemail/archivemail	2008-08-15 21:39:57.000000000 +0100
+@@ -172,6 +172,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
+@@ -210,6 +211,7 @@
+             opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uv', 
+                              ["date=", "days=", "delete", "dry-run", "help",
+                              "include-flagged", "no-compress", "output-dir=",
++			     "archive-name=",
+                              "filter-append=", "pwfile=", "dont-mangle",
+                              "preserve-unread", "quiet", "size=", "suffix=",
+                              "verbose", "version", "warn-duplicate", "copy"])
+@@ -262,6 +264,8 @@
+                 self.mangle_from = 0
+             if o in ('-v', '--verbose'):
+                 self.verbose = 1
++            if o in ('--archive-name'):
++                self.archive_name = os.path.expanduser(a)
+             if o == '--copy':
+                 if self.delete_old_mail: 
+                     user_error("found conflicting options --copy and --delete")
+@@ -663,6 +667,8 @@
+   -P, --pwfile=FILE     file to read imap password from (default: None)
+   -F, --filter-append=STRING  append arbitrary string to the IMAP filter string
+   -s, --suffix=NAME     suffix for archive filename (default: '%s')
++      --archive-name=NAME  specify whole archive filename, overrides prefix
++                           and suffix
+   -S, --size=NUM        only archive messages NUM bytes or larger
+   -n, --dry-run         don't write to anything - just show what would be done
+   -u, --preserve-unread never archive unread messages
+@@ -1102,6 +1108,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))
+Index: archivemail/archivemail.sgml
+===================================================================
+--- archivemail.orig/archivemail.sgml	2008-08-15 20:38:03.000000000 +0100
++++ archivemail/archivemail.sgml	2008-08-15 21:38:49.000000000 +0100
+@@ -238,6 +238,15 @@
+ 
+ <VarListEntry>
+ <Term>
++    <Option>--archive-name</Option>
++</Term>
++<ListItem><Para>
++Specify whole archive filename, overrides prefix and suffix.
++</Para></ListItem>
++</VarListEntry>
++
++<VarListEntry>
++<Term>
+     <Option>-S <Replaceable/NUM/, --size=<Replaceable/NUM/</Option>
+ </Term>
+ <ListItem><Para>Only archive messages that are <Replaceable/NUM/ bytes or

Deleted: packages/archivemail/trunk/debian/patches/add-archive-name-switch.dpatch
===================================================================
--- packages/archivemail/trunk/debian/patches/add-archive-name-switch.dpatch	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/patches/add-archive-name-switch.dpatch	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,68 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## add-archive-name-switch.dpatch by  <serzan at hellug.gr>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Adds command line switch to specify whole archive name (overrides
-## DP: suffix), and documents it in the manpage.
---- archivemail-0.7.2.orig/archivemail
-+++ archivemail-0.7.2/archivemail
-@@ -172,6 +172,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
-@@ -210,6 +211,7 @@
-             opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uv', 
-                              ["date=", "days=", "delete", "dry-run", "help",
-                              "include-flagged", "no-compress", "output-dir=",
-+			     "archive-name=",
-                              "filter-append=", "pwfile=", "dont-mangle",
-                              "preserve-unread", "quiet", "size=", "suffix=",
-                              "verbose", "version", "warn-duplicate", "copy"])
-@@ -262,6 +264,8 @@
-                 self.mangle_from = 0
-             if o in ('-v', '--verbose'):
-                 self.verbose = 1
-+            if o in ('--archive-name'):
-+                self.archive_name = os.path.expanduser(a)
-             if o == '--copy':
-                 if self.delete_old_mail: 
-                     user_error("found conflicting options --copy and --delete")
-@@ -663,6 +667,7 @@
-   -P, --pwfile=FILE     file to read imap password from (default: None)
-   -F, --filter-append=STRING  append arbitrary string to the IMAP filter string
-   -s, --suffix=NAME     suffix for archive filename (default: '%s')
-+      --archive-name=NAME  specify whole archive filename, overrides suffix
-   -S, --size=NUM        only archive messages NUM bytes or larger
-   -n, --dry-run         don't write to anything - just show what would be done
-   -u, --preserve-unread never archive unread messages
-@@ -1102,6 +1107,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))
---- archivemail-0.7.2.orig/archivemail.sgml	2007-11-07 21:22:35.000000000 +0000
-+++ archivemail-0.7.2/archivemail.sgml	2008-06-05 23:55:27.000000000 +0100
-@@ -238,6 +238,15 @@
- 
- <VarListEntry>
- <Term>
-+    <Option>--archive-name</Option>
-+</Term>
-+<ListItem><Para>
-+Specify whole archive filename, overrides suffix.
-+</Para></ListItem>
-+</VarListEntry>
-+
-+<VarListEntry>
-+<Term>
-     <Option>-S <Replaceable/NUM/, --size=<Replaceable/NUM/</Option>
- </Term>
- <ListItem><Para>Only archive messages that are <Replaceable/NUM/ bytes or

Added: packages/archivemail/trunk/debian/patches/add-prefix-switch.diff
===================================================================
--- packages/archivemail/trunk/debian/patches/add-prefix-switch.diff	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/add-prefix-switch.diff	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,138 @@
+Index: archivemail/archivemail
+===================================================================
+--- archivemail.orig/archivemail	2008-08-15 21:40:17.000000000 +0100
++++ archivemail/archivemail	2008-08-15 21:40:17.000000000 +0100
+@@ -171,6 +171,7 @@
+ 
+ class Options:
+     """Class to store runtime options, including defaults"""
++    archive_prefix       = None
+     archive_suffix       = "_archive"
+     archive_name         = None
+     days_old_max         = 180
+@@ -208,13 +209,14 @@
+ 
+         """
+         try:
+-            opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uv', 
++            opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uvp:', 
+                              ["date=", "days=", "delete", "dry-run", "help",
+                              "include-flagged", "no-compress", "output-dir=",
+-			     "archive-name=",
++                             "archive-name=",
+                              "filter-append=", "pwfile=", "dont-mangle",
+                              "preserve-unread", "quiet", "size=", "suffix=",
+-                             "verbose", "version", "warn-duplicate", "copy"])
++                             "verbose", "version", "warn-duplicate", "copy",
++                             "prefix="])
+         except getopt.error, msg:
+             user_error(msg)
+ 
+@@ -254,6 +256,8 @@
+                 self.dry_run = 1
+             if o in ('-q', '--quiet'):
+                 self.quiet = 1
++            if o in ('-p', '--prefix'):
++                self.archive_prefix = a
+             if o in ('-s', '--suffix'):
+                 self.archive_suffix = a
+             if o in ('-S', '--size'):
+@@ -682,6 +686,7 @@
+   -o, --output-dir=DIR  directory to store archives (default: same as original)
+   -P, --pwfile=FILE     file to read imap password from (default: None)
+   -F, --filter-append=STRING  append arbitrary string to the IMAP filter string
++  -p, --prefix=NAME     prefix for archive filename (default: none)
+   -s, --suffix=NAME     suffix for archive filename (default: '%s')
+       --archive-name=NAME  specify whole archive filename, overrides prefix
+                            and suffix
+@@ -1124,8 +1129,11 @@
+         final_archive_name = mailbox_name.split('/')[-1] + parsed_suffix
+     else:
+         final_archive_name = mailbox_name + parsed_suffix
++    if options.archive_prefix:
++        final_archive_name = os.path.join(os.path.dirname(final_archive_name),\
++                options.archive_prefix + os.path.basename(final_archive_name))
+     if options.archive_name:
+-	final_archive_name = 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))
+Index: archivemail/test_archivemail.py
+===================================================================
+--- archivemail.orig/test_archivemail.py	2008-08-15 21:40:17.000000000 +0100
++++ archivemail/test_archivemail.py	2008-08-15 21:40:17.000000000 +0100
+@@ -889,6 +889,54 @@
+         archivemail.options.archive_suffix = "_archive"
+         super(TestArchiveMboxSuffix, self).tearDown()
+ 
++class TestArchiveMboxPrefix(TestCaseInTempdir):
++    """make sure the 'prefix' option works"""
++    def setUp(self):
++        super(TestArchiveMboxPrefix, self).setUp()
++        archivemail.options.quiet = 1
++
++    def testPrefix(self):
++        """archiving with specified --prefix arguments"""
++        for prefix in ["blah-"]:
++            for execute in ("system_long", "system_short", "package"):
++                self.setUp()
++                days_old_max = 180
++                self.mbox_name = make_mbox(messages=3, 
++                    hours_old=(24 * (days_old_max+1)))
++                self.copy_name = tempfile.mkstemp()[1]
++                shutil.copyfile(self.mbox_name, self.copy_name)
++                if execute == "system_long":
++                    run = "./archivemail.py --quiet --prefix='%s' %s" % \
++                        (prefix, self.mbox_name)
++                    self.assertEqual(os.system(run), 0)
++                elif execute == "system_short":
++                    run = "./archivemail.py --quiet -p'%s' %s" % \
++                        (prefix, self.mbox_name)
++                    self.assertEqual(os.system(run), 0)
++                elif execute == "package":
++                    archivemail.options.archive_prefix = prefix
++                    archivemail.archive(self.mbox_name)
++                else:
++                    sys.exit(1)
++                assert(os.path.exists(self.mbox_name))
++                self.assertEqual(os.path.getsize(self.mbox_name), 0)
++
++                archive_name = os.path.join(os.path.dirname(self.mbox_name),\
++                        prefix + os.path.basename(self.mbox_name) +\
++                        "_archive.gz")
++                assert(os.path.exists(archive_name))
++                self.assertEqual(os.system("gzip -d %s" % archive_name), 0)
++                archive_name = re.sub("\.gz$", "", archive_name)
++                assert(os.path.exists(archive_name))
++                assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
++                os.remove(archive_name)
++                self.tearDown()
++
++    def tearDown(self):
++        archivemail.options.quiet = 0
++        archivemail.options.archive_prefix = None
++        super(TestArchiveMboxPrefix, self).tearDown()
++
+ 
+ class TestArchiveDryRun(TestCaseInTempdir):
+     """make sure the 'dry-run' option works"""
+Index: archivemail/archivemail.sgml
+===================================================================
+--- archivemail.orig/archivemail.sgml	2008-08-15 21:38:49.000000000 +0100
++++ archivemail/archivemail.sgml	2008-08-15 21:40:34.000000000 +0100
+@@ -170,6 +170,14 @@
+ 
+ <VarListEntry>
+ <Term>
++    <Option>-p <Replaceable/NAME/, --prefix=<Replaceable/NAME/</Option>
++</Term>
++<ListItem><Para>Prefix <Replaceable/NAME/ to the archive name.
++</Para></ListItem>
++</VarListEntry>
++
++<VarListEntry>
++<Term>
+     <Option>-s <Replaceable/NAME/, --suffix=<Replaceable/NAME/</Option>
+ </Term>
+ <ListItem><Para>

Added: packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.diff
===================================================================
--- packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.diff	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.diff	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,13 @@
+Index: archivemail/archivemail
+===================================================================
+--- archivemail.orig/archivemail	2008-08-14 21:24:03.000000000 +0100
++++ archivemail/archivemail	2008-08-14 21:24:12.000000000 +0100
+@@ -1278,7 +1278,7 @@
+         original = mailbox.MHMailbox(mailbox_name)
+     else:
+         unexpected_error("unknown type: %s" % type)        
+-    assert(original)
++    #assert(original)
+ 
+     cache = IdentityCache(mailbox_name)
+ 

Deleted: packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.dpatch
===================================================================
--- packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.dpatch	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/patches/empty-mailbox-objects-fix.dpatch	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,18 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## empty-mailbox-objects-fix.dpatch by  <serzan at hellug.gr>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: In python 2.5, mailbox objects evaluate to false when empty.  Avoid an
-## DP: assertion when this happens. Closes: #476806.
---- archivemail-0.7.2.orig/archivemail
-+++ archivemail-0.7.2/archivemail
-@@ -1271,7 +1278,7 @@
-         original = mailbox.MHMailbox(mailbox_name)
-     else:
-         unexpected_error("unknown type: %s" % type)        
--    assert(original)
-+    #assert(original)
- 
-     cache = IdentityCache(mailbox_name)
- 
-

Added: packages/archivemail/trunk/debian/patches/fix-path-in-example.diff
===================================================================
--- packages/archivemail/trunk/debian/patches/fix-path-in-example.diff	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/fix-path-in-example.diff	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,11 @@
+--- archivemail-0.7.2.orig/examples/archivemail_all
++++ archivemail-0.7.2/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 \


Property changes on: packages/archivemail/trunk/debian/patches/fix-path-in-example.diff
___________________________________________________________________
Name: svn:executable
   + *

Deleted: packages/archivemail/trunk/debian/patches/fix-path-in-example.dpatch
===================================================================
--- packages/archivemail/trunk/debian/patches/fix-path-in-example.dpatch	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/patches/fix-path-in-example.dpatch	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,16 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## fix-path-in-example.dpatch by  <serzan at hellug.gr>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Removes absolute path to archivemail in example script.
---- archivemail-0.7.2.orig/examples/archivemail_all
-+++ archivemail-0.7.2/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 \

Added: packages/archivemail/trunk/debian/patches/preserve-symlinks.diff
===================================================================
--- packages/archivemail/trunk/debian/patches/preserve-symlinks.diff	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/preserve-symlinks.diff	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,93 @@
+Index: archivemail/archivemail
+===================================================================
+--- archivemail.orig/archivemail	2008-08-15 21:41:37.000000000 +0100
++++ archivemail/archivemail	2008-08-15 22:00:20.000000000 +0100
+@@ -487,6 +487,20 @@
+         """Return the current size of the mbox file"""
+         return os.path.getsize(self.mbox_file_name)
+ 
++    def get_link_target(self, file_name):
++        """Return the supplied file name if not a link; else its target."""
++        if not os.path.islink(file_name):
++            return file_name
++        orig_file_name = prev = file_name
++        while os.path.islink(file_name):
++            prev = file_name
++            file_name = os.readlink(file_name)
++        if not os.path.isabs(file_name):
++            file_name = os.path.abspath(os.path.join(os.path.dirname(prev),
++                                                     file_name))
++        if not os.path.exists(file_name):
++            unexpected_error("%s is a broken symbolic link" % orig_file_name)
++        return file_name
+ 
+ class RetainMbox(Mbox):
+     """Class for holding messages that will be retained from the original
+@@ -525,6 +539,7 @@
+         mode =  os.stat(self.__final_name)[stat.ST_MODE]
+         os.chmod(self.mbox_file_name, mode)
+ 
++        self.__final_name = self.get_link_target(self.__final_name)
+         vprint("renaming '%s' to '%s'" % (self.mbox_file_name, self.__final_name))
+         try:
+             os.rename(self.mbox_file_name, self.__final_name)
+@@ -615,6 +630,7 @@
+         final_name = self.__final_name
+         if not options.no_compress:
+             final_name = final_name + ".gz"
++        final_name = self.get_link_target(final_name)
+         vprint("renaming '%s' to '%s'" % (self.mbox_file_name, 
+             final_name))
+         try:
+@@ -1145,9 +1161,6 @@
+         tempfile.tempdir = new_temp_dir
+         vprint("set tempfile directory to '%s'" % new_temp_dir)
+ 
+-        if os.path.islink(mailbox_name):
+-            unexpected_error("'%s' is a symbolic link -- I feel nervous!" % 
+-                mailbox_name)
+         if imap_scheme == 'imap' or imap_scheme == 'imaps':
+             vprint("guessing mailbox is of type: imap(s)")
+             _archive_imap(mailbox_name, final_archive_name)
+Index: archivemail/test_archivemail.py
+===================================================================
+--- archivemail.orig/test_archivemail.py	2008-08-15 21:40:56.000000000 +0100
++++ archivemail/test_archivemail.py	2008-08-15 21:59:10.000000000 +0100
+@@ -99,6 +99,37 @@
+ 
+ ############ Mbox Class testing ##############
+ 
++class TestMboxSymLinkResolution(TestCaseInTempdir):
++    def setUp(self):
++        super(TestMboxSymLinkResolution, self).setUp()
++        self.mbox_file_name = make_mbox()
++        self.mbox = archivemail.Mbox(self.mbox_file_name)
++
++    def testAbsoluteSymlink(self):
++        """Resolve an absolute symlink in a different directory"""
++        link_name = "%s/symlink-to-mbox" % tempfile.mkdtemp()
++        os.symlink(self.mbox_file_name, link_name)
++        link_target = self.mbox.get_link_target(link_name)
++        self.assertEqual(self.mbox_file_name, link_target)
++
++    def testRelativeSymlink(self):
++        """Resolve a relative symlink in a different directory"""
++        link_dir = tempfile.mkdtemp()
++        link_name = "%s/symlink-to-mbox" % link_dir
++        run = "cd %s && ln -s ../%s %s" % (link_dir,\
++                os.path.basename(self.mbox_file_name),\
++                os.path.basename(link_name))
++        self.assertEqual(os.system(run), 0)
++        link_target = self.mbox.get_link_target(link_name)
++        self.assertEqual(self.mbox_file_name, link_target)
++
++    def testBrokenSymlink(self):
++        """Archive name that is a broken link should raise an error"""
++        link_name = "%s/symlink-to-mbox" % tempfile.mkdtemp()
++        os.symlink("%s-missing" % self.mbox_file_name, link_name)
++        self.assertRaises(archivemail.UnexpectedError,
++                self.mbox.get_link_target, link_name)
++
+ class TestMboxIsEmpty(TestCaseInTempdir):
+     def setUp(self):
+         super(TestMboxIsEmpty, self).setUp()

Added: packages/archivemail/trunk/debian/patches/series
===================================================================
--- packages/archivemail/trunk/debian/patches/series	                        (rev 0)
+++ packages/archivemail/trunk/debian/patches/series	2008-09-07 23:06:53 UTC (rev 1768)
@@ -0,0 +1,6 @@
+add-archive-name-switch.diff
+empty-mailbox-objects-fix.diff
+fix-path-in-example.diff
+preserve-symlinks.diff
+add-prefix-switch.diff
+add-archive-all-switch.diff

Modified: packages/archivemail/trunk/debian/rules
===================================================================
--- packages/archivemail/trunk/debian/rules	2008-09-07 22:46:05 UTC (rev 1767)
+++ packages/archivemail/trunk/debian/rules	2008-09-07 23:06:53 UTC (rev 1768)
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 
-include /usr/share/dpatch/dpatch.make
+include /usr/share/quilt/quilt.make
 
 %:
 	dh $@
@@ -9,7 +9,7 @@
 	dh clean
 
 build: build-stamp
-build-stamp: patch-stamp
+build-stamp: patch
 	dh build
 	ln -sf archivemail archivemail.py
 	./test_archivemail.py




More information about the Python-apps-commits mailing list