1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-26 04:02:11 +01:00

print the list of URL to try, when in HTTP debug mode

This commit is contained in:
Dr. Peter Poeml 2007-09-10 12:22:13 +00:00
parent 40d2ce205e
commit bd9ae2fd05
2 changed files with 10 additions and 2 deletions

View File

@ -281,7 +281,8 @@ def main(opts, argv):
print 'Updating cache of required packages' print 'Updating cache of required packages'
fetcher = Fetcher(cachedir = config['packagecachedir'], fetcher = Fetcher(cachedir = config['packagecachedir'],
urllist = config['urllist'], urllist = config['urllist'],
auth_dict = config['auth_dict']) auth_dict = config['auth_dict'],
http_debug = config['http_debug'])
# now update the package cache # now update the package cache
fetcher.run(bi) fetcher.run(bi)

View File

@ -23,7 +23,7 @@ def join_url(self, base_url, rel_url):
class Fetcher: class Fetcher:
def __init__(self, cachedir = '/tmp', auth_dict = {}, urllist = []): def __init__(self, cachedir = '/tmp', auth_dict = {}, urllist = [], http_debug = False):
__version__ = '0.1' __version__ = '0.1'
__user_agent__ = 'osbuild/%s' % __version__ __user_agent__ = 'osbuild/%s' % __version__
@ -37,6 +37,7 @@ class Fetcher:
self.cachedir = cachedir self.cachedir = cachedir
self.urllist = urllist self.urllist = urllist
self.http_debug = http_debug
passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm() passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
for host in auth_dict.keys(): for host in auth_dict.keys():
@ -67,6 +68,12 @@ class Fetcher:
MirrorGroup._join_url = join_url MirrorGroup._join_url = join_url
mg = MirrorGroup(self.gr, pac.urllist) mg = MirrorGroup(self.gr, pac.urllist)
if self.http_debug:
print
print 'URLs to try for package \'%s\':' % pac
print '\n'.join(pac.urllist)
print
try: try:
# it returns the filename # it returns the filename
ret = mg.urlgrab(pac.filename, ret = mg.urlgrab(pac.filename,