Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure pvroot-image fails if the images' tgz file is missing. #6

Open
wants to merge 5 commits into
base: refactor1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion classes/image-pvrexport.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fakeroot IMAGE_CMD:pvrexportit(){

export PVR_CONFIG_DIR="${PVR_CONFIG_DIR}"
if [ -d ${WORKDIR}/pv-developer-ca_generic ]; then
tar -C ${PVR_CONFIG_DIR}/ -xf ${WORKDIR}/pv-developer-ca_generic/pvs/pvs.defaultkeys.tar.gz
tar -C ${PVR_CONFIG_DIR}/ -xf ${WORKDIR}/pv-developer-ca_generic/pvs/pvs.defaultkeys.tar.gz --no-same-owner
fi
cd ${PVSTATE}
pvr init
Expand Down Expand Up @@ -70,6 +70,11 @@ EOF1

addtask rootfs after do_fetch do_unpack

do_deploy(){
echo deploying
}
addtask deploy after do_image_complete

python __anonymous() {
pn = d.getVar("PN")
d.delVarFlag("do_unpack", "noexec")
Expand Down
38 changes: 22 additions & 16 deletions classes/pvroot-image.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PVROOT_CONTAINERS_CORE ?= ""
PVROOT_IMAGE_BSP ?= ""
PVROOT_IMAGE ?= "yes"

DEPENDS += " pvr-native squashfs-tools-native"
DEPENDS += " pvr-native squashfs-tools-native pantavisor-bsp"

IMAGE_BUILDINFO_FILE = "pvroot.build"

Expand All @@ -25,7 +25,7 @@ python __anonymous () {
pn = d.getVar("PN")

for img in d.getVar("PVROOT_IMAGE_BSP").split():
d.appendVarFlag('do_rootfs', 'depends', ' '+img+':do_image_complete')
d.appendVarFlag('do_rootfs', 'depends', ' '+img+':do_image_complete '+img+':do_image_pvbspit')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to not match the PR title ... does this have any effect/ do_image_complete should depend on this already if the IMAGE_CLASSES have the bspimage-pvrexport class.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its true that do_image_complete depends on do_image_pvbspit, and yet I had an issue here with the file not existing. Hopefully its better now that the file is actually being 'deployed' correctly during do_image_complete.
Having said that, adding do_image_pvbspit as a dependency here will flag an error of the BSP image does not inherit the "bspimage-pvrexport" class, which is just free insurance.
This ties in with another point I wanted to make: I prefer not to include IMAGE_CLASSES += " bspimage-pvrexport " being in a top-level conf file. This adds a few minutes build time to any image not related to pantavisor. Each implementation can still pick their own BSP provider, and get a warning if none exists:

# local.conf:
PVROOT_IMAGE_BSP ?= "fsl-image-network-full-cmdline"
IMAGE_CLASSES:append:pn-fsl-image-network-full-cmdline = " bspimage-pvrexport "

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me test a few combinations ... i would be surpirsed to see that this works without having bspimage-pvrexport in IMAGE_CLASSES .... as another idea to speed up, we could however somehow mask ourselves if we are not in the PVROOT_IMAGE_BSP receipt.... also we could try to mask all IMAGE_CLASSES that are != bspimage-pvrexport and != image-pvrexport in case we are in thePVROOT_IMAGE_BSP receipt.

for img in d.getVar("PVROOT_CONTAINERS").split():
d.appendVarFlag('do_rootfs', 'depends', ' '+img+':do_deploy')
for img in d.getVar("PVROOT_CONTAINERS_CORE").split():
Expand Down Expand Up @@ -74,20 +74,26 @@ def _pvr_pvroot_images_deploy(d, factory, images):

imgpath = tmpdir + "/" + img + versionsuffix + ".pvrexport"
Path(imgpath).mkdir(parents=True,exist_ok=True)
process = subprocess.run(
['tar', '--no-same-owner', '-xvf', deployimg + "/" + img + '.pvrexport.tgz' ],
cwd=Path(imgpath),
env=my_env
)
print ("completed tar process: %d" % process.returncode)

process = subprocess.run(
['pvr', 'deploy', deployrootfs,
imgpath + '#_sigs/'+part+'.json,'+part ],
cwd=Path(tmpdir),
env=my_env
)
print ("completed pvr deploy process: %d" % process.returncode)
try:
subprocess.check_output(
['tar', '--no-same-owner', '-xvf', deployimg + "/" + img + '.pvrexport.tgz' ],
cwd=Path(imgpath),
stderr=subprocess.PIPE,
env=my_env
)
except subprocess.CalledProcessError as e:
bb.fatal("failed to extract pvrimage %s: \n%s\n%s" % (img, e.stdout, e.stderr))

try:
subprocess.check_output(
['pvr', 'deploy', deployrootfs,
imgpath + '#_sigs/'+part+'.json,'+part ],
cwd=Path(tmpdir),
stderr=subprocess.PIPE,
env=my_env
)
except subprocess.CalledProcessError as e:
bb.fatal("failed to deploy pvrimage %s: \n%s\n%s" % (img, e.stdout, e.stderr))


def do_rootfs_mixing(d):
Expand Down
3 changes: 3 additions & 0 deletions conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ BBFILE_PRIORITY_meta-pantavisor = "21"
LAYERDEPENDS_meta-pantavisor = "core"
LAYERSERIES_COMPAT_meta-pantavisor = "hardknott kirkstone dunfell"

BBFILES_DYNAMIC += " \
meta-ti-bsp:${LAYERDIR}/dynamic-layers/meta-ti/recipes-*/*/*.bb \
"
2 changes: 1 addition & 1 deletion recipes-containers/pantavisor/pv-connman_4.bb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PANTAHUB_USER ?= "pantavisor-apps"

BB_STRICT_CHECKSUM = "0"

SRC_URI = "\
SRC_URI += "\
https://${PANTAHUB_API}/exports/asacasa/connman-example/${PV}/connman-example-${PV}.tar.gz;subdir=${BPN}-${PV}/pvrrepo/.pvr \
file://mdev.json \
"
Expand Down