Patchwork package.bbclass: don't error when the root doesn't exist in do_split_packages

login
register
mail settings
Submitter Ross Burton
Date July 25, 2012, 4:41 p.m.
Message ID <1343234476-22803-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/33045/
State New
Headers show

Comments

Ross Burton - July 25, 2012, 4:41 p.m.
If nothing has been installed in the root automake 1.12 won't install the
directory, which means os.walk will throw a file not found exception.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/package.bbclass |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Martin Jansa - July 25, 2012, 5:38 p.m.
On Wed, Jul 25, 2012 at 05:41:16PM +0100, Ross Burton wrote:
> If nothing has been installed in the root automake 1.12 won't install the
> directory, which means os.walk will throw a file not found exception.
> 
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>  meta/classes/package.bbclass |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index fc83424..85d6e81 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -74,6 +74,12 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
>      given package, usually plugins or modules.
>      """
>  
> +    dvar = d.getVar('PKGD', True)
> +
> +    # If the root doesn't exist, return early
> +    if not os.path.exists(dvar + root):
> +        return
> +
>      ml = d.getVar("MLPREFIX", True)
>      if ml:
>          if not output_pattern.startswith(ml):
> @@ -88,8 +94,6 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
>          if newdeps:
>              extra_depends = " ".join(newdeps)
>  
> -    dvar = d.getVar('PKGD', True)
> -
>      packages = d.getVar('PACKAGES', True).split()
>  
>      if postinst:

Isn't this real error which shouldn't be covered by this?

e.g. if someone removes or loose tmp-eglibc/work/foo/image (happens
to me all the time because tmp-eglibc is on tmpfs) then do_package is
reexecuted when sstate checksum is changed (even with
BB_SIGNATURE_HANDLER = "OEBasic") and in some cases it successfully
repackage .ipk files which are now empty and in some cases it fails
(e.g. with systemd.bbclass checking that requested .service files are
available in package during do_package).

Cheers,
Ross Burton - July 26, 2012, 11:41 a.m.
On 25 July 2012 18:38, Martin Jansa <martin.jansa@gmail.com> wrote:
> Isn't this real error which shouldn't be covered by this?
>
> e.g. if someone removes or loose tmp-eglibc/work/foo/image (happens
> to me all the time because tmp-eglibc is on tmpfs) then do_package is
> reexecuted when sstate checksum is changed (even with
> BB_SIGNATURE_HANDLER = "OEBasic") and in some cases it successfully
> repackage .ipk files which are now empty and in some cases it fails
> (e.g. with systemd.bbclass checking that requested .service files are
> available in package during do_package).

In that case it really should fail before do_split_packages() is called, surely?

Ross

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index fc83424..85d6e81 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -74,6 +74,12 @@  def do_split_packages(d, root, file_regex, output_pattern, description, postinst
     given package, usually plugins or modules.
     """
 
+    dvar = d.getVar('PKGD', True)
+
+    # If the root doesn't exist, return early
+    if not os.path.exists(dvar + root):
+        return
+
     ml = d.getVar("MLPREFIX", True)
     if ml:
         if not output_pattern.startswith(ml):
@@ -88,8 +94,6 @@  def do_split_packages(d, root, file_regex, output_pattern, description, postinst
         if newdeps:
             extra_depends = " ".join(newdeps)
 
-    dvar = d.getVar('PKGD', True)
-
     packages = d.getVar('PACKAGES', True).split()
 
     if postinst: