debdownloader: fix always downloading some packages

Binaries are downloaded via apt cache function candidate.fetch_binary,
which removes the "epoch" section from the package version in .deb file.
For example, libsm6=2:1.2.3-1, the "epoch" is "2:". The .deb file is
libsm6_1.2.3-1_amd64.deb, rather than libsm6_2%3a1.2.3-1_amd64.deb.

Either "pname_x86" or "pname_all" uses the full version to match the
binary file in local download folder, so it always mismatches.

Removing "epoch" before matching the .deb file.

Story: 2008846
Task: 43153

Signed-off-by: Yue Tao <yue.tao@windriver.com>
Change-Id: I827f5195ce757384a7efb88b1d7f7daddfb93f9f
This commit is contained in:
Yue Tao 2021-11-17 15:22:23 +08:00
parent d8743a67d1
commit d4c3be5e2a

View File

@ -105,20 +105,22 @@ if __name__ == "__main__":
sys.argv[1]]))
sys.exit(1)
version = pkgname_parts[1]
pname_x86 = ''.join([name, '_', version, '_amd64.deb'])
pname_all = ''.join([name, '_', version, '_all.deb'])
# strip epoch
major_ver = version.split(":")[-1]
pname_x86 = ''.join([name, '_', major_ver, '_amd64.deb'])
pname_all = ''.join([name, '_', major_ver, '_all.deb'])
if repomgr.search_pkg(REPO_BIN, name, version):
logger.info(''.join([name, '-', version,
' is already in binary repo, skip download']))
else:
if debs_downloaded and pname_x86 in debs_downloaded:
logger.info(''.join([name, '-', version,
'has been downloaded, skip download']))
' already downloaded, skip download']))
debs_need_upload.append(pname_x86)
else:
if debs_downloaded and pname_all in debs_downloaded:
logger.info(''.join([name, '-', version,
'has been downloaded, skip download']))
' already downloaded, skip download']))
debs_need_upload.append(pname_all)
else:
debs_need_download.append(name + '_' + version)