check-mirrors mirrorStats.py,NONE,1.1

Michael Patrick McGrath (mmcgrath) fedora-extras-commits at redhat.com
Sun Oct 15 04:34:39 UTC 2006


Author: mmcgrath

Update of /cvs/fedora/check-mirrors
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31142

Added Files:
	mirrorStats.py 
Log Message:
extracts specific information from the mirror logs for archive



--- NEW FILE mirrorStats.py ---
#!/usr/bin/python

# TODO: Determine if adding this to the returnmirrors script will impact
#       performance

import md5
import sqlite
import sys

debug = 0

def errorprint(error):
    print >> sys.stderr, error

def debugprint(debugmsg):
    if debug:
        print debugmsg
try:
	fp = open(sys.argv[1], 'r')
except:
	print 'please specify a valid filename'
	sys.exit(1)

try:
    for line in fp:
        ip = md5.new(line.split(' ')[0]).hexdigest()
        url = line.split(' ')[6]
	date = line.split(' ')[3]
        try: 
            args = url.split('?')[1].split('&')
        except:
            pass
        else:
            # Get our repo and arch flags
            for arg in args:
                if arg.split('=')[0].lower() == 'repo' and arg.split('=')[-1].lower() != 'repo':
                    repo = arg.split('=')[1].lower()
                if arg.split('=')[0].lower() == 'arch' and arg.split('=')[-1].lower() != 'arch':
                    arch = arg.split('=')[1].lower()
            print "%s %s %s %s" % (date, ip, repo, arch)
finally:
    fp.close()




More information about the scm-commits mailing list