All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: roman.nazarenko@leica-geosystems.com,
	 openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] classes-global/license: create -lic package from PKGD, not D
Date: Fri, 28 Aug 2026 14:59:36 +0100	[thread overview]
Message-ID: <3dda3b72d10c8f3021a4c97d68beb2b2b4b7da0a.camel@linuxfoundation.org> (raw)
In-Reply-To: <20260827155227.813074-1-roman.nazarenko@leica-geosystems.com>

On Thu, 2026-08-27 at 17:52 +0200, roman.nazarenko via lists.openembedded.org wrote:
> From: Roman Nazarenko <roman.nazarenko@leica-geosystems.com>
> 
> do_package and do_populate_sysroot are siblings - both are only ordered
> "after do_install" - so they run concurrently. With
> LICENSE_CREATE_PACKAGE=1, perform_packagecopy:prepend wrote the
> LIC_FILES_CHKSUM texts straight into ${D}${datadir}/licenses/${PN}/,
> mutating the very tree do_populate_sysroot stages with find|cpio:
> 
>   | DEBUG: Executing shell function sysroot_stage_all
>   | cpio: ./licenses/libmodule/LICENSE: Cannot stat: No such file or directory
>   | WARNING: exit code 2 from a shell command.
> 
> copy_license_files() removes and re-links an already existing
> destination, so a file can be listed by find and gone by the time cpio
> stats it.
> 
> Write into ${PKGD} from a perform_packagecopy:append instead. By then
> ${D} is complete and untouched, and ${PKGD} is a private copy that
> do_populate_sysroot never reads. Package contents, on-target paths and
> ownership are unchanged - do_package is a fakeroot task, so the
> os.chown() in copy_license_files() still applies. As a side effect the
> license texts stop being staged into every target recipe's sysroot,
> which they had no business being in.
> 
> This changes perform_packagecopy, so do_package basehashes change for
> every recipe; expect a one-time repackage.
> 
> Signed-off-by: Roman Nazarenko <roman.nazarenko@leica-geosystems.com>
> ---
>  meta/classes-global/license.bbclass | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes-global/license.bbclass b/meta/classes-global/license.bbclass
> index 86c9ee5878..1d266dd25d 100644
> --- a/meta/classes-global/license.bbclass
> +++ b/meta/classes-global/license.bbclass
> @@ -38,14 +38,15 @@ python do_populate_lic() {
>      oe.qa.exit_if_errors(d)
>  }
>  
> -# it would be better to copy them in do_install:append, but find_license_files is python
> -python perform_packagecopy:prepend () {
> +# Write into PKGD, not D: do_populate_sysroot stages D concurrently and races
> +# with the remove-then-relink in copy_license_files().
> +python perform_packagecopy:append () {
>      enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d)
>      if d.getVar('CLASSOVERRIDE') == 'class-target' and enabled:
>          lic_files_paths = find_license_files(d)
>  
> -        # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY
> -        destdir = d.getVar('D') + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY'), d.getVar('PN'))
> +        # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join PKGD and LICENSE_FILES_DIRECTORY
> +        destdir = d.getVar('PKGD') + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY'), d.getVar('PN'))
>          copy_license_files(lic_files_paths, destdir)
>          add_package_and_files(d)
>  }

The comment you removed does still apply. Could you instead try making
this a do_install postfunc? I suspect those didn't exist when this was
written.

Cheers,

Richard




      reply	other threads:[~2026-08-28 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 15:52 [PATCH] classes-global/license: create -lic package from PKGD, not D roman.nazarenko
2026-08-28 13:59 ` Richard Purdie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3dda3b72d10c8f3021a4c97d68beb2b2b4b7da0a.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=roman.nazarenko@leica-geosystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.