From: German Service Network Date: Sun, 4 Sep 2022 08:56:20 +0000 (+0200) Subject: Merge github 680036c (raspbmirror.py: verify that files that are expected to exist... X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=383a0a36095c7237d331feabcf7cc8e1350e6330;p=raspbmirror.git Merge github 680036c (raspbmirror.py: verify that files that are expected to exist, actually do.) --- diff --git a/raspbmirror.py b/raspbmirror.py index 5073920..6b00b89 100644 --- a/raspbmirror.py +++ b/raspbmirror.py @@ -146,14 +146,14 @@ def getfile(path,sha256,size): logging.info('existing file '+path.decode('ascii')+' matched by hash and size') fileupdates.add(path) return # no download needed but rename is - elif path in oldknownfiles: - #shortcut exit if file is unchanged, we skip this if a "new" file was detected because - #that means some sort of update was going on to the file and may need to be finished/cleaned up. - oldsha256,oldsize,oldstatus = oldknownfiles[path] - if (oldsha256 == sha256) and (oldsize == size) and (oldstatus != 'F'): - return # no update needed if os.path.isfile(path): # file already exists if (size == os.path.getsize(path)): #no point reading the data and calculating a hash if the size does not match + if path in oldknownfiles: + #shortcut exit if file is unchanged, we skip this if a "new" file was detected because + #that means some sort of update was going on to the file and may need to be finished/cleaned up. + oldsha256,oldsize,oldstatus = oldknownfiles[path] + if (oldsha256 == sha256) and (oldsize == size) and (oldstatus != 'F'): + return # no update needed sha256hashed, tl = getfilesha256andsize(path) if (sha256 == sha256hashed) and (size == tl): logging.info('existing file '+path.decode('ascii')+' matched by hash and size')