1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 17:26:15 +02:00

Use verifymd5 to determine freshness

to speed up osc up for large repo checkouts by a factor of 10 or more

The verifymd5 value is not (yet) stored
so we quickly compute it as needed

https://github.com/openSUSE/open-build-service/issues/10250
This commit is contained in:
Bernhard M. Wiedemann 2020-10-14 04:57:37 +02:00
parent 4ee9c1ad38
commit c3522dbb28

View File

@ -1244,6 +1244,13 @@ class Package:
self.in_conflict.remove(fname)
self.write_conflictlist()
def _compute_verifymd5(self):
md5str = ''
for f in self.filelist:
if f.name != '_link':
md5str += f.md5+' '+f.name+"\n"
return hashlib.md5(md5str.encode('utf-8')).hexdigest()
def info(self):
source_url = makeurl(self.apiurl, ['source', self.prjname, self.name])
r = info_templ % (self.prjname, self.name, self.absdir, self.apiurl, source_url, self.srcmd5, self.rev, self.linkinfo)
@ -2254,6 +2261,8 @@ rev: %s
def update_needed(self, sinfo):
# this method might return a false-positive (that is a True is returned,
# even though no update is needed) (for details, see comments below)
if sinfo.get('verifymd5') == self._compute_verifymd5():
return False
if self.islink():
if self.isexpanded():
# check if both revs point to the same expanded sources