build-pkgs: Fixed single packages building no quit issue

In the commit: 2cc754c462
"Message when building non-existing package", after the
below assignment:
"self.lists['pkgs_not_found'] = packages"
actually lists['pkgs_not_found'] is simply a reference
to the same object in memory as 'packages', and next
'self.lists['pkgs_not_found'].remove(pkg)' empties
the value of 'packages' and causes the single packages
building not quit. This fix is using python deepcopy
to resolve this issue.

Test Plan:
Pass: build-pkgs -p <valid packages>
Pass: build-pkgs -c -p <valid packages>

Closes-Bug: 2015980

Signed-off-by: hqbai <haiqing.bai@windriver.com>
Change-Id: I5883b0a6b07803ed12dc2df0ee7f387cfef545ae
This commit is contained in:
hqbai 2023-04-12 16:57:05 +08:00
parent b59a119fb7
commit 39c42d7999

View File

@ -17,6 +17,7 @@
import apt
import apt_pkg
import argparse
import copy
from debian import deb822
import debrepack
import debsentry
@ -1540,7 +1541,7 @@ class BuildController():
if packages:
# We save all pkgs specified by the user and remove it as we find it.
self.lists['pkgs_not_found'] = packages
self.lists['pkgs_not_found'] = copy.deepcopy(packages)
if build_types:
for build_type in build_types: