All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Stefan Herbrechtsmeier
	<stefan.herbrechtsmeier-oss@weidmueller.com>,
	 bitbake-devel@lists.openembedded.org
Cc: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Subject: Re: [bitbake-devel] [RFC PATCH 08/15] fetch2: use localpath instead of localfile
Date: Fri, 07 Feb 2025 08:10:00 +0000	[thread overview]
Message-ID: <3b99c11f71e6f5761807bc707c215caae9643ff9.camel@linuxfoundation.org> (raw)
In-Reply-To: <e839c25a-e4d5-4a93-8c82-915336367400@weidmueller.com>

On Fri, 2025-02-07 at 09:05 +0100, Stefan Herbrechtsmeier wrote:
>  
> 
>  
>  
> Am 06.02.2025 um 17:21 schrieb Stefan Herbrechtsmeier via
> lists.openembedded.org:
>  
>  
> > Am 06.02.2025 um 16:26 schrieb Richard Purdie: 
> >  
> > > On Wed, 2025-02-05 at 08:15 +0100, Stefan Herbrechtsmeier via
> > > lists.openembedded.org wrote: 
> > >  
> > > > From: Stefan Herbrechtsmeier
> > > > <stefan.herbrechtsmeier@weidmueller.com> 
> > > >  
> > > >  Use localpath variable instead of localfile and DL_DIR
> > > > variable. 
> > > >  
> > > >  Signed-off-by: Stefan Herbrechtsmeier
> > > > <stefan.herbrechtsmeier@weidmueller.com> 
> > > >  --- 
> > > >  
> > > >    lib/bb/fetch2/az.py   | 3 +-- 
> > > >    lib/bb/fetch2/repo.py | 2 +- 
> > > >    lib/bb/fetch2/sftp.py | 3 +-- 
> > > >    lib/bb/fetch2/wget.py | 2 +- 
> > > >    4 files changed, 4 insertions(+), 6 deletions(-) 
> > > >  
> > > >  diff --git a/lib/bb/fetch2/az.py b/lib/bb/fetch2/az.py 
> > > >  index 346124a8b..1f0f1337a 100644 
> > > >  --- a/lib/bb/fetch2/az.py 
> > > >  +++ b/lib/bb/fetch2/az.py 
> > > >  @@ -49,8 +49,7 @@ class Az(Wget): 
> > > >            fetchcmd = self.basecmd + ' --retry-connrefused --
> > > > waitretry=5' 
> > > >              # We need to provide a localpath to avoid wget
> > > > using the SAS 
> > > >  -        # ud.localfile either has the downloadfilename or
> > > > ud.path 
> > > >  -        localpath = os.path.join(d.getVar("DL_DIR"),
> > > > ud.localfile) 
> > > >  +        localpath = ud.localpath 
> > > >            bb.utils.mkdirhier(os.path.dirname(localpath)) 
> > > >            fetchcmd += " -O %s" % shlex.quote(localpath) 
> > > >    diff --git a/lib/bb/fetch2/repo.py b/lib/bb/fetch2/repo.py 
> > > >  index fa4cb8149..5c0edf1f2 100644 
> > > >  --- a/lib/bb/fetch2/repo.py 
> > > >  +++ b/lib/bb/fetch2/repo.py 
> > > >  @@ -46,7 +46,7 @@ class Repo(FetchMethod): 
> > > >        def download(self, ud, d): 
> > > >            """Fetch url""" 
> > > >    -        if os.access(os.path.join(d.getVar("DL_DIR"),
> > > > ud.localfile), os.R_OK): 
> > > >  +        if os.access(ud.localpath, os.R_OK): 
> > > >                logger.debug("%s already exists (or was
> > > > stashed). Skipping repo init / sync.", ud.localpath) 
> > > >                return 
> > > >    diff --git a/lib/bb/fetch2/sftp.py b/lib/bb/fetch2/sftp.py 
> > > >  index 2a2a70a1b..b88dc5a28 100644 
> > > >  --- a/lib/bb/fetch2/sftp.py 
> > > >  +++ b/lib/bb/fetch2/sftp.py 
> > > >  @@ -82,8 +82,7 @@ class SFTP(FetchMethod): 
> > > >                port = '-P %d' % urlo.port 
> > > >                urlo.port = None 
> > > >    -        dldir = d.getVar('DL_DIR') 
> > > >  -        lpath = os.path.join(dldir, ud.localfile) 
> > > >  +        lpath = ud.localpath 
> > > >              user = '' 
> > > >            if urlo.userinfo: 
> > > >  diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py 
> > > >  index 161c66bea..1194f0e7a 100644 
> > > >  --- a/lib/bb/fetch2/wget.py 
> > > >  +++ b/lib/bb/fetch2/wget.py 
> > > >  @@ -95,7 +95,7 @@ class Wget(FetchMethod): 
> > > >            fetchcmd = self.basecmd 
> > > >              dldir = os.path.realpath(d.getVar("DL_DIR")) 
> > > >  -        localpath = os.path.join(dldir, ud.localfile) +
> > > > ".tmp" 
> > > >  +        localpath = ud.localpath + ".tmp" 
> > > >            bb.utils.mkdirhier(os.path.dirname(localpath)) 
> > > >            fetchcmd += " -O %s" % shlex.quote(localpath) 
> > > >    
> > > >  
> > >  
> > >  I put the first 8 patches of this series into a test branch and
> > > ran it 
> > >  against the autobuilder. It fails to parse, unable to find files
> > > :(. 
> > >  
> >  
> >  Thanks for the test. 
> >  
> >  
> > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/960/steps/13/logs/stdio
> > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/960/steps/13/logs/errors
> > >  
> > >  That suggests there is some breaking change in here
> > > unfortunately. 
> > >  
> >  
> >  I assume the @ in the filename is interpreter as username
> > separator . I will look into it and add a test to the selftest.
>  
> We have two solutions to decode an URI with different behavior:
>  class URI - urllib.parse.urlparse(uri)
>  def decodeurl - re.compile(...).match(uri)


decodeurl is older and predates urllib existing. People have tried to
switch things over and use urllib where possible but as you say, the
behaviour is different. I don't remember what the differences are.

>   Additionally the encode of an URI object and the encodeuri function
> have different behavior. The class use the unquoted and the function
> the quoted path. Is this behavior intended or could we use one
> implementation?


I suspect we've been preserving the old behaviour so it was intended if
a bit strange. It is hard to comment on what we could do without an
idea of what it would break and what the differences are.

Cheers,

Richard









  reply	other threads:[~2025-02-07  8:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05  7:15 [RFC PATCH 00/15] Make mirror replacement syntax explicit Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 01/15] fetch2: remove unnecessary expand function calls Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 02/15] fetch2: local: use path variable Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 03/15] fetch2: remove unnecessary unquote Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 04/15] fetch2: ssh: use common localpath handling Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 05/15] fetch2: clearcase: remove double DL_DIR from localfile Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 06/15] fetch2: remove basepath from FetchData Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 07/15] fetch2: remove basename " Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 08/15] fetch2: use localpath instead of localfile Stefan Herbrechtsmeier
2025-02-06 15:26   ` [bitbake-devel] " Richard Purdie
2025-02-06 16:21     ` Stefan Herbrechtsmeier
     [not found]     ` <1821AAFAC9C0AAD1.752@lists.openembedded.org>
2025-02-07  8:05       ` Stefan Herbrechtsmeier
2025-02-07  8:10         ` Richard Purdie [this message]
2025-02-07 12:48           ` Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 09/15] fetch2: make DOWNLOADFILENAME and PATH explicit in mirrors Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 10/15] tests: fetch: unify style of replaceuris in MirrorUriTest Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 11/15] tests: fetch: fix nonsensical " Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 12/15] tests: fetch: reenable " Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 13/15] tests: fetch: comment and add " Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 14/15] tests: fetch: add npm mirrors " Stefan Herbrechtsmeier
2025-02-05  7:15 ` [RFC PATCH 15/15] tests: fetch: fix nonsensical mirror uris in FetcherNetworkTest Stefan Herbrechtsmeier
2025-02-05 10:34 ` [bitbake-devel] [RFC PATCH 00/15] Make mirror replacement syntax explicit Richard Purdie
2025-02-05 12:12   ` Stefan Herbrechtsmeier
2025-02-20 10:22     ` Richard Purdie
2025-02-20 11:45       ` Stefan Herbrechtsmeier
2025-02-20 12:21         ` Richard Purdie
2025-02-20 17:37           ` Stefan Herbrechtsmeier
2025-02-20 22:00             ` Richard Purdie
2025-02-21 10:51               ` Stefan Herbrechtsmeier
     [not found]   ` <18214EC364EFB1B6.18160@lists.openembedded.org>
2025-02-05 12:30     ` Stefan Herbrechtsmeier

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=3b99c11f71e6f5761807bc707c215caae9643ff9.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=stefan.herbrechtsmeier-oss@weidmueller.com \
    --cc=stefan.herbrechtsmeier@weidmueller.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.