From: Claudius Heine <claudius.heine.ext@siemens.com>
To: "Maxim Yu. Osipov" <mosipov@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH 1/9] base-apt: Add helper class
Date: Tue, 2 Oct 2018 15:39:42 +0200 [thread overview]
Message-ID: <57177149-44b1-0876-7c5c-49d687b42267@siemens.com> (raw)
In-Reply-To: <20181002121907.18476-2-mosipov@ilbers.de>
Hi Maxim,
On 10/2/18 2:18 PM, Maxim Yu. Osipov wrote:
> From: Alexander Smirnov <asmirnov@ilbers.de>
>
> base-apt intended to store original upstream debs to re-use them
> later offline. This class helps to populate base-apt with the packages
> used during build.
>
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
> meta/classes/base-apt-helper.bbclass | 53 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
> create mode 100644 meta/classes/base-apt-helper.bbclass
>
> diff --git a/meta/classes/base-apt-helper.bbclass b/meta/classes/base-apt-helper.bbclass
> new file mode 100644
> index 0000000..5e3fe36
> --- /dev/null
> +++ b/meta/classes/base-apt-helper.bbclass
> @@ -0,0 +1,53 @@
> +# This software is a part of ISAR.
> +# Copyright (C) 2018 ilbers GmbH
> +
> +DISTRO_NAME ?= "${@ d.getVar('DISTRO', True).split('-')[0]}"
> +DISTRO_SUITE ?= "${@ d.getVar('DISTRO', True).split('-')[1]}"
> +
> +populate_base_apt() {
> + search_dir=$1
> +
> + for package in $(find $search_dir -name '*.deb'); do
find ... | while read package; do
or
while read package; do ...; done <<< $(find ...)
is better performance wise since the loop is iterated as results come in.
> + # 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, m5sums could be compared to ensure, that 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 - ingore it.
> + isar_package=$(find ${DEPLOY_DIR_APT}/${DISTRO} -name $package)
Don't you need a `${package##*/}` here to remove the leading path?
> + if [ -n "$isar_package" ]; then
> + # Check if MD5 sums are iendtical. This helps to avoid the case
identical
> + # when packages is overriden from another repo.
overridden
> + md1=$(md5sum $package)
> + md2=$(md5sum $isar_package)
md5sum produces output with like this:
$ md5sum conf/local.conf
c543793c1df3b1f45a5555d92b6f3ee2 conf/local.conf
So you need to remove that before comparing. The same issues are in the
following code as well.
Cheers,
Claudius
> + if [ "$md1" = "$md2" ]; then
> + continue
> + fi
> + fi
> +
> + # Check if this package is already in base-apt
> + isar_package=$(find ${BASE_APT_DIR}/${DISTRO_NAME} -name $package)
> + if [ -n "$isar_package" ]; then
> + md1=$(md5sum $package)
> + md2=$(md5sum $isar_package)
> + if [ "$md1" = "$md2" ]; then
> + continue
> + fi
> +
> + # md5sum differs, so remove the package from base-apt
> + name=$(basename $package | cut -d '_' -f 1)
> + reprepro -b ${BASE_APT_DIR}/${DISTRO_NAME} \
> + --dbdir ${BASE_APT_DB}/${DISTRO_NAME} \
> + -C main -A ${DISTRO_ARCH} \
> + remove ${DISTRO_SUITE} \
> + $name
> + fi
> +
> + reprepro -b ${BASE_APT_DIR}/${DISTRO_NAME} \
> + --dbdir ${BASE_APT_DB}/${DISTRO_NAME} \
> + -C main \
> + includedeb ${DISTRO_SUITE} \
> + $package
> + done
> +}
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de
next prev parent reply other threads:[~2018-10-02 13:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 12:18 [PATCH 0/9] Introduce local apt repo to cache upstream debian packages for offline usage Maxim Yu. Osipov
2018-10-02 12:18 ` [PATCH 1/9] base-apt: Add helper class Maxim Yu. Osipov
2018-10-02 13:39 ` Claudius Heine [this message]
2018-10-02 12:19 ` [PATCH 2/9] base-apt: Introduce base implementaiton Maxim Yu. Osipov
2018-10-02 14:20 ` Claudius Heine
2018-10-02 12:19 ` [PATCH 3/9] isar-boot-strap: Add option to keep cache Maxim Yu. Osipov
2018-10-02 14:49 ` Claudius Heine
2018-10-02 12:19 ` [PATCH 4/9] image: Add cache_base_repo task Maxim Yu. Osipov
2018-10-02 12:19 ` [PATCH 5/9] isar-bootstrap: Make possible to reuse the cache Maxim Yu. Osipov
2018-11-02 11:40 ` Henning Schild
2018-10-02 12:19 ` [PATCH 6/9] buildchroot: Make it buildable from base-apt Maxim Yu. Osipov
2018-10-02 12:19 ` [PATCH 7/9] workaround: Use --allow-unauthenticated working with base-apt Maxim Yu. Osipov
2018-10-02 12:19 ` [PATCH 8/9] local.conf: Add option to use cached base repository Maxim Yu. Osipov
2018-10-02 12:19 ` [PATCH 9/9] doc: Creation of local apt repo caching upstream Debian packages Maxim Yu. Osipov
2018-10-02 14:02 ` Claudius Heine
2018-10-02 14:06 ` Jan Kiszka
2018-10-04 9:03 ` Baurzhan Ismagulov
2018-10-05 12:09 ` Claudius Heine
2018-10-11 16:33 ` Baurzhan Ismagulov
2018-10-02 14:05 ` Claudius Heine
2018-11-02 12:00 ` [PATCH 0/9] Introduce local apt repo to cache upstream debian packages for offline usage Henning Schild
2018-11-09 8:04 ` Jan Kiszka
2018-11-09 9:14 ` Baurzhan Ismagulov
2018-11-29 12:53 ` Henning Schild
2018-11-04 10:07 ` Jan Kiszka
2018-11-04 20:20 ` Jan Kiszka
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=57177149-44b1-0876-7c5c-49d687b42267@siemens.com \
--to=claudius.heine.ext@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=mosipov@ilbers.de \
/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