From: "Maxim Yu. Osipov" <mosipov@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH 4/4] base-apt-helper: Introduce function compare_pkg_md5sums
Date: Fri, 26 Oct 2018 12:32:41 +0200 [thread overview]
Message-ID: <20181026103241.23755-5-mosipov@ilbers.de> (raw)
In-Reply-To: <20181026103241.23755-1-mosipov@ilbers.de>
Reuse common code block as a function.
Suggested-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
meta/classes/base-apt-helper.bbclass | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/meta/classes/base-apt-helper.bbclass b/meta/classes/base-apt-helper.bbclass
index 7c58b7c..eb28f76 100644
--- a/meta/classes/base-apt-helper.bbclass
+++ b/meta/classes/base-apt-helper.bbclass
@@ -4,6 +4,16 @@
DISTRO_NAME ?= "${@ d.getVar('DISTRO', True).split('-')[0]}"
DISTRO_SUITE ?= "${@ d.getVar('DISTRO', True).split('-')[1]}"
+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() {
search_dir=$1
@@ -20,21 +30,13 @@ populate_base_apt() {
if [ -n "$isar_package" ]; then
# Check if MD5 sums are identical. This helps to avoid the case
# when packages is overridden from another repo.
- md1=$(md5sum $package | cut -d ' ' -f 1)
- md2=$(md5sum $isar_package | cut -d ' ' -f 1)
- if [ "$md1" = "$md2" ]; then
- continue
- fi
+ compare_pkg_md5sums "$package" "$isar_package" && continue
fi
# Check if this package is already in base-apt
isar_package=$(find ${REPO_BASE_DIR}/${DISTRO_NAME} -name $base_name)
if [ -n "$isar_package" ]; then
- md1=$(md5sum $package | cut -d ' ' -f 1)
- md2=$(md5sum $isar_package | cut -d ' ' -f 1)
- if [ "$md1" = "$md2" ]; then
- continue
- fi
+ compare_pkg_md5sums "$package" "$isar_package" && continue
# md5sum differs, so remove the package from base-apt
name=$(echo $base_name | cut -d '_' -f 1)
--
2.11.0
next prev parent reply other threads:[~2018-10-26 10:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 10:32 [PATCH 0/4] Fixes/improvements to local apt repo to cache upstream debian packages for offline usage Maxim Yu. Osipov
2018-10-26 10:32 ` [PATCH 1/4] isar-bootstrap: eliminate workaround --allow-unauthenticated Maxim Yu. Osipov
2018-10-26 10:32 ` [PATCH 2/4] isar-bootdtrap-helper: test explicit value Maxim Yu. Osipov
2018-10-26 10:32 ` [PATCH 3/4] base-apt-helper: fix missed echo in command Maxim Yu. Osipov
2018-10-26 10:32 ` Maxim Yu. Osipov [this message]
2018-10-26 10:45 ` [PATCH 0/4] Fixes/improvements to local apt repo to cache upstream debian packages for offline usage Henning Schild
2018-10-31 11:14 ` Maxim Yu. Osipov
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=20181026103241.23755-5-mosipov@ilbers.de \
--to=mosipov@ilbers.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