Pull only the latest ostree commit to pre-patched ISO

This commit change the patch-iso-debian script to pull only the latest
ostree commit from the repository used to create it. This make the iso
not increase in size exponentially.

Test plan:
PASS: Create ISO using the script.
PASS: Check if ostree_repo/ contains only the latest commit.
PASS: Install AIO-SX system.

Closes-Bug: 2046811

Change-Id: I96ef803e3b93535cdd2b9e077ab94df98164cdfa
Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
This commit is contained in:
Dostoievski Batista 2023-12-18 10:52:19 -03:00
parent ac4c890e6d
commit ca1f22108e
1 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2022 Wind River Systems, Inc. # Copyright (c) 2023 Wind River Systems, Inc.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -42,7 +42,7 @@ function extract_metadata() {
local patchesdir=${BUILDDIR}/patches local patchesdir=${BUILDDIR}/patches
local patchfile=$1 local patchfile=$1
local patchid=$(basename $patchfile .patch) local patchid=$(basename $patchfile .patch)
local ostree_log=$(ostree --repo=${BUILDDIR}/ostree_repo log starlingx) local ostree_log=$(ostree --repo=${OSTREE_REPO} log starlingx)
echo "Extracting ${patchfile}" echo "Extracting ${patchfile}"
# Extract it # Extract it
@ -218,7 +218,7 @@ fi
# Mount the ISO # Mount the ISO
mount_iso mount_iso
rsync -a ${MNTDIR}/ ${BUILDDIR}/ rsync -a --exclude 'ostree_repo' ${MNTDIR}/ ${BUILDDIR}/
rc=$? rc=$?
if [ $rc -ne 0 ]; then if [ $rc -ne 0 ]; then
echo "Call to rsync ISO content. Aborting..." echo "Call to rsync ISO content. Aborting..."
@ -230,13 +230,14 @@ unmount_iso
# Fix for permission denied if not running as root # Fix for permission denied if not running as root
chmod +w ${BUILDDIR} chmod +w ${BUILDDIR}
chmod -R +w ${BUILDDIR}/isolinux chmod -R +w ${BUILDDIR}/isolinux
chmod -R +w ${BUILDDIR}/ostree_repo
# Create the directory where metadata will be stored # Create the directory where metadata will be stored
mkdir -p ${BUILDDIR}/patches mkdir -p ${BUILDDIR}/patches
chmod -R +w ${BUILDDIR}/patches chmod -R +w ${BUILDDIR}/patches
echo "Updating ostree_repo..." echo "Copying only the latest commit from ostree_repo..."
ostree --repo=${BUILDDIR}/ostree_repo pull-local ${OSTREE_REPO} starlingx ostree --repo=${BUILDDIR}/ostree_repo init --mode=archive-z2
ostree --repo=${BUILDDIR}/ostree_repo pull-local --depth=0 ${OSTREE_REPO} starlingx
ostree --repo=${BUILDDIR}/ostree_repo summary --update ostree --repo=${BUILDDIR}/ostree_repo summary --update
echo "Updated iso ostree commit:" echo "Updated iso ostree commit:"
ostree --repo=${BUILDDIR}/ostree_repo log starlingx ostree --repo=${BUILDDIR}/ostree_repo log starlingx