1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

speedup osc status

by using mtime metadata
before checking digests.
This slightly changes the semantic by assuming that modified files
will always have updated timestamps.

With this change it is possible to do osc status
on a checkout of openSUSE:Factory that contains 40GB of source tarballs
in seconds instead of minutes:
time .../osc/osc-wrapper.py status > /dev/null

real    0m33.652s
user    0m32.590s
sys     0m1.060s

Without the patch it took 22x as long:
real    12m14.545s
user    1m50.084s
sys     0m20.566s
This commit is contained in:
Bernhard M. Wiedemann 2017-07-24 22:03:21 +02:00 committed by Bernhard M. Wiedemann
parent 461d83d722
commit f1f6e9501d

View File

@ -1865,7 +1865,8 @@ class Package:
elif n in self.to_be_added and exists:
state = 'A'
elif exists and exists_in_store and known_by_meta:
if dgst(localfile) != self.findfilebyname(n).md5:
filemeta = self.findfilebyname(n)
if os.path.getmtime(localfile) != filemeta.mtime and dgst(localfile) != filemeta.md5:
state = 'M'
else:
state = ' '