From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>,
Baurzhan Ismagulov <ibr@radix50.net>,
Jan Kiszka <jan.kiszka@siemens.com>,
Henning Schild <henning.schild@siemens.com>
Subject: [PATCHv7 16/29] base-apt: move class "base-apt-helper" into only user
Date: Sat, 21 Mar 2020 09:31:35 +0100 [thread overview]
Message-ID: <20200321083148.26160-17-henning.schild@siemens.com> (raw)
In-Reply-To: <20200321083148.26160-1-henning.schild@siemens.com>
From: Henning Schild <henning.schild@siemens.com>
There is only one place we use that code, move it there instead of
having an extra class.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/base-apt-helper.bbclass | 60 ----------------------
meta/classes/image-cache-extension.bbclass | 55 +++++++++++++++++++-
2 files changed, 54 insertions(+), 61 deletions(-)
delete mode 100644 meta/classes/base-apt-helper.bbclass
diff --git a/meta/classes/base-apt-helper.bbclass b/meta/classes/base-apt-helper.bbclass
deleted file mode 100644
index 7ed28595..00000000
--- a/meta/classes/base-apt-helper.bbclass
+++ /dev/null
@@ -1,60 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) 2018 ilbers GmbH
-# Copyright (C) 2020 Siemens AG
-#
-# SPDX-License-Identifier: MIT
-
-inherit repository
-
-compare_pkg_md5sums() {
- pkg1=$1
- pkg2=$2
-
- md1=$(md5sum $pkg1 | cut -d ' ' -f 1)
- md2=$(md5sum $pkg2 | cut -d ' ' -f 1)
-
- [ "$md1" = "$md2" ]
-}
-
-populate_base_apt() {
- find "${DEBDIR}"/"${DISTRO}" -name '*\.deb' | while read package; do
- # NOTE: due to packages stored by reprepro are not modified, we can
- # use search by filename to check if package is already in repo. In
- # addition, md5sums are compared to ensure that the package is the
- # same and should not be overwritten. This method is easier and more
- # robust than querying reprepro by name.
-
- # Check if this package is taken from Isar-apt, if so - ignore it.
- base_name=${package##*/}
- isar_apt_p=$(find ${REPO_ISAR_DIR}/${DISTRO} -name $base_name)
- if [ -n "$isar_apt_p" ]; then
- # Check if MD5 sums are identical. This helps to avoid the case
- # when packages is overridden from another repo.
- compare_pkg_md5sums "$package" "$isar_apt_p" && continue
- fi
-
- # Check if this package is already in base-apt
- base_apt_p=$(find ${REPO_BASE_DIR}/${BASE_DISTRO} -name $base_name)
- if [ -n "$base_apt_p" ]; then
- compare_pkg_md5sums "$package" "$base_apt_p" && continue
-
- # md5sum differs, so remove the package from base-apt
- repo_del_package "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
- "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
- "${BASE_DISTRO_CODENAME}" \
- "${base_apt_p}"
- fi
-
- repo_add_packages "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
- "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
- "${BASE_DISTRO_CODENAME}" \
- "${package}"
- done
-
- find "${DEBSRCDIR}"/"${DISTRO}" -name '*\.dsc' | while read package; do
- repo_add_srcpackage "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
- "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
- "${BASE_DISTRO_CODENAME}" \
- "${package}"
- done
-}
diff --git a/meta/classes/image-cache-extension.bbclass b/meta/classes/image-cache-extension.bbclass
index 7945e8bc..c3ee7b83 100644
--- a/meta/classes/image-cache-extension.bbclass
+++ b/meta/classes/image-cache-extension.bbclass
@@ -5,7 +5,60 @@
#
# This class extends the image.bbclass to supply the creation of cache repositories
-inherit base-apt-helper
+inherit repository
+
+compare_pkg_md5sums() {
+ pkg1=$1
+ pkg2=$2
+
+ md1=$(md5sum $pkg1 | cut -d ' ' -f 1)
+ md2=$(md5sum $pkg2 | cut -d ' ' -f 1)
+
+ [ "$md1" = "$md2" ]
+}
+
+populate_base_apt() {
+ find "${DEBDIR}"/"${DISTRO}" -name '*\.deb' | while read package; do
+ # NOTE: due to packages stored by reprepro are not modified, we can
+ # use search by filename to check if package is already in repo. In
+ # addition, md5sums are compared to ensure that the package is the
+ # same and should not be overwritten. This method is easier and more
+ # robust than querying reprepro by name.
+
+ # Check if this package is taken from Isar-apt, if so - ignore it.
+ base_name=${package##*/}
+ isar_apt_p=$(find ${REPO_ISAR_DIR}/${DISTRO} -name $base_name)
+ if [ -n "$isar_apt_p" ]; then
+ # Check if MD5 sums are identical. This helps to avoid the case
+ # when packages is overridden from another repo.
+ compare_pkg_md5sums "$package" "$isar_apt_p" && continue
+ fi
+
+ # Check if this package is already in base-apt
+ base_apt_p=$(find ${REPO_BASE_DIR}/${BASE_DISTRO} -name $base_name)
+ if [ -n "$base_apt_p" ]; then
+ compare_pkg_md5sums "$package" "$base_apt_p" && continue
+
+ # md5sum differs, so remove the package from base-apt
+ repo_del_package "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
+ "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
+ "${BASE_DISTRO_CODENAME}" \
+ "${base_apt_p}"
+ fi
+
+ repo_add_packages "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
+ "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
+ "${BASE_DISTRO_CODENAME}" \
+ "${package}"
+ done
+
+ find "${DEBSRCDIR}"/"${DISTRO}" -name '*\.dsc' | while read package; do
+ repo_add_srcpackage "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
+ "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
+ "${BASE_DISTRO_CODENAME}" \
+ "${package}"
+ done
+}
do_cache_base_repo[depends] = "base-apt:do_cache_config"
do_cache_base_repo[lockfiles] = "${REPO_BASE_DIR}/isar.lock"
--
2.24.1
next prev parent reply other threads:[~2020-03-21 8:32 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-21 8:31 [PATCHv7 00/29] base-apt-rework Henning Schild
2020-03-21 8:31 ` [PATCHv7 01/29] repository: new class to deal with repos Henning Schild
2020-03-21 8:31 ` [PATCHv7 02/29] dpkg-base: add download caching of apt:// downloads Henning Schild
2020-03-21 8:31 ` [PATCHv7 03/29] meta: dpkg-base: convert "exit" into "return 0" Henning Schild
2020-03-21 8:31 ` [PATCHv7 04/29] base-apt: change the sources.list to also offer deb-src Henning Schild
2020-03-21 8:31 ` [PATCHv7 05/29] base-apt: add deb-src packages as well Henning Schild
2020-03-21 8:31 ` [PATCHv7 06/29] base-apt: do not skip gpg check when it is signed Henning Schild
2020-03-21 8:31 ` [PATCHv7 07/29] ci: conf: add "hello" to the sample config and every build Henning Schild
2020-03-21 8:31 ` [PATCHv7 08/29] meta: split all apt-get invocations into download and execution Henning Schild
2020-03-21 8:31 ` [PATCHv7 09/29] meta: create DL_DIR support for all apt-get downloaded .debs Henning Schild
2020-03-21 8:31 ` [PATCHv7 10/29] meta: import DL_DIR debs before apt-get download steps Henning Schild
2020-03-21 8:31 ` [PATCHv7 11/29] meta: include DL_DIR deb import/export into bootstrap Henning Schild
2020-03-21 8:31 ` [PATCHv7 12/29] base-apt: populate from DEBDIR as well Henning Schild
2020-03-21 8:31 ` [PATCHv7 13/29] base-apt: drop the "apt_cache" feature Henning Schild
2020-03-21 8:31 ` [PATCHv7 14/29] base-apt: do not copy debs directly out of rootfss anymore Henning Schild
2020-03-21 8:31 ` [PATCHv7 15/29] base-apt: rework base-apt population Henning Schild
2020-03-21 8:31 ` Henning Schild [this message]
2020-03-21 8:31 ` [PATCHv7 17/29] CI: include "isar-disable-apt-cache" into all CI images Henning Schild
2020-03-21 8:31 ` [PATCHv7 18/29] CI: include "cowsay" into default build to test dpkg-gbp Henning Schild
2020-03-21 8:31 ` [PATCHv7 19/29] CI: set BB_NO_NETWORK for cached rebuild Henning Schild
2020-03-21 8:31 ` [PATCHv7 20/29] meta: repository: implement repo_contains_package and use it in base_apt Henning Schild
2020-03-21 8:31 ` [PATCHv7 21/29] meta: repository: simplify the matching of packages Henning Schild
2020-03-21 8:31 ` [PATCHv7 22/29] meta: deb-dl-dir: do not cache debs from isar-apt Henning Schild
2020-03-21 8:31 ` [PATCHv7 23/29] base-apt: pull base-apt population to the front of the build chain Henning Schild
2020-03-21 8:31 ` [PATCHv7 24/29] meta: base-apt: remove isar-apt check from population Henning Schild
2020-03-21 8:31 ` [PATCHv7 25/29] meta: deb-dl-dir: only export newly downloaded files Henning Schild
2020-03-21 8:31 ` [PATCHv7 26/29] CI: test a custom kernel build in the base-apt offline rebuild Henning Schild
2020-03-21 8:31 ` [PATCHv7 27/29] meta/deb-dl-dir: make subshell verbose and fail on error Henning Schild
2020-03-21 8:31 ` [PATCHv7 28/29] meta: deb-dl-dir: fix "command not found" error when excluding pkgs Henning Schild
2020-03-21 8:31 ` [PATCHv7 29/29] RECIPE-API-CHANGELOG: add a few bits on the base-apt caching changes Henning Schild
2020-03-21 8:41 ` [PATCHv7 00/29] base-apt-rework Henning Schild
2020-03-23 10:56 ` Baurzhan Ismagulov
2020-03-23 11:01 ` Jan Kiszka
2020-03-23 12:22 ` Baurzhan Ismagulov
2020-03-23 15:25 ` Henning Schild
2020-03-24 10:49 ` Baurzhan Ismagulov
2020-03-25 10:35 ` Henning Schild
2020-03-25 11:13 ` Jan Kiszka
2020-03-25 11:25 ` Henning Schild
2020-03-25 11:14 ` Baurzhan Ismagulov
2020-03-26 12:53 ` Henning Schild
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=20200321083148.26160-17-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--cc=ibr@radix50.net \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=vijaikumar.kanagarajan@gmail.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