($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: "Andreas Cord-Landwehr" <cordlandwehr@kde.org>
To: bitbake-devel@lists.openembedded.org
Cc: Andreas Cord-Landwehr <cordlandwehr@kde.org>
Subject: [PATCH] fetch2/gitsm.py: handle spaces in git repository paths
Date: Tue, 27 Feb 2024 18:35:27 +0100	[thread overview]
Message-ID: <20240227173527.726401-1-cordlandwehr@kde.org> (raw)

Handle encoding of spaces for the obscure but real-world scenario of
having a git repository with submodules, where the urls to submodules
contain spaces, eg. https://example.com/foo/repo%20with%20space.git

Git submodules are referenced with single escaping, yet the fetcher
requires double-escaping of spaces.

Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
---
 bitbake/lib/bb/fetch2/gitsm.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index f7f3af7212..e37be055eb 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -23,6 +23,7 @@ import copy
 import shutil
 import tempfile
 from   bb.fetch2.git import Git
+from   bb.fetch2 import URI
 from   bb.fetch2 import runfetchcmd
 from   bb.fetch2 import logger
 from   bb.fetch2 import Fetch
@@ -93,6 +94,11 @@ class GitSM(Git):
                     newud.path = os.path.normpath(os.path.join(newud.path, uris[m]))
                     uris[m] = Git._get_repo_url(self, newud)
 
+                # Double-encode before handing over to git to handle spaces in URLs
+                double_encoded_uri = URI(uris[m])
+                double_encoded_uri.path = double_encoded_uri.path_quoted
+                uris[m] = str(double_encoded_uri)
+
         for module in submodules:
             # Translate the module url into a SRC_URI
 
-- 
2.40.1



             reply	other threads:[~2024-02-27 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 17:35 Andreas Cord-Landwehr [this message]
2024-02-28  9:21 ` [bitbake-devel] [PATCH] fetch2/gitsm.py: handle spaces in git repository paths Richard Purdie
2024-02-28 18:30   ` Andreas Cord-Landwehr

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=20240227173527.726401-1-cordlandwehr@kde.org \
    --to=cordlandwehr@kde.org \
    --cc=bitbake-devel@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).