public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH 2/6] Add clean and cleanall tasks
Date: Tue, 13 Feb 2018 15:49:48 +0300	[thread overview]
Message-ID: <a51e803e-7155-57c5-3109-806821132449@ilbers.de> (raw)
In-Reply-To: <dd41e8f95d4ead42c5497f895e6e4afe35129b03.1518422347.git.jan.kiszka@siemens.com>

On 02/12/2018 10:59 AM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Derived from OE, this adds clean and cleanall tasks for Isar. The clean
> task comes with CLEANFUNCS hook, we just run them prior to cleaning the
> WORKDIR. This is used by dpkg-base to remove all packages from isar-apt
> that the build may have deployed.
> 
> As we are at it, also do a repo clean prior to deploying a package -
> just in case something triggers a partial rebuild without prior
> cleaning...
> 

Very good! :-)

I think, we also should erase the package's "PROVIDES" from buildchroot 
(like libhello-dev). This could be implemented later in next series.

Alex

> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>   meta/classes/base.bbclass      | 35 ++++++++++++++++++++++++++++++++++-
>   meta/classes/dpkg-base.bbclass | 14 ++++++++++++++
>   2 files changed, 48 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 0fa27db..b0e174e 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -110,4 +110,37 @@ python base_do_build () {
>       bb.note("Try running the 'listtasks' task against a .bb to see what tasks are defined.")
>   }
>   
> -EXPORT_FUNCTIONS do_clean do_mrproper do_build
> +EXPORT_FUNCTIONS do_build
> +
> +CLEANFUNCS ?= ""
> +
> +# Derived from OpenEmbedded Core: meta/classes/utility-tasks.bbclass
> +addtask clean
> +do_clean[nostamp] = "1"
> +python do_clean() {
> +    import subprocess
> +
> +    for f in (d.getVar('CLEANFUNCS', True) or '').split():
> +        bb.build.exec_func(f, d)
> +
> +    dir = d.expand("${WORKDIR}")
> +    subprocess.call('sudo rm -rf ' + dir, shell=True)
> +
> +    dir = "%s.*" % bb.data.expand(d.getVar('STAMP', False), d)
> +    subprocess.call('sudo rm -rf ' + dir, shell=True)
> +}
> +
> +# Derived from OpenEmbedded Core: meta/classes/base.bbclass
> +addtask cleanall after do_clean
> +do_cleanall[nostamp] = "1"
> +python do_cleanall() {
> +    src_uri = (d.getVar('SRC_URI', True) or "").split()
> +    if len(src_uri) == 0:
> +        return
> +
> +    try:
> +        fetcher = bb.fetch2.Fetch(src_uri, d)
> +        fetcher.clean()
> +    except bb.fetch2.BBFetchException as e:
> +        bb.fatal(str(e))
> +}
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 69c8ad5..a45fbce 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -31,8 +31,22 @@ do_build() {
>       sudo rmdir ${BUILDROOT} 2>/dev/null || true
>   }
>   
> +CLEANFUNCS += "repo_clean"
> +
> +repo_clean() {
> +    PACKAGES=$(cd ${WORKDIR}; ls *.deb | sed 's/\([^_]*\).*/\1/')
> +    if [ -n "${PACKAGES}" ]; then
> +        reprepro -b ${DEPLOY_DIR_APT}/${DISTRO} \
> +                 --dbdir ${DEPLOY_DIR_DB}/${DISTRO} \
> +                 -C main \
> +                 remove ${DEBDISTRONAME} \
> +                 ${PACKAGES}
> +    fi
> +}
> +
>   # Install package to Isar-apt
>   do_deploy_deb() {
> +    repo_clean
>       reprepro -b ${DEPLOY_DIR_APT}/${DISTRO} \
>                --dbdir ${DEPLOY_DIR_DB}/${DISTRO} \
>                -C main \
> 

  reply	other threads:[~2018-02-13 12:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12  7:59 [PATCH 0/6] Add support for automatic partial rebuilds on recipe changes Jan Kiszka
2018-02-12  7:59 ` [PATCH 1/6] Fix indention of base_do_build Jan Kiszka
2018-02-12  7:59 ` [PATCH 2/6] Add clean and cleanall tasks Jan Kiszka
2018-02-13 12:49   ` Alexander Smirnov [this message]
2018-02-13 12:51     ` Jan Kiszka
2018-02-12  7:59 ` [PATCH 3/6] Enable recipe caching Jan Kiszka
2018-02-12  7:59 ` [PATCH 4/6] Enable proper rebuilds on dependency changes Jan Kiszka
2018-02-13 13:03   ` Alexander Smirnov
2018-02-13 16:21     ` Jan Kiszka
2018-02-13 17:57       ` Jan Kiszka
2018-02-13 18:08         ` Alexander Smirnov
2018-02-13 18:44           ` Jan Kiszka
2018-02-13 19:02             ` Alexander Smirnov
2018-02-13 19:22               ` Jan Kiszka
2018-02-13 19:38                 ` Alexander Smirnov
2018-02-13 20:04                   ` Jan Kiszka
2018-02-12  7:59 ` [PATCH 5/6] dpkg-raw: Clean DEBIAN dir prior to filling it Jan Kiszka
2018-02-13 14:06   ` Alexander Smirnov
2018-02-13 16:22     ` Jan Kiszka
2018-02-13 16:31       ` Alexander Smirnov
2018-02-13 16:33         ` Jan Kiszka
2018-02-12  7:59 ` [PATCH 6/6] isar-image-base: Clean rootfs folder prior to building Jan Kiszka
2018-02-13 13:49   ` Alexander Smirnov
2018-02-13 16:24     ` Jan Kiszka
2018-02-13  7:40 ` [PATCH 0/6] Add support for automatic partial rebuilds on recipe changes Jan Kiszka
2018-02-13 14:01 ` Alexander Smirnov
2018-02-13 16:28   ` 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=a51e803e-7155-57c5-3109-806821132449@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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