Commit
10d7f9095fbb ("kernel: fix commit hash matching in
need_to_install()") switched startswith() around to accommodate
a shorter "want" version. That however broke the opposite case: when
installing from gitbuilders "want" is actually a full 40-char hash.
Do away with starswith() and just compare substrings.
Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
cur_sha1 = cur_sha1[0:dloc]
log.debug('extracting sha1, {ver} -> {sha1}'.format(
ver=cur_version, sha1=cur_sha1))
- if cur_sha1.startswith(version):
+ # FIXME: The above will match things like ...-generic on Ubuntu
+ # distro kernels resulting in 'eneric' cur_sha1.
+ m = min(len(cur_sha1), len(version))
+ assert m >= 6, "cur_sha1 and/or version is too short, m = %d" % m
+ if cur_sha1[0:m] == version[0:m]:
log.debug('extracted sha1 matches, do not need to install')
ret = False
else: