* fix: sha1sum stuff

This commit is contained in:
Eray Özkural
2006-03-24 20:14:43 +00:00
parent 0ef315a589
commit 1d076d3db2
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -65,9 +65,7 @@ class File:
newsha1 = sha1f.readlines()[0] newsha1 = sha1f.readlines()[0]
if uri.is_remote_file(): if uri.is_remote_file():
ctx.ui.info(_("Fetching %s") % uri.get_uri())
localfile = join(transfer_dir, uri.filename()) localfile = join(transfer_dir, uri.filename())
fetch_url(uri, transfer_dir) # FIXME: localfile would look better for fetch iface?
# TODO: code to use old .sha1sum file, is this a necessary optimization? # TODO: code to use old .sha1sum file, is this a necessary optimization?
#oldsha1fn = localfile + '.sha1sum' #oldsha1fn = localfile + '.sha1sum'
@@ -78,6 +76,9 @@ class File:
if (newsha1 == oldsha1): if (newsha1 == oldsha1):
# early terminate, we already got it ;) # early terminate, we already got it ;)
raise AlreadyHaveException(uri, localfile) raise AlreadyHaveException(uri, localfile)
ctx.ui.info(_("Fetching %s") % uri.get_uri())
fetch_url(uri, transfer_dir)
else: else:
localfile = uri.get_uri() #TODO: use a special function here? localfile = uri.get_uri() #TODO: use a special function here?
+1 -1
View File
@@ -52,7 +52,7 @@ class Index(XmlFile):
def read_uri(self, filename, repo = None): def read_uri(self, filename, repo = None):
"""Read PSPEC file""" """Read PSPEC file"""
tmpdir = os.path.join(ctx.config.index_dir(), repo) tmpdir = os.path.join(ctx.config.index_dir(), repo)
self.read(filename, tmpdir, sha1sum=True) self.read(filename, tmpDir=tmpdir, sha1sum=True)
def index(self, repo_uri, skip_sources=False): def index(self, repo_uri, skip_sources=False):
self.repo_dir = repo_uri self.repo_dir = repo_uri
+1 -1
View File
@@ -67,7 +67,7 @@ class XmlFile(object):
"""returns root document element""" """returns root document element"""
return self.doc.documentElement return self.doc.documentElement
def readxml(self, uri, tmpDir = '/tmp', sha1sum=False, compress=None): def readxml(self, uri, tmpDir='/tmp', sha1sum=False, compress=None):
uri = File.make_uri(uri) uri = File.make_uri(uri)
localpath = File.download(uri, tmpDir,sha1sum=sha1sum,compress=compress) localpath = File.download(uri, tmpDir,sha1sum=sha1sum,compress=compress)
try: try: