* [PATCH] rm_work.bbclass: allow a shell var to override rm_work
@ 2010-12-12 15:03 Frans Meulenbroeks
2010-12-14 12:51 ` Andreas Oberritter
0 siblings, 1 reply; 6+ messages in thread
From: Frans Meulenbroeks @ 2010-12-12 15:03 UTC (permalink / raw)
To: openembedded-devel
Sometimes one is building with rm_work, but for a specific build you want to
keep the work even if the build is successful.
One way to achieve this is to comment the INHERIT += "rm_work" from your
local.conf file, but this means that all recipes need to be reparsed which takes some time.
This patch introduces a variable KEEP_WORK
If this variable is set the work will not be removed.
Intended use is
KEEP_WORK=1 bitbake yourrecipe.bb
Default behaviour is kept the same (in case KEEP_WORK is not set)
Note that in order for this to work KEEP_WORK needs to be added to the env var BB_ENV_EXTRAWHITE
e.g. export BB_ENV_EXTRAWHITE="KEEP_WORK"
We still might want to improve the test so it only keeps the work if KEEP_WORK is > 0
(or do not execute the task at all if KEEP_WORK is not set).
Also we might want to add KEEP_WORK to the whitelist of vars that are always ok
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
---
classes/rm_work.bbclass | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/classes/rm_work.bbclass b/classes/rm_work.bbclass
index e6f3aa0..cab74cc 100644
--- a/classes/rm_work.bbclass
+++ b/classes/rm_work.bbclass
@@ -14,15 +14,18 @@ RMWORK_ORIG_TASK := "${BB_DEFAULT_TASK}"
BB_DEFAULT_TASK = "rm_work_all"
do_rm_work () {
- cd ${WORKDIR}
- for dir in *
- do
- if [ `basename ${dir}` = "temp" ]; then
- echo "Not removing temp"
- else
- echo "Removing $dir" ; rm -rf $dir
- fi
- done
+ if [ ! ${KEEP_WORK} ]
+ then
+ cd ${WORKDIR}
+ for dir in *
+ do
+ if [ `basename ${dir}` = "temp" ]; then
+ echo "Not removing temp"
+ else
+ echo "Removing $dir" ; rm -rf $dir
+ fi
+ done
+ fi
}
addtask rm_work after do_${RMWORK_ORIG_TASK}
--
1.6.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] rm_work.bbclass: allow a shell var to override rm_work
2010-12-12 15:03 [PATCH] rm_work.bbclass: allow a shell var to override rm_work Frans Meulenbroeks
@ 2010-12-14 12:51 ` Andreas Oberritter
2010-12-14 19:23 ` Frans Meulenbroeks
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Oberritter @ 2010-12-14 12:51 UTC (permalink / raw)
To: openembedded-devel
On 12/12/2010 04:03 PM, Frans Meulenbroeks wrote:
> Sometimes one is building with rm_work, but for a specific build you want to
> keep the work even if the build is successful.
> One way to achieve this is to comment the INHERIT += "rm_work" from your
> local.conf file, but this means that all recipes need to be reparsed which takes some time.
>
> This patch introduces a variable KEEP_WORK
> If this variable is set the work will not be removed.
> Intended use is
> KEEP_WORK=1 bitbake yourrecipe.bb
> Default behaviour is kept the same (in case KEEP_WORK is not set)
>
> Note that in order for this to work KEEP_WORK needs to be added to the env var BB_ENV_EXTRAWHITE
> e.g. export BB_ENV_EXTRAWHITE="KEEP_WORK"
>
> We still might want to improve the test so it only keeps the work if KEEP_WORK is > 0
> (or do not execute the task at all if KEEP_WORK is not set).
> Also we might want to add KEEP_WORK to the whitelist of vars that are always ok
>
> Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
I'd prefer a variable with a prefix like OE_, but that's probably just a
matter of taste. Are there any guidelines?
This patch motivates me to enable rm_work by default for our distro. It
would be nice if this variable would become documented on the wiki.
Acked-by: Andreas Oberritter <obi@opendreambox.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rm_work.bbclass: allow a shell var to override rm_work
2010-12-14 12:51 ` Andreas Oberritter
@ 2010-12-14 19:23 ` Frans Meulenbroeks
0 siblings, 0 replies; 6+ messages in thread
From: Frans Meulenbroeks @ 2010-12-14 19:23 UTC (permalink / raw)
To: openembedded-devel
2010/12/14 Andreas Oberritter <obi@opendreambox.org>:
> On 12/12/2010 04:03 PM, Frans Meulenbroeks wrote:
>> Sometimes one is building with rm_work, but for a specific build you want to
>> keep the work even if the build is successful.
>> One way to achieve this is to comment the INHERIT += "rm_work" from your
>> local.conf file, but this means that all recipes need to be reparsed which takes some time.
>>
>> This patch introduces a variable KEEP_WORK
>> If this variable is set the work will not be removed.
>> Intended use is
>> KEEP_WORK=1 bitbake yourrecipe.bb
>> Default behaviour is kept the same (in case KEEP_WORK is not set)
>>
>> Note that in order for this to work KEEP_WORK needs to be added to the env var BB_ENV_EXTRAWHITE
>> e.g. export BB_ENV_EXTRAWHITE="KEEP_WORK"
>>
>> We still might want to improve the test so it only keeps the work if KEEP_WORK is > 0
>> (or do not execute the task at all if KEEP_WORK is not set).
>> Also we might want to add KEEP_WORK to the whitelist of vars that are always ok
>>
>> Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
>
> I'd prefer a variable with a prefix like OE_, but that's probably just a
> matter of taste. Are there any guidelines?
>
> This patch motivates me to enable rm_work by default for our distro. It
> would be nice if this variable would become documented on the wiki.
>
> Acked-by: Andreas Oberritter <obi@opendreambox.org>
>
>
I can document it if it becomes accepted behaviour.
Wrt the naming: I have no real preference.
I'm not aware of any guidelines
Frans
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rm_work.bbclass: allow a shell var to override rm_work
2010-12-13 8:43 ` Tian, Kevin
@ 2010-12-13 10:42 ` Frans Meulenbroeks
0 siblings, 0 replies; 6+ messages in thread
From: Frans Meulenbroeks @ 2010-12-13 10:42 UTC (permalink / raw)
To: Tian, Kevin; +Cc: poky
2010/12/13 Tian, Kevin <kevin.tian@intel.com>:
>>From: Frans Meulenbroeks
>>Sent: Sunday, December 12, 2010 11:02 PM
>>
>>Sometimes one is building with rm_work, but for a specific build you want to
>>keep the work even if the build is successful.
>>One way to achieve this is to comment the INHERIT += "rm_work" from your
>>local.conf file, but this means that all recipes need to be reparsed which takes some time.
>>
>>This patch introduces a variable KEEP_WORK
>>If this variable is set the work will not be removed.
>>Intended use is
>>KEEP_WORK=1 bitbake yourrecipe.bb
>>Default behaviour is kept the same (in case KEEP_WORK is not set)
>>
>>Note that in order for this to work KEEP_WORK needs to be added to the env var
>>BB_ENV_EXTRAWHITE
>>e.g. export BB_ENV_EXTRAWHITE="KEEP_WORK"
>>
>>We still might want to improve the test so it only keeps the work if KEEP_WORK is > 0
>>(or do not execute the task at all if KEEP_WORK is not set).
>>Also we might want to add KEEP_WORK to the whitelist of vars that are always ok
>
> Is it useful to further extend this KEEP_WORK option to allow task-based selection?
> For example, I may only be interested on the sysroot installation path, and thus:
>
> KEEP_WORK="install populate_sysroot" bitbake yourrecipe.bb
>
> Currently the scope of rm_work is just binary: keep all or remove all. A finer granule
> control gives us flexibility to concentrate on several tasks which most likely causes
> trouble while still able to reduce the footprint.
>
> Comment? :-)
>
> Thanks
> Kevin
>
Seems a good plan to me, but it is beyond my capabilities to implement that.
It is useful to have an easy way to keep all though.
e.g. KEEP_WORK="all".
I don't think it is desirable to have to say
KEEP_WORK="configure compile install package ..." to keep all.
The typical use case for me is to keep either nothing because I want
to save space, or keep all because for some reason the package has an
issue or for some other reason I want to examine the log.
In the latter case I prefer having a little bit too much above having
a little bit too little.
Best regards, Frans
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rm_work.bbclass: allow a shell var to override rm_work
2010-12-12 15:02 Frans Meulenbroeks
@ 2010-12-13 8:43 ` Tian, Kevin
2010-12-13 10:42 ` Frans Meulenbroeks
0 siblings, 1 reply; 6+ messages in thread
From: Tian, Kevin @ 2010-12-13 8:43 UTC (permalink / raw)
To: Frans Meulenbroeks, poky
>From: Frans Meulenbroeks
>Sent: Sunday, December 12, 2010 11:02 PM
>
>Sometimes one is building with rm_work, but for a specific build you want to
>keep the work even if the build is successful.
>One way to achieve this is to comment the INHERIT += "rm_work" from your
>local.conf file, but this means that all recipes need to be reparsed which takes some time.
>
>This patch introduces a variable KEEP_WORK
>If this variable is set the work will not be removed.
>Intended use is
>KEEP_WORK=1 bitbake yourrecipe.bb
>Default behaviour is kept the same (in case KEEP_WORK is not set)
>
>Note that in order for this to work KEEP_WORK needs to be added to the env var
>BB_ENV_EXTRAWHITE
>e.g. export BB_ENV_EXTRAWHITE="KEEP_WORK"
>
>We still might want to improve the test so it only keeps the work if KEEP_WORK is > 0
>(or do not execute the task at all if KEEP_WORK is not set).
>Also we might want to add KEEP_WORK to the whitelist of vars that are always ok
Is it useful to further extend this KEEP_WORK option to allow task-based selection?
For example, I may only be interested on the sysroot installation path, and thus:
KEEP_WORK="install populate_sysroot" bitbake yourrecipe.bb
Currently the scope of rm_work is just binary: keep all or remove all. A finer granule
control gives us flexibility to concentrate on several tasks which most likely causes
trouble while still able to reduce the footprint.
Comment? :-)
Thanks
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] rm_work.bbclass: allow a shell var to override rm_work
@ 2010-12-12 15:02 Frans Meulenbroeks
2010-12-13 8:43 ` Tian, Kevin
0 siblings, 1 reply; 6+ messages in thread
From: Frans Meulenbroeks @ 2010-12-12 15:02 UTC (permalink / raw)
To: poky
Sometimes one is building with rm_work, but for a specific build you want to
keep the work even if the build is successful.
One way to achieve this is to comment the INHERIT += "rm_work" from your
local.conf file, but this means that all recipes need to be reparsed which takes some time.
This patch introduces a variable KEEP_WORK
If this variable is set the work will not be removed.
Intended use is
KEEP_WORK=1 bitbake yourrecipe.bb
Default behaviour is kept the same (in case KEEP_WORK is not set)
Note that in order for this to work KEEP_WORK needs to be added to the env var BB_ENV_EXTRAWHITE
e.g. export BB_ENV_EXTRAWHITE="KEEP_WORK"
We still might want to improve the test so it only keeps the work if KEEP_WORK is > 0
(or do not execute the task at all if KEEP_WORK is not set).
Also we might want to add KEEP_WORK to the whitelist of vars that are always ok
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
---
meta/classes/rm_work.bbclass | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass
index 53fcda2..45d2830 100644
--- a/meta/classes/rm_work.bbclass
+++ b/meta/classes/rm_work.bbclass
@@ -14,22 +14,25 @@ RMWORK_ORIG_TASK := "${BB_DEFAULT_TASK}"
BB_DEFAULT_TASK = "rm_work_all"
do_rm_work () {
- # Ensure pseudo is no longer active
- if [ -d ${WORKDIR}/pseudo ]; then
- ${FAKEROOT} -S
- fi
- cd ${WORKDIR}
- for dir in *
- do
- if [ `basename ${S}` = $dir ]; then
- rm -rf $dir
- elif [ $dir != 'temp' ]; then
- rm -rf $dir
+ if [ ! $KEEP_WORK ]
+ then
+ # Ensure pseudo is no longer active
+ if [ -d ${WORKDIR}/pseudo ]; then
+ ${FAKEROOT} -S
fi
- done
- # Need to add pseudo back or subsqeuent work in this workdir
- # might fail since setscene may not rerun to recreate it
- mkdir ${WORKDIR}/pseudo/
+ cd ${WORKDIR}
+ for dir in *
+ do
+ if [ `basename ${S}` = $dir ]; then
+ rm -rf $dir
+ elif [ $dir != 'temp' ]; then
+ rm -rf $dir
+ fi
+ done
+ # Need to add pseudo back or subsqeuent work in this workdir
+ # might fail since setscene may not rerun to recreate it
+ mkdir ${WORKDIR}/pseudo/
+ fi
}
addtask rm_work after do_${RMWORK_ORIG_TASK}
--
1.6.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-12-14 19:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-12 15:03 [PATCH] rm_work.bbclass: allow a shell var to override rm_work Frans Meulenbroeks
2010-12-14 12:51 ` Andreas Oberritter
2010-12-14 19:23 ` Frans Meulenbroeks
-- strict thread matches above, loose matches on Subject: below --
2010-12-12 15:02 Frans Meulenbroeks
2010-12-13 8:43 ` Tian, Kevin
2010-12-13 10:42 ` Frans Meulenbroeks
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.