Skip to contentSkip to conversation

fixes for when SWUPD_BUNDLES is undefined

PATCH In review André Draszik 2 participants 6 messages Feb 16, 2017

lore
Share & tools
lore
#0 lore raw

cover fixes for when SWUPD_BUNDLES is undefined

Hi,

The following set of patches were necessary for me to make meta-swupd work again as we don't use SWUPD_BUNDLES.

Cheers,
Andre'

#1 lore raw

PATCH 1/3 swupd-image.bbclass: don't fail parsing if SWUPD_BUNDLES is undefined

ERROR: Error for ...image.bb, dependency ${@' does not contain exactly one ':' character.
Task 'depends' should be specified in the form 'packagename:task'
ERROR: Command execution failed: Exited with 1

---
 classes/swupd-image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
classes/swupd-image.bbclass +1 -1
index 771a416..d8383ff 100644
@@ -322,7 +322,7 @@ addtask stage_swupd_inputs after do_swupd_list_bundle before do_swupd_update
 do_stage_swupd_inputs[dirs] = "${SWUPDIMAGEDIR} ${SWUPDMANIFESTDIR} ${DEPLOY_DIR_SWUPD}/maps/"
 do_stage_swupd_inputs[depends] += " \
     virtual/fakeroot-native:do_populate_sysroot \
-    ${@ ' '.join(['bundle-${SWUPD_IMAGE_PN}-%s:do_swupd_list_bundle' % x for x in '${SWUPD_BUNDLES}'.split()]) } \
+    ${@ ' '.join(['bundle-${SWUPD_IMAGE_PN}-%s:do_swupd_list_bundle' % x for x in (d.getVar('SWUPD_BUNDLES') or '').split()]) } \
 "
 
 python do_fetch_swupd_inputs () {
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 path.py: always clean up temporary file in copyxattrfiles()

In reply to André Draszik

Use try: finally: to make sure the file is removed even on exceptions.

---
 lib/swupd/path.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
lib/swupd/path.py +6 -4
index 61e979e..a55c22c 100644
@@ -50,10 +50,12 @@ def copyxattrfiles(d, filelist, src, dst, archive=False):
             bb.fatal('Extracting files from an archive and writing into an archive not implemented yet.')
         else:
             cmd = "bsdtar --no-recursion -C %s -xf %s -T %s" % (dst, src, copyfile)
-    output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-    if output:
-        bb.fatal('Unexpected output from the following command:\n%s\n%s' % (cmd, output))
-    os.remove(copyfile)
+    try:
+        output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
+        if output:
+            bb.fatal('Unexpected output from the following command:\n%s\n%s' % (cmd, output))
+    finally:
+        os.remove(copyfile)
 
 
 def remove_empty_directories(tree):
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/3 bundles.py: fix copying of full image to full bundle when no SWUPD_BUNDLES

In reply to André Draszik

When SWUPD_BUNDLES is not set, exceptions are thrown, stopping the build - there are two issues in here:
- the debug statement references a non-existent variable, 'bundle' was renamed to fulltar
- copyxattrfiles() needs a list of files as 2nd argument, not a filename of a file which contains this list

This got broken in commit 6c097131ad39
("meta-swupd: support rm_work.bbclass") while support for rm_work was being added.

---
 lib/swupd/bundles.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/swupd/bundles.py +3 -2
index 24947a8..b4c6f49 100644
@@ -72,8 +72,9 @@ def copy_core_contents(d):
     if not havebundles:
         rootfs = d.getVar('IMAGE_ROOTFS', True)
         workdir = d.getVar('WORKDIR', True)
-        bb.debug(1, "Copying from image rootfs (%s) to full bundle (%s)" % (rootfs, bundle))
-        swupd.path.copyxattrfiles(d, source + contentsuffix, rootfs, fulltar, True)
+        bb.debug(1, "Copying from image rootfs (%s) to full bundle (%s)" % (rootfs, fulltar))
+        swupd.path.copyxattrfiles(d, swupd.utils.manifest_to_file_list(source + contentsuffix),
+                                  rootfs, fulltar, True)
     else:
         mega_archive = d.getVar('MEGA_IMAGE_ARCHIVE', True)
         if os.path.exists(fulltar):
Signature · 1 line
2.11.0
#4 lore raw

Re: [meta-swupd][PATCH 3/3] bundles.py: fix copying of full image to full bundle when no SWUPD_BUNDLES

Quoted 10 lines · André Draszik

When SWUPD_BUNDLES is not set, exceptions are thrown, stopping the build - there are two issues in here:
- the debug statement references a non-existent variable, 'bundle' was renamed to fulltar
- copyxattrfiles() needs a list of files as 2nd argument, not a filename of a file which contains this list

This got broken in commit 6c097131ad39
("meta-swupd: support rm_work.bbclass") while support for rm_work was being added.

I should have fixed that already in commit
531a8e636 "bundles.py: fix "no bundles" special case". Can you rebase onto current master and retest.

The other patches look fine, I'm just wondering why I hadn't run into that. Perhaps I was working with an empty SWUPD_BUNDLES instead of an unset one.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
#5 lore raw

Re: [meta-swupd][PATCH 3/3] bundles.py: fix copying of full image to full bundle when no SWUPD_BUNDLES

Quoted 8 lines · Patrick Ohly
Quoted 7 lines · André Draszik

When SWUPD_BUNDLES is not set, exceptions are thrown, stopping the build - there are two issues in here:
- the debug statement references a non-existent variable, 'bundle' was renamed to fulltar
- copyxattrfiles() needs a list of files as 2nd argument, not a filename of a file which contains this list

Quoted 7 lines
Quoted 3 lines

This got broken in commit 6c097131ad39
("meta-swupd: support rm_work.bbclass") while support for rm_work was being added.

I should have fixed that already in commit
531a8e636 "bundles.py: fix "no bundles" special case". Can you rebase onto current master and retest.

Never mind, my bad. The commit you mentioned is after my fix, so in other words, I fixed it, changed something, and broke it again. Clearly this whole layer needs automated test cases :-/

Something to do for a maintainer with a bit more time available. There is https://bugzilla.yoctoproject.org/show_bug.cgi?id=9783 for it, but I don't think I'll be able to work on that anytime soon.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.