diff options
| author | bwarsaw | 2002-03-16 02:11:08 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-03-16 02:11:08 +0000 |
| commit | 4d6f0e8f20cf08f559385c19fe0962529a62ef28 (patch) | |
| tree | c2bb3a2ef9903c65a1c22b8a407dac88d3626144 | |
| parent | 9028b42b0eb7cffed60835d73d3ab1be4586d297 (diff) | |
| download | mailman-4d6f0e8f20cf08f559385c19fe0962529a62ef28.tar.gz mailman-4d6f0e8f20cf08f559385c19fe0962529a62ef28.tar.zst mailman-4d6f0e8f20cf08f559385c19fe0962529a62ef28.zip | |
Add -s/--start and -e/--end switches to manually specify the start and
end message numbers (counted from zero) with which to archive. This
can be useful when re-archiving a huge .mbox file, even though you
have to manually chunk it.
| -rw-r--r-- | bin/arch | 41 |
1 files changed, 36 insertions, 5 deletions
@@ -1,6 +1,6 @@ #! @PYTHON@ # -# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc. +# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,7 +22,23 @@ Use this command to rebuild the archives for a mailing list. You may want to do this if you edit some messages in an archive, or remove some messages from an archive. -Usage: %(PROGRAM)s <listname> [<mbox>] [-h] +Usage: %(PROGRAM)s [options] <listname> [<mbox>] [-h] + +Where options are: + -h / --help + Print this help message and exit. + + -s N + --start=N + Start indexing at article N, where article 0 is the first in the mbox. + Defaults to 0. + + -e M + --end=M + End indexing at article M. This script is not very efficient with + respect to memory management, and for large archives, it may not be + possible to index the mbox entirely. For that reason, you can specify + the start and end article numbers. Where <mbox> is the path to a list's complete mbox archive. Usually this will be some path in the archives/private directory. For example: @@ -60,13 +76,26 @@ def usage(code, msg=''): def main(): # get command line arguments try: - opts, args = getopt.getopt(sys.argv[1:], 'h', ['help']) + opts, args = getopt.getopt(sys.argv[1:], 'hs:e:', + ['help', 'start', 'end']) except getopt.error, msg: usage(1, msg) + start = None + end = None for opt, arg in opts: if opt in ('-h', '--help'): usage(0) + elif opt in ('-s', '--start'): + try: + start = int(arg) + except ValueError: + usage(1) + elif opt in ('-e', '--end'): + try: + end = int(arg) + except ValueError: + usage(1) # grok arguments if len(args) < 1: @@ -115,8 +144,10 @@ def main(): archiver = HyperArchive(mlist) archiver.VERBOSE = 1 - archiver.processUnixMailbox(fp, Article) - archiver.close() + try: + archiver.processUnixMailbox(fp, Article, start, end) + finally: + archiver.close() fp.close() finally: if lock: |
