public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Claudius Heine <claudius.heine.ext@siemens.com>
To: "Maxim Yu. Osipov" <mosipov@ilbers.de>
Cc: isar-users@googlegroups.com, Claudius Heine <ch@denx.de>
Subject: Re: [PATCH v4 1/3] isar-bootstrap|configscript: implement one shot config option
Date: Tue, 29 May 2018 10:20:38 +0200	[thread overview]
Message-ID: <da066a1b-fdc0-98c9-3a3b-ff51fd32dd7b@siemens.com> (raw)
In-Reply-To: <6193ea08-16c2-b1be-c0d5-f571ff99d9db@ilbers.de>

Hi Maxim,

On 2018-05-29 09:58, Maxim Yu. Osipov wrote:
> Hi Claudius,
> 
> On 05/28/2018 12:56 PM, claudius.heine.ext@siemens.com wrote:
>> From: Claudius Heine <ch@denx.de>
>>
>> Some configuration tasks on the image require certain other packages,
>> but those packages might not be required on the final image.
>>
>> One way to solve this is use a special package that is installed to the
>> image and then removed again. When installing it makes certain that all
>> required packages are installed to the image as well. Then the image
>> can be configured in the postinst hook. When this package is removed and
>> all unused dependencies are removed as well, no not required packages
>> used by this package should remain on the image.
>>
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>>   .../images/files/debian-configscript.sh       |  1 -
>>   .../images/files/raspbian-configscript.sh     |  1 -
>>   meta/classes/isar-bootstrap-helper.bbclass    | 32 ++++++++++++++++---
>>   3 files changed, 28 insertions(+), 6 deletions(-)
>>
>> diff --git 
>> a/meta-isar/recipes-core/images/files/debian-configscript.sh 
>> b/meta-isar/recipes-core/images/files/debian-configscript.sh
>> index 7ca0562..9b3ff30 100755
>> --- a/meta-isar/recipes-core/images/files/debian-configscript.sh
>> +++ b/meta-isar/recipes-core/images/files/debian-configscript.sh
>> @@ -40,4 +40,3 @@ fi
>>   # Purge unused locale and installed packages' .deb files
>>   localepurge
>> -apt-get clean
>> diff --git 
>> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh 
>> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
>> index b240de9..448dea5 100644
>> --- a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
>> +++ b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
>> @@ -40,4 +40,3 @@ kernel=$KERNEL_IMAGE
>>   EOF
>>   localepurge
>> -apt-get clean
>> diff --git a/meta/classes/isar-bootstrap-helper.bbclass 
>> b/meta/classes/isar-bootstrap-helper.bbclass
>> index 4284d02..b87c94e 100644
>> --- a/meta/classes/isar-bootstrap-helper.bbclass
>> +++ b/meta/classes/isar-bootstrap-helper.bbclass
>> @@ -5,15 +5,24 @@
>>   #
>>   # SPDX-License-Identifier: MIT
>> +IMAGE_CFG_PACKAGE ??= ""
> 
> Are you going to rename this variable to IMAGE_CFG_PACKAGES
> and add a comment it in a separate patch?

Oh, sorry. Forgot about that. I will prepare v5.

Claudius

> 
> Kind regards,
> Maxim.
> 
>> +
>> +def reverse_bb_array(d, varname):
>> +    array = d.getVar(varname, True)
>> +    if array is None:
>> +        return None
>> +    array = reversed(array.split())
>> +    return " ".join(i for i in array)
>> +
>>   setup_root_file_system() {
>>       ROOTFSDIR="$1"
>> -    CLEANHOSTLEAK="$2"
>> +    CLEAN="$2"
>>       shift
>>       shift
>>       PACKAGES="$@"
>>       APT_ARGS="install --yes --allow-unauthenticated \
>>                 -o Debug::pkgProblemResolver=yes"
>> -    CLEANHOSTLEAK_FILES="${ROOTFSDIR}/etc/hostname 
>> ${ROOTFSDIR}/etc/resolv.conf"
>> +    CLEAN_FILES="${ROOTFSDIR}/etc/hostname ${ROOTFSDIR}/etc/resolv.conf"
>>       sudo cp -Trpfx \
>>           
>> "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/" \
>> @@ -41,8 +50,23 @@ setup_root_file_system() {
>>           -o Dir::Etc::sourceparts="-" \
>>           -o APT::Get::List-Cleanup="0"
>>       sudo -E chroot "$ROOTFSDIR" \
>> -        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES
>> -    [ "clean" = ${CLEANHOSTLEAK} ] && sudo rm -f ${CLEANHOSTLEAK_FILES}
>> +        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
>> +            ${IMAGE_CFG_PACKAGE}
>> +    [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
>>       sudo -E chroot "$ROOTFSDIR" \
>>           /usr/bin/apt-get ${APT_ARGS} $PACKAGES
>> +    for pkg in ${IMAGE_CFG_PACKAGE}; do
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get ${APT_ARGS} $pkg
>> +    done
>> +    for pkg in ${@reverse_bb_array(d, "IMAGE_CFG_PACKAGE") or ""}; do
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get purge --yes $pkg
>> +    done
>> +    if [ "clean" = ${CLEAN} ]; then
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get autoremove --purge --yes
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get clean
>> +    fi
>>   }
>>
> 
> 

-- 
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

  reply	other threads:[~2018-05-29  8:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 10:56 [PATCH v4 0/3] One-shot configuration packages claudius.heine.ext
2018-05-28 10:56 ` [PATCH v4 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
2018-05-29  7:58   ` Maxim Yu. Osipov
2018-05-29  8:20     ` Claudius Heine [this message]
2018-05-29 10:56       ` Claudius Heine
2018-05-29 11:18         ` Maxim Yu. Osipov
2018-05-29 11:38           ` Claudius Heine
2018-05-28 10:56 ` [PATCH v4 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
2018-05-28 10:56 ` [PATCH v4 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
2018-05-29  8:00 ` [PATCH v4 0/3] One-shot configuration packages Baurzhan Ismagulov
2018-05-29  9:29   ` Claudius Heine

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=da066a1b-fdc0-98c9-3a3b-ff51fd32dd7b@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=ch@denx.de \
    --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