]> git.gsnw.org Git - raspbmirror.git/commitdiff
Merge github 680036c (raspbmirror.py: verify that files that are expected to exist...
authorGerman Service Network <support@gsnw.de>
Sun, 4 Sep 2022 08:56:20 +0000 (10:56 +0200)
committerGerman Service Network <support@gsnw.de>
Sun, 4 Sep 2022 08:56:20 +0000 (10:56 +0200)
raspbmirror.py

index 5073920f69d771bfe69b0b116f84c1cd6df93ec8..6b00b8929f1f4aaa04035d1c50f259affb39d199 100644 (file)
@@ -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')