license.bbclass: remove existing license.manifest before appending new data
PATCH 1/1 license.bbclass: remove existing license.manifest before appending new data
without this fix, we append license each time we build again the same image, ending with a large not up to date file.
--- meta/classes/license.bbclass | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
meta/classes/license.bbclass +4 -0
@@ -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
Signature · 1 line
1.7.7.6
Richard Purdie
AppliedQuoted 7 lines · Eric Bénard
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 <[email protected]>--- meta/classes/license.bbclass | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
Merged to master, thanks.
Richard
Quoted 20 lines · Eric Bénard
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 <[email protected]>---
meta/classes/license.bbclass | 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)meta/classes/license.bbclass +0
-0@@ -79,6 +79,10 @@ license_create_manifest() { # Get list of installed packageslist_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
Quoted 1 line
# 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.
Signature · 1 line
Christopher Larson
Quoted 9 lines · Chris Larson
Quoted 8 lines · Eric Bénard
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 <[email protected]>---
meta/classes/license.bbclass | 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)
Quoted 16 lines
Quoted 12 lines
meta/classes/license.bbclass +0
-0@@ -79,6 +79,10 @@ license_create_manifest() { # Get list of installed packageslist_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
+ fiQuoted 1 line
# list of installed packages is broken for debProbably 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
Signature · 1 line
http://eukrea.com/en/news/104-2012
Quoted 29 lines · Eric Bénard
Quoted 9 lines · Chris Larson
Quoted 8 lines · Eric Bénard
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 <[email protected]>---
meta/classes/license.bbclass | 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)Quoted 16 lines
Quoted 12 lines
meta/classes/license.bbclass +0
-0@@ -79,6 +79,10 @@ license_create_manifest() { # Get list of installed packageslist_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
+ fiQuoted 1 line
# list of installed packages is broken for debProbably not a concern in this particular case, but in general you should avoid this sort of construct, as it's racy.
Quoted 1 line
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.
Signature · 1 line
Christopher Larson