Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Alexander Kanavin <alex.kanavin@gmail.com>
Cc: openembedded-core@lists.openembedded.org,
	Alexander Kanavin <alex@linutronix.de>
Subject: Re: [OE-core] [PATCH 1/4] devtool: account for sources in UNPACKDIR
Date: Thu, 24 Apr 2025 21:34:49 +0100	[thread overview]
Message-ID: <db5f670164880a45133b2133b3957214b3ff0880.camel@linuxfoundation.org> (raw)
In-Reply-To: <CANNYZj_j9TnJGEsfQ9fuivKQ0KcZgSyCc-OXbyXvzOuy2=S68g@mail.gmail.com>

On Thu, 2025-04-24 at 21:36 +0200, Alexander Kanavin wrote:
> On Thu, 24 Apr 2025 at 15:50, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > Stepping back further, we had this mess in devtool in the first
> > place
> > as it could never work out which files in WORKDIR were "sources"
> > which
> > it needed to handle carefully.
> > 
> > We now define UNPACKDIR as the place we unpack files to. devtool in
> > theory can therefore just redefine UNPACKDIR and WORKDIR and things
> > should 'just work'. The relation of the subpaths between the two
> > should
> > remain the same.
> 
> I still struggle to understand this argument. As far as I see, to
> determine where is the 'source tree', devtool cannot avoid looking at
> both WORKDIR and S (and now, UNPACKDIR too) and then calculate
> something reasonable out of both (and with UNPACKDIR in the mix, all
> three).
> 
> Let me describe this step by step what happens without the patch.
> 
> 1. devtool manages a 'workspace': a special layer under
> build/workspace/. Part of the workspace is sources/: a place where
> source trees are placed. When a recipe is taken into workspace, its
> source tree is placed under build/workspace/sources/${PN}/.
> 
> 2. How does devtool determine where to take the source tree from? It
> sets WORKDIR to a temporary location under the real oe-core workdir,
> and then performs an unpack operation.

Why can't it set UNPACKDIR to the the workspace path and then just run
it to directly unpack to where it wants it?

It can then redefine UNPACKDIR to point at the workspace path and
things should "just work"?

>  Then it, somehow, needs to find
> the source tree under that temporary WORKDIR. It cannot simply use S:
> this can be set to a nested sub-directory deep inside the actual
> source tree. It cannot use WORKDIR either: this is not the source
> tree in almost all cases (and is now forbidden anyway).

It can however use UNPACKDIR?
> 
> 3. Let's say WORKDIR is set to /some/path/to/workdir, and S is then
> /some/path/to/workdir/git/some/subpath/. (via S =
> "${WORKDIR}/git/some/subpath")
> 
> devtool does this:
> 
> a) use os.path.relpath on WORKDIR and S to obtain git/some/subpath
> part
> b) then it splits that part into individual directories and take the
> first one: 'git'
> c) then it's appended to WORKDIR: /some/path/to/workdir/git
> d) then devtool uses shutil.move to move/rename that into workspace,
> so /some/path/to/workdir/git becomes build/workspace/sources/${PN}
> 
> All fine, so far. What happens if the recipe sets S =
> "${UNPACKDIR}/git/some/subpath? The same calculation as in point
> three
> will yield UNPACKDIR (incorrect), instead of UNPACKDIR/git (correct).
> And this is what the patch is aiming to address: it changes the code
> to first check if S is under UNPACKDIR, and if so, performs the
> calculation in point three relative to UNPACKDIR. Otherwise, it's
> performed relative to WORKDIR, as before.
> 
> The argument I can't understand is that devtool can somehow avoid
> looking at S altogether, and achieve the right thing by just
> redefining UNPACKDIR and WORKDIR and removing the logic described
> above, but how? How would we end up with the correct source tree in
> the workspace then?

A recipe doesn't have a single source tree but a set of sources, which
is the contents of UNPACKDIR. do_unpack has some horrible magic moving
which moves the sources into the expected place for the magic value of
S (see the SOURCE_BASEDIR mess) and this is perhaps confusing things.

In my mind, I'm thinking we ultimately stop that move and put a symlink
in place instead for compatibility. There were some issues with
autotools and symlinks when I last tried iirc but I'm digressing...

From memory, one of the devtool issues was that it couldn't track and
customise some of the input sources such as standalone files. The
UNPACKDIR changes were intended to give us a path forward so we could
actually handle the full set of sources rather than just the "S"
contents.

So I still believe there is some kind of simplification/improvement we
probably can make here...

Cheers,

Richard








  reply	other threads:[~2025-04-24 20:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 11:10 [PATCH 1/4] devtool: account for sources in UNPACKDIR Alexander Kanavin
2025-04-24 11:10 ` [PATCH 2/4] tcf-agent: update SRC_URI to https://gitlab.eclipse.org Alexander Kanavin
2025-04-24 11:10 ` [PATCH 3/4] libarchive: correct upstream version check Alexander Kanavin
2025-04-24 11:10 ` [PATCH 4/4] libunwind: use github-releases class to determine latest versions Alexander Kanavin
2025-04-24 11:32 ` [OE-core] [PATCH 1/4] devtool: account for sources in UNPACKDIR Richard Purdie
2025-04-24 11:44   ` Alexander Kanavin
2025-04-24 12:13     ` Richard Purdie
     [not found]     ` <18394019E7982924.8448@lists.openembedded.org>
2025-04-24 12:14       ` Richard Purdie
2025-04-24 12:41         ` Alexander Kanavin
2025-04-24 13:50           ` Richard Purdie
2025-04-24 17:36             ` Adrian Freihofer
2025-04-24 19:49               ` Alexander Kanavin
2025-04-24 19:36             ` Alexander Kanavin
2025-04-24 20:34               ` Richard Purdie [this message]
2025-04-25  8:33                 ` Alexander Kanavin
2025-04-25  9:31                   ` Richard Purdie
2025-04-25 17:29                     ` Alexander Kanavin
2025-04-30 10:20                       ` Richard Purdie

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=db5f670164880a45133b2133b3957214b3ff0880.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=alex.kanavin@gmail.com \
    --cc=alex@linutronix.de \
    --cc=openembedded-core@lists.openembedded.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox