From 51283efb4b68ea2d8f18a88298add47499ae411a Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 26 Dec 2007 15:58:03 +0000 Subject: [PATCH] Initial skeleton. --- 0mirror | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 0mirror.xml | 24 ++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100755 0mirror create mode 100644 0mirror.xml diff --git a/0mirror b/0mirror new file mode 100755 index 0000000..e697e70 --- /dev/null +++ b/0mirror @@ -0,0 +1,52 @@ +#!/usr/bin/env python +from zeroinstall import SafeException +from optparse import OptionParser +import os, sys +from logging import info, debug + +version = '0.1' + +parser = OptionParser(usage="usage: %prog [options] PUBLIC-DIR") +parser.add_option("-v", "--verbose", help="more verbose output", action='count') +parser.add_option("-V", "--version", help="display version information", action='store_true') + +(options, args) = parser.parse_args() + +if options.version: + print "0mirror (zero-install) " + version + print "Copyright (C) 2007 Thomas Leonard" + print "This program comes with ABSOLUTELY NO WARRANTY," + print "to the extent permitted by law." + print "You may redistribute copies of this program" + print "under the terms of the GNU General Public License." + print "For more information about these matters, see the file named COPYING." + sys.exit(0) + +if options.verbose: + import logging + logger = logging.getLogger() + if options.verbose == 1: + logger.setLevel(logging.INFO) + else: + logger.setLevel(logging.DEBUG) + +if len(args) != 1: + parser.print_help() + sys.exit(1) +public_dir = args[0] + +FEED_FILE = os.path.join(public_dir, 'feedlist') + +try: + if not os.path.isfile(FEED_FILE): + raise SafeException("File '%s' does not exist. It should contain a list of feed URLs, one per line") + feeds = file(options.feed_file).read().split('\n') + for feed in feeds: + print feed +except KeyboardInterrupt, ex: + print >>sys.stderr, "Aborted at user's request" + sys.exit(1) +except SafeException, ex: + if options.verbose: raise + print >>sys.stderr, ex + sys.exit(1) diff --git a/0mirror.xml b/0mirror.xml new file mode 100644 index 0000000..5e45b6a --- /dev/null +++ b/0mirror.xml @@ -0,0 +1,24 @@ + + + 0mirror + create a mirror of other Zero Install sites + +When installing or upgrading software, the Zero Install injector (0launch) +normally downloads information about each program and library from its own site. +However, the network connection to this site may be unavailable, unreliable or +slow. 0mirror lets you set up a mirror site which republishes these feeds as a +backup. + http://0install.net/0mirror.html + + + + sed -i "s/^version = '.*'$/version = '$RELEASE_VERSION'/" 0mirror + + + + Network + + + + + -- 2.11.4.GIT