public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Benedikt Niedermayr <benbrenson89@googlemail.com>
To: isar-users@googlegroups.com
Cc: Benedikt Niedermayr <Benedikt.Niedermayr@mixed-mode.de>
Subject: [PATCH v2 5/7] Added do_finalize_image task.
Date: Thu,  8 Feb 2018 11:40:10 +0100	[thread overview]
Message-ID: <1518086412-12567-6-git-send-email-Benedikt.Niedermayr@mixed-mode.de> (raw)
In-Reply-To: <1518086412-12567-1-git-send-email-Benedikt.Niedermayr@mixed-mode.de>

This taks does two things:
- Create a snapshot for the current Isar repository after build has finished.
- Add remote repositories to apt source files.
  Those files where not created, since multistrap only pulls packages from local mirrors.

Todos:
- multistrap-*.list files are hardcoded. This should be fixed in future, since different distributions
  refer to different repositories.

Signed-off-by: Benedikt Niedermayr <Benedikt.Niedermayr@mixed-mode.de>
---
 meta/classes/image.bbclass | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index cbd74b3..e1c7dd5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -4,6 +4,7 @@
 IMAGE_INSTALL ?= ""
 IMAGE_TYPE    ?= "ext4-img"
 IMAGE_ROOTFS   = "${WORKDIR}/rootfs"
+CACHE_STAGING_DIR = "${DEPLOY_DIR_APT}/${DISTRO}/staging"
 
 def get_image_name(d, name_link):
     S = d.getVar("IMAGE_ROOTFS", True)
@@ -16,7 +17,7 @@ def get_image_name(d, name_link):
 KERNEL_IMAGE ?= "${@get_image_name(d, 'vmlinuz')}"
 INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')}"
 
-inherit ${IMAGE_TYPE}
+inherit ${IMAGE_TYPE} apt-cache
 
 do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
 
@@ -42,3 +43,23 @@ do_copy_boot_files() {
 addtask copy_boot_files before do_build after do_rootfs
 do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
 do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+
+do_finalize_image() {
+    sudo rm -f ${IMAGE_ROOTFS}/etc/apt/sources.list.d/multistrap-*.list
+
+    sudo sh -c 'echo "deb ${DISTRO_APT_SOURCE} ${DISTRO_SUITE} ${DISTRO_COMPONENTS}" > \
+               ${IMAGE_ROOTFS}/etc/apt/sources.list.d/multistrap-base.list'
+    sudo sh -c 'echo "deb ${DISTRO_APT_SOURCE} ${DISTRO_SUITE}-updates ${DISTRO_COMPONENTS}" > \
+               ${IMAGE_ROOTFS}/etc/apt/sources.list.d/multistrap-updates.list'
+    sudo sh -c 'echo "deb ${DISTRO_APT_SOURCE_SEC} ${DISTRO_SUITE}/updates ${DISTRO_COMPONENTS}" > \
+               ${IMAGE_ROOTFS}/etc/apt/sources.list.d/multistrap-security.list'
+
+    cache_create_repo_snapshot
+
+    if [ ! -e "${ISAR_FIRST_BUILD_DONE}" ]; then
+        touch ${ISAR_FIRST_BUILD_DONE}
+    fi
+}
+addtask do_finalize_image before do_build after do_copy_boot_files
+do_finalize_image[dirs] += "${DEPLOY_DIR_APT}/${DISTRO}/staging"
-- 
2.7.4


  parent reply	other threads:[~2018-02-08 10:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 10:40 [PATCH v2 0/7] Local apt cache with aptly V2 Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 1/7] Implement support for setting up the local apt mirror and isar repository with aptly Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 2/7] Added API class for apt cache Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 3/7] Added apt-cache functionality for buildchroot Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 4/7] Added apt-cache functionality for image rootfs Benedikt Niedermayr
2018-02-08 10:40 ` Benedikt Niedermayr [this message]
2018-02-08 10:40 ` [PATCH v2 6/7] Added support for installing isar packages to local isar repository Benedikt Niedermayr
2018-02-08 10:40 ` [PATCH v2 7/7] Introducing fetchall, unpackall and unpack_debian tasks Benedikt Niedermayr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518086412-12567-6-git-send-email-Benedikt.Niedermayr@mixed-mode.de \
    --to=benbrenson89@googlemail.com \
    --cc=Benedikt.Niedermayr@mixed-mode.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox