debrepack: Handle the KERNEL_TYPE placeholder issue

After revert the below commit, use this commit to handle
the KERNEL_TYPE issue in debian meta:
commit f810774a7726d9fa0e4d41a3438b30aa2d44e1b6
Author: hbai <haiqing.bai@windriver.com>
Date:   Tue Mar 29 20:25:35 2022 +0800

    build-pkgs: pass build type to debrepack

    Pass build type to debrepack to support to
    build rt packages

Story: 2008846
Task: 45006

Test Plan:
Pass: revert blow commits:
    f810774a7726d9fa0e4d41a3438b30aa2d44e1b6
    35cd03b80aea8b39f20724f18f81c66ad67051af
    64189c22c468ee37f5e9d65ce228c2ed63332c17
The apply this commit and run 'build all' tests

Change-Id: I0b318fcb75672dbb19bd834b41539072ea627bbb
This commit is contained in:
STX Builder 2022-04-08 15:23:26 +00:00 committed by hbai
parent 9a223b9598
commit a90bc3ccd3
2 changed files with 30 additions and 2 deletions

View File

@ -629,6 +629,9 @@ class BuildController():
for p in range(len(pkgs_dsc)):
pkgs_can_build = deps_resolver.get_build_able_pkg(1)
if not pkgs_can_build:
logger.warning("Depends resolver returns none package")
return
for dsc in pkgs_can_build:
logger.info(' '.join(['Depends resolver tells to build',
os.path.basename(dsc)]))

View File

@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright (C) 2021 WindRiver Corporation
# Copyright (C) 2021-2022 WindRiver Corporation
# import apt
import apt_pkg
@ -35,6 +35,7 @@ RELEASENOTES = " ".join([os.environ.get('PROJECT'), os.environ.get('MY_RELEASE')
DIST = os.environ.get('STX_DIST')
CENGN_BASE = os.path.join(os.environ.get('CENGNURL'), "debian")
CENGN_STRATEGY = os.environ.get('CENGN_STRATEGY')
BTYPE = "@KERNEL_TYPE@"
class DownloadProgress():
@ -234,7 +235,7 @@ class Parser():
'crit': logging.CRITICAL
}
def __init__(self, basedir, output, loglevel='info', srcrepo=None):
def __init__(self, basedir, output, loglevel='info', srcrepo=None, btype="std"):
self.logger = logging.getLogger(__name__)
self.logger.setLevel(self.level_relations.get(loglevel))
@ -260,6 +261,7 @@ class Parser():
self.output = os.path.abspath(output)
self.srcrepo = srcrepo
self.btype = btype
self.meta_data = dict()
self.versions = dict()
self.pkginfo = dict()
@ -332,6 +334,24 @@ class Parser():
if os.path.exists(self.pkginfo["srcdir"]):
shutil.rmtree(self.pkginfo["srcdir"])
def set_build_type(self):
local_debian = os.path.join(self.pkginfo["packdir"], "local_debian")
run_shell_cmd('cp -r %s %s' % (self.pkginfo["debfolder"], local_debian), self.logger)
# clean @KERNEL_TYPE@ if build type is std
if self.btype == "std":
btype = ""
else:
btype = "-" + self.btype
sed_cmd = 'sed -i s#%s#%s#g %s'
for root, _, files in os.walk(local_debian):
for name in files:
run_shell_cmd(sed_cmd % (BTYPE, btype, os.path.join(root, name)), self.logger)
self.pkginfo["debfolder"] = os.path.join(local_debian)
def set_revision(self):
revision = 0
@ -339,6 +359,9 @@ class Parser():
if "revision" not in self.meta_data:
return dist
# reset the debfolder
self.pkginfo["debfolder"] = os.path.join(self.pkginfo["pkgpath"], "debian")
revision_data = self.meta_data["revision"]
if "dist" in revision_data:
if revision_data["dist"] is not None:
@ -783,6 +806,8 @@ class Parser():
shutil.rmtree(self.pkginfo["packdir"])
os.mkdir(self.pkginfo["packdir"])
self.set_build_type()
logfile = os.path.join(self.pkginfo["packdir"], self.pkginfo["pkgname"] + ".log")
if os.path.exists(logfile):
os.remove(logfile)