* [PATCH] license.bbclass: remove existing license.manifest before appending new data
@ 2012-03-29 12:22 Eric Bénard
2012-03-29 21:24 ` Richard Purdie
2012-03-29 23:22 ` Chris Larson
0 siblings, 2 replies; 5+ messages in thread
From: Eric Bénard @ 2012-03-29 12:22 UTC (permalink / raw)
To: openembedded-core
without this fix, we append license each time we build again the same image,
ending with a large not up to date file.
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
meta/classes/license.bbclass | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 394a6d4..c85233c 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -79,6 +79,10 @@ license_create_manifest() {
# Get list of installed packages
list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest
INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest`
+ # remove existing license.manifest file
+ if [ -f ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ]; then
+ rm ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+ fi
# list of installed packages is broken for deb
for pkg in ${INSTALLED_PKGS}; do
# not the best way to do this but licenses are not arch dependant iirc
--
1.7.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] license.bbclass: remove existing license.manifest before appending new data
2012-03-29 12:22 [PATCH] license.bbclass: remove existing license.manifest before appending new data Eric Bénard
@ 2012-03-29 21:24 ` Richard Purdie
2012-03-29 23:22 ` Chris Larson
1 sibling, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2012-03-29 21:24 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, 2012-03-29 at 14:22 +0200, Eric Bénard wrote:
> without this fix, we append license each time we build again the same image,
> ending with a large not up to date file.
>
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
> meta/classes/license.bbclass | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] license.bbclass: remove existing license.manifest before appending new data
2012-03-29 12:22 [PATCH] license.bbclass: remove existing license.manifest before appending new data Eric Bénard
2012-03-29 21:24 ` Richard Purdie
@ 2012-03-29 23:22 ` Chris Larson
2012-03-30 6:20 ` Eric Bénard
1 sibling, 1 reply; 5+ messages in thread
From: Chris Larson @ 2012-03-29 23:22 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, Mar 29, 2012 at 5:22 AM, Eric Bénard <eric@eukrea.com> wrote:
> without this fix, we append license each time we build again the same image,
> ending with a large not up to date file.
>
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
> meta/classes/license.bbclass | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
> index 394a6d4..c85233c 100644
> --- a/meta/classes/license.bbclass
> +++ b/meta/classes/license.bbclass
> @@ -79,6 +79,10 @@ license_create_manifest() {
> # Get list of installed packages
> list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest
> INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest`
> + # remove existing license.manifest file
> + if [ -f ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ]; then
> + rm ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
> + fi
> # list of installed packages is broken for deb
Probably not a concern in this particular case, but in general you
should avoid this sort of construct, as it's racy.
--
Christopher Larson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] license.bbclass: remove existing license.manifest before appending new data
2012-03-29 23:22 ` Chris Larson
@ 2012-03-30 6:20 ` Eric Bénard
2012-03-30 22:41 ` Chris Larson
0 siblings, 1 reply; 5+ messages in thread
From: Eric Bénard @ 2012-03-30 6:20 UTC (permalink / raw)
To: openembedded-core
Le Thu, 29 Mar 2012 16:22:06 -0700,
Chris Larson <clarson@kergoth.com> a écrit :
> On Thu, Mar 29, 2012 at 5:22 AM, Eric Bénard <eric@eukrea.com> wrote:
> > without this fix, we append license each time we build again the same image,
> > ending with a large not up to date file.
> >
> > Signed-off-by: Eric Bénard <eric@eukrea.com>
> > ---
> > meta/classes/license.bbclass | 4 ++++
> > 1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
> > index 394a6d4..c85233c 100644
> > --- a/meta/classes/license.bbclass
> > +++ b/meta/classes/license.bbclass
> > @@ -79,6 +79,10 @@ license_create_manifest() {
> > # Get list of installed packages
> > list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest
> > INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest`
> > + # remove existing license.manifest file
> > + if [ -f ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ]; then
> > + rm ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
> > + fi
> > # list of installed packages is broken for deb
>
> Probably not a concern in this particular case, but in general you
> should avoid this sort of construct, as it's racy.
ok, what would be the right way to do that to avoid the race problem ?
Eric
--
http://eukrea.com/en/news/104-2012
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] license.bbclass: remove existing license.manifest before appending new data
2012-03-30 6:20 ` Eric Bénard
@ 2012-03-30 22:41 ` Chris Larson
0 siblings, 0 replies; 5+ messages in thread
From: Chris Larson @ 2012-03-30 22:41 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, Mar 29, 2012 at 11:20 PM, Eric Bénard <eric@eukrea.com> wrote:
> Le Thu, 29 Mar 2012 16:22:06 -0700,
> Chris Larson <clarson@kergoth.com> a écrit :
>
>> On Thu, Mar 29, 2012 at 5:22 AM, Eric Bénard <eric@eukrea.com> wrote:
>> > without this fix, we append license each time we build again the same image,
>> > ending with a large not up to date file.
>> >
>> > Signed-off-by: Eric Bénard <eric@eukrea.com>
>> > ---
>> > meta/classes/license.bbclass | 4 ++++
>> > 1 files changed, 4 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
>> > index 394a6d4..c85233c 100644
>> > --- a/meta/classes/license.bbclass
>> > +++ b/meta/classes/license.bbclass
>> > @@ -79,6 +79,10 @@ license_create_manifest() {
>> > # Get list of installed packages
>> > list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest
>> > INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest`
>> > + # remove existing license.manifest file
>> > + if [ -f ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ]; then
>> > + rm ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
>> > + fi
>> > # list of installed packages is broken for deb
>>
>> Probably not a concern in this particular case, but in general you
>> should avoid this sort of construct, as it's racy.
>
> ok, what would be the right way to do that to avoid the race problem ?
Generally speaking rather than doing "if this, then do that"
particularly with the filesystem, just do it and handle any errors. In
this case, rm -f, which exits silently if the file was already
removed.
--
Christopher Larson
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-30 22:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29 12:22 [PATCH] license.bbclass: remove existing license.manifest before appending new data Eric Bénard
2012-03-29 21:24 ` Richard Purdie
2012-03-29 23:22 ` Chris Larson
2012-03-30 6:20 ` Eric Bénard
2012-03-30 22:41 ` Chris Larson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox