Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: Christian Stewart <christian@aperture.us>,
	Ricardo Martincoski <ricardo.martincoski@datacom.com.br>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 3/3] utils/checkpackagelib: add RemoveDefaultPackageCpeIdProductVariable
Date: Sun, 4 Feb 2024 14:58:00 +0100	[thread overview]
Message-ID: <Zb-X6P9fUI5FEWvj@landeda> (raw)
In-Reply-To: <20240204133557.1512951-3-fontaine.fabrice@gmail.com>

Fabrice, All,

Thanks for working on my suggestion! Sorry, I was not quick enough that
I was tackling it on my side... See below for some comments...

On 2024-02-04 14:35 +0100, Fabrice Fontaine spake thusly:
> As advised by Yann E. Morin [1], add
> RemoveDefaultPackageCpeIdProductVariable
> 
> [1]: https://patchwork.ozlabs.org/project/buildroot/patch/20240204103204.1415592-1-fontaine.fabrice@gmail.com
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  utils/checkpackagelib/lib_mk.py | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py
> index 551c87168f..b5cfdd7f41 100644
> --- a/utils/checkpackagelib/lib_mk.py
> +++ b/utils/checkpackagelib/lib_mk.py
> @@ -227,6 +227,24 @@ class RemoveDefaultPackageSourceVariable(_CheckFunction):
>                      text]
>  
>  
> +class RemoveDefaultPackageCpeIdProductVariable(_CheckFunction):
> +    def before(self):
> +        package, _ = os.path.splitext(os.path.basename(self.filename))
> +        package_upper = package.replace("-", "_").upper()
> +        self.package = package
> +        self.FIND_CPE_ID_PRODUCT = re.compile(
> +            r"^{}_CPE_ID_PRODUCT\s*=\s*{}$"
> +            .format(package_upper, package, package_upper))
> +
> +    def check_line(self, lineno, text):
> +        if self.FIND_CPE_ID_PRODUCT.search(text):
> +
> +            return ["{}:{}: remove default value of _CPE_ID_PRODUCT variable "
> +                    "({}#generic-package-reference)"
> +                    .format(self.filename, lineno, self.url_to_manual),
> +                    text]

This is actually a little bit more complex than that. Indeed, if there
is no CPE variable set, we do not consider FOO_CPE_ID to be valid, but
if the user does provide one CPE variable, then we connsider FOO_CPE_ID
to be valid.

Of course, in that case, we want to allow for the CPE variable to be the
default, if that's the actual value it needs to have. But this is only
valid *if* there is only one CPE variable set.

So, I am almost done on my side, but if you want to continue on your
side, I'm totally fine with letting you do the job! Just tell me.

Regards,
Yann E. MORIN.

> +
>  class SpaceBeforeBackslash(_CheckFunction):
>      TAB_OR_MULTIPLE_SPACES_BEFORE_BACKSLASH = re.compile(r"^.*(  |\t ?)\\$")
>  
> -- 
> 2.43.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-02-04 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 13:35 [Buildroot] [PATCH 1/3] package/containerd: drop CONTAINERD_CPE_ID_VENDOR Fabrice Fontaine
2024-02-04 13:35 ` [Buildroot] [PATCH 2/3] package/libcurl: drop LIBCURL_CPE_ID_PRODUCT Fabrice Fontaine
2024-02-29 15:43   ` Peter Korsgaard
2024-02-04 13:35 ` [Buildroot] [PATCH 3/3] utils/checkpackagelib: add RemoveDefaultPackageCpeIdProductVariable Fabrice Fontaine
2024-02-04 13:58   ` Yann E. MORIN [this message]
2024-02-04 14:06     ` Fabrice Fontaine
2024-02-29 15:43 ` [Buildroot] [PATCH 1/3] package/containerd: drop CONTAINERD_CPE_ID_VENDOR Peter Korsgaard

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=Zb-X6P9fUI5FEWvj@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=christian@aperture.us \
    --cc=fontaine.fabrice@gmail.com \
    --cc=ricardo.martincoski@datacom.com.br \
    /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