From 8791e3c66e242c24c00120b0b953b082307ed419 Mon Sep 17 00:00:00 2001 From: Haiqing Bai Date: Wed, 12 Oct 2022 11:06:36 +0800 Subject: [PATCH] build-pkgs: Prevent copying debs again after reuse If run 'build-pkgs -p ' after 'build-pkgs -p --reuse', the reused package will be copied from the shared repository again. This commit prevents importing the package again. Test Plan: Pass: export STX_SHARED_REPO="" export STX_SHARED_SOURCE="" $build-pkgs -p --reuse $build-pkgs -p The second build should not trigger to copy the deb packages from the shared repository Story: 2008846 Task: 46481 Signed-off-by: Haiqing Bai Change-Id: I4f0b9ab941c7f8433c2425ade9f93757620c16be --- build-tools/stx/build-pkgs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/build-tools/stx/build-pkgs b/build-tools/stx/build-pkgs index d9fe0b12..9eb46446 100755 --- a/build-tools/stx/build-pkgs +++ b/build-tools/stx/build-pkgs @@ -875,7 +875,7 @@ class BuildController(): continues to be used ''' if dsc_file == 'reuse': - logger.info("%s is reused package which has no meta changes", pkg_name) + logger.info("%s is a reused package which has no meta changes", pkg_name) skip_create_dsc = True return skip_create_dsc, None @@ -1429,7 +1429,10 @@ class BuildController(): self.upload_with_dsc(pkg_name, dsc_file, REPO_SOURCE) else: if skip_dsc: - logger.debug("Reuse the remote debs, skip this dsc") + if self.attrs['reuse']: + logger.info("%s will reuse the remote debs, skip to build", pkg_name) + else: + logger.info("%s has reused the shared debs, skip to build", pkg_name) self.lists['reuse_' + build_type].append(pkg_dir) self.lists['reuse_pkgname_' + build_type].append(pkg_name) continue @@ -1449,7 +1452,7 @@ class BuildController(): if pkg in layer_pkgdir_dscs.keys(): target_pkgdir_dscs[pkg] = layer_pkgdir_dscs[pkg] - if len(self.lists['reuse_pkgname_' + build_type]) > 0: + if self.attrs['reuse'] and len(self.lists['reuse_pkgname_' + build_type]) > 0: logger.info("The reused pkgs:%s", ','.join(self.lists['reuse_pkgname_' + build_type])) stx_meta_dir = os.path.join(STX_META_NAME, STX_META_NAME + '-1.0') remote_debsentry = os.path.join(BUILD_ROOT, stx_meta_dir, build_type + '_debsentry.pkl') @@ -1474,8 +1477,8 @@ class BuildController(): if debs_reused: logger.info("All sub debs of %s will be imported:%s", pkgname, debs_reused) try: - logger.debug("Calls copy_pkgs: mirror=%s local_repo=%s type=binary deploy=True overwrite=True", - REUSE_MIRROR, REPO_BUILD) + logger.info("Calls copy_pkgs: mirror=%s local_repo=%s type=binary deploy=True overwrite=True", + REUSE_MIRROR, REPO_BUILD) ret = self.kits['repo_mgr'].copy_pkgs(REUSE_MIRROR, REPO_BUILD, debs_reused, pkg_type='binary', deploy=True, overwrite=True) @@ -1491,7 +1494,7 @@ class BuildController(): if target_pkgdir_dscs: self.run_build_loop(layer_pkgdir_dscs, target_pkgdir_dscs, layer, build_type=build_type) else: - logger.info("No debian dsc files found") + logger.debug("There are no debian dsc files feeded to build_packages") def show_build_stats(self): """