From d4c3be5e2a53e59f88e72d333349225e92a43248 Mon Sep 17 00:00:00 2001 From: Yue Tao Date: Wed, 17 Nov 2021 15:22:23 +0800 Subject: [PATCH] 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 Change-Id: I827f5195ce757384a7efb88b1d7f7daddfb93f9f --- build-tools/stx/debdownloader | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-tools/stx/debdownloader b/build-tools/stx/debdownloader index ff63de88..ac4054d9 100755 --- a/build-tools/stx/debdownloader +++ b/build-tools/stx/debdownloader @@ -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)