diff mbox series

[v3] Update documentation and add extra check for az fetcher. AZ_SAS token should be prefixed with a question mark.

Message ID 20250601201505.177262-1-robbin.vandamme@renson.be
State New
Headers show
Series [v3] Update documentation and add extra check for az fetcher. AZ_SAS token should be prefixed with a question mark. | expand

Commit Message

Robbin Van Damme June 1, 2025, 8:15 p.m. UTC
From: Robbin Van Damme <robbinvandamme@gmail.com>

Signed-off-by: Robbin Van Damme <robbinvandamme@gmail.com>
---
 doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | 4 ++--
 lib/bb/fetch2/az.py                                      | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Quentin Schulz June 2, 2025, 9:49 a.m. UTC | #1
Hi Robbin,

On 6/1/25 10:15 PM, robbin van damme via lists.openembedded.org wrote:
> From: Robbin Van Damme <robbinvandamme@gmail.com>
> 

We typically do not accept commits with empty logs, so please provide 
some backstory for this patch.

> Signed-off-by: Robbin Van Damme <robbinvandamme@gmail.com>
> ---
>   doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | 4 ++--
>   lib/bb/fetch2/az.py                                      | 4 ++++

I would highly recommend to split this into two commits, one for the 
documentation and one for the added FetchError, those are typically 
reviewed by different people.

Also, patches to the doc (yes, even the BitBake docs) should be Cc'ed to 
the yocto-docs mailing list, c.f. 
https://git.openembedded.org/bitbake/tree/README#n32

I see that Richard has already merged that patch, so just think about it 
for the next one(s) to come :)

Thanks!
Quentin
Richard Purdie June 2, 2025, 10:04 a.m. UTC | #2
On Mon, 2025-06-02 at 11:49 +0200, Quentin Schulz via
lists.openembedded.org wrote:
> Hi Robbin,
> 
> On 6/1/25 10:15 PM, robbin van damme via lists.openembedded.org
> wrote:
> > From: Robbin Van Damme <robbinvandamme@gmail.com>
> > 
> 
> We typically do not accept commits with empty logs, so please provide
> some backstory for this patch.
> 
> > Signed-off-by: Robbin Van Damme <robbinvandamme@gmail.com>
> > ---
> >   doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | 4 ++--
> >   lib/bb/fetch2/az.py                                      | 4 ++++
> 
> I would highly recommend to split this into two commits, one for the 
> documentation and one for the added FetchError, those are typically 
> reviewed by different people.
> 
> Also, patches to the doc (yes, even the BitBake docs) should be Cc'ed
> to 
> the yocto-docs mailing list, c.f. 
> https://git.openembedded.org/bitbake/tree/README#n32
> 
> I see that Richard has already merged that patch, so just think about
> it for the next one(s) to come :)

It is in master-next, so not quite merged yet. I did tweak the commit
message to the correct form (subject prefixed with fetch/az, added bug
reference and reworded).

In this case I'm probably ok tweaking the docs at the same time as the
code since it is all clearly related and they're in the same repo.

Cheers,

Richard
diff mbox series

Patch

diff --git a/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
index fb4f0a23d..eac3cbdfb 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -686,9 +686,9 @@  Such functionality is set by the variable:
    delegate access to resources, if this variable is set, the Az Fetcher will
    use it when fetching artifacts from the cloud.
 
-You can specify the AZ_SAS variable as shown below::
+You can specify the AZ_SAS variable prefixed with a ? as shown below::
 
-   AZ_SAS = "se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>"
+   AZ_SAS = "?se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>"
 
 Here is an example URL::
 
diff --git a/lib/bb/fetch2/az.py b/lib/bb/fetch2/az.py
index 346124a8b..1d3664f21 100644
--- a/lib/bb/fetch2/az.py
+++ b/lib/bb/fetch2/az.py
@@ -36,6 +36,8 @@  class Az(Wget):
 
         az_sas = d.getVar('AZ_SAS')
         if az_sas and az_sas not in ud.url:
+            if not az_sas.startswith('?'):
+                raise FetchError("When using AZ_SAS, it must start with a '?' character to mark the start of the query-parameters.")
             ud.url += az_sas
 
         return Wget.checkstatus(self, fetch, ud, d, try_again)
@@ -62,6 +64,8 @@  class Az(Wget):
         az_sas = d.getVar('AZ_SAS')
 
         if az_sas:
+            if not az_sas.startswith('?'):
+                raise FetchError("When using AZ_SAS, it must start with a '?' character to mark the start of the query-parameters.")
             azuri = '%s%s%s%s' % ('https://', ud.host, ud.path, az_sas)
         else:
             azuri = '%s%s%s' % ('https://', ud.host, ud.path)