diff options
| -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: |
