Build OSTree commit using component
When installing Debian packages, apt-ostree can reference packages from an specific component. Each component is related to a patch version (sw_release). Test Plan: PASS Install apt-ostree from git repo. PASS Run "apt-ostree compose create \ --base config/debian/bookworm \ --repo /repo debian/bookworm \ bookworm-test" PASS Run "apt-ostree compose install --repo /repo \ --branch bookworm-test --component <sw_release> docker.io" PASS Check the output of "ostree log --repo /repo bookworm-test" Story: 2010867 Task: 50184 Change-Id: I33cc01d1b2f8a9212b7b96591165334c25f9ceab Signed-off-by: Lindley Werner <Lindley.Vieira@windriver.com>
This commit is contained in:

committed by
Lindley Werner Soares Vieira

parent
8022697b60
commit
407a3151a5
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Copyright (c) 2023 Wind River Systems, Inc.
|
Copyright (c) 2023-2024 Wind River Systems, Inc.
|
||||||
|
|
||||||
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ import sys
|
|||||||
import click
|
import click
|
||||||
|
|
||||||
from apt_ostree.cmd.options import branch_option
|
from apt_ostree.cmd.options import branch_option
|
||||||
|
from apt_ostree.cmd.options import component_option
|
||||||
from apt_ostree.cmd.options import gpg_key_option
|
from apt_ostree.cmd.options import gpg_key_option
|
||||||
from apt_ostree.cmd.options import packages_option
|
from apt_ostree.cmd.options import packages_option
|
||||||
from apt_ostree.cmd.options import repo_option
|
from apt_ostree.cmd.options import repo_option
|
||||||
@@ -28,15 +29,17 @@ from apt_ostree.packages import Packages
|
|||||||
help="Debian package feed",
|
help="Debian package feed",
|
||||||
nargs=1)
|
nargs=1)
|
||||||
@gpg_key_option
|
@gpg_key_option
|
||||||
|
@component_option
|
||||||
@packages_option
|
@packages_option
|
||||||
def install(state,
|
def install(state,
|
||||||
branch,
|
branch,
|
||||||
repo,
|
repo,
|
||||||
feed,
|
feed,
|
||||||
gpg_key,
|
gpg_key,
|
||||||
|
component,
|
||||||
packages):
|
packages):
|
||||||
try:
|
try:
|
||||||
Packages(state).install(packages, feed)
|
Packages(state).install(packages, feed, component)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
click.secho("\n" + ("Exiting at your request."))
|
click.secho("\n" + ("Exiting at your request."))
|
||||||
sys.exit(130)
|
sys.exit(130)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Copyright (c) 2023 Wind River Systems, Inc.
|
Copyright (c) 2023-2024 Wind River Systems, Inc.
|
||||||
|
|
||||||
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ class Deploy:
|
|||||||
self.workdir.mkdir(parents=True, exist_ok=True)
|
self.workdir.mkdir(parents=True, exist_ok=True)
|
||||||
self.rootfs = None
|
self.rootfs = None
|
||||||
|
|
||||||
def prestaging(self, rootfs, feed=None):
|
def prestaging(self, rootfs, feed=None, component=None):
|
||||||
"""Pre stage steps."""
|
"""Pre stage steps."""
|
||||||
if not rootfs.exists():
|
if not rootfs.exists():
|
||||||
self.logging.error("rootfs not found: {rootfs}")
|
self.logging.error("rootfs not found: {rootfs}")
|
||||||
@@ -74,11 +74,15 @@ class Deploy:
|
|||||||
self.logging.info("Configuring temporary package feed.")
|
self.logging.info("Configuring temporary package feed.")
|
||||||
self.apt_conf = rootfs.joinpath(APT_CONF)
|
self.apt_conf = rootfs.joinpath(APT_CONF)
|
||||||
feed = feed.replace('"', '')
|
feed = feed.replace('"', '')
|
||||||
self.apt_conf.write_text(
|
|
||||||
textwrap.dedent(f"""\
|
conf_repo_line = f"deb [trusted=yes] {feed}"
|
||||||
deb [trusted=yes] {feed}
|
if component:
|
||||||
"""
|
self.logging.info(
|
||||||
))
|
f"Configuring temp package component: {component}")
|
||||||
|
component = component.replace('"', '')
|
||||||
|
conf_repo_line = f"deb [trusted=yes] {feed} . {component}"
|
||||||
|
|
||||||
|
self.apt_conf.write_text(textwrap.dedent(conf_repo_line))
|
||||||
|
|
||||||
def poststaging(self, rootfs):
|
def poststaging(self, rootfs):
|
||||||
"""Post staging steps."""
|
"""Post staging steps."""
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Copyright (c) 2023 Wind River Systems, Inc.
|
Copyright (c) 2023-2024 Wind River Systems, Inc.
|
||||||
|
|
||||||
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class Packages:
|
|||||||
self.ostree = Ostree(self.state)
|
self.ostree = Ostree(self.state)
|
||||||
self.deploy = Deploy(self.state)
|
self.deploy = Deploy(self.state)
|
||||||
|
|
||||||
def install(self, packages, feed=None):
|
def install(self, packages, feed=None, component=None):
|
||||||
"""Use apt to install Debian packages."""
|
"""Use apt to install Debian packages."""
|
||||||
deps = set()
|
deps = set()
|
||||||
predeps = set()
|
predeps = set()
|
||||||
@@ -36,7 +36,7 @@ class Packages:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Step 0 - Run the prestaging steps.
|
# Step 0 - Run the prestaging steps.
|
||||||
self.deploy.prestaging(rootfs, feed)
|
self.deploy.prestaging(rootfs, feed, component)
|
||||||
|
|
||||||
# Step 1 - Update the package cache in the deployment.
|
# Step 1 - Update the package cache in the deployment.
|
||||||
self.apt.apt_update(rootfs)
|
self.apt.apt_update(rootfs)
|
||||||
|
Reference in New Issue
Block a user