diff options
Diffstat (limited to 'mageiaSync/mageiaSyncExt.py')
-rw-r--r-- | mageiaSync/mageiaSyncExt.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/mageiaSync/mageiaSyncExt.py b/mageiaSync/mageiaSyncExt.py index 5c7f053..f2240fd 100644 --- a/mageiaSync/mageiaSyncExt.py +++ b/mageiaSync/mageiaSyncExt.py @@ -22,6 +22,7 @@ class checkThread(QThread): def processSum(self,sumType): import hashlib + checkvalue=0 if sumType=='sha512': hashfunc = hashlib.sha512() if sumType=='md5': @@ -34,12 +35,10 @@ class checkThread(QThread): try: with open(sig_file, 'rb') as g: verified = gpg.verify_file(g) - if not verified.valid: - print('Signature not OK') - return False + if verified.valid: + checkvalue=64 except: print('Signature file %s not found'%sig_file) - return False try: with open(self.destination+'/'+self.path+'/'+self.name, 'rb') as f: while True: @@ -48,16 +47,16 @@ class checkThread(QThread): hashfunc.update(block) sumcalc=hashfunc.hexdigest() except: - return False + return checkvalue try: fs=open(self.destination+'/'+self.path+'/'+self.name+'.'+sumType,'r') except: # reference file not found - return False + return checkvalue sumcheck=(fs.readline()).split()[0] if sumcalc==sumcheck: - return True - return False + checkvalue += 128 + return checkvalue def processDate(self): import datetime as datetime @@ -96,11 +95,11 @@ class checkThread(QThread): signal=400+self.isoIndex self.checkStartSignal.emit(signal) checkMd5=self.processSum('md5') - self.md5Signal.emit(self.isoIndex+128*checkMd5) + self.md5Signal.emit(self.isoIndex+checkMd5) signal=300+self.isoIndex self.checkStartSignal.emit(signal) checkSha=self.processSum('sha512') - self.sha1Signal.emit(self.isoIndex+128*checkSha) + self.sha1Signal.emit(self.isoIndex+checkSha) self.quit() |