All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Titouan Christophe <titouan.christophe@railnova.eu>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] utils/checkpackagelib/lib_mk.py: fix check for overridden variable
Date: Fri, 14 Jan 2022 17:05:19 +0100	[thread overview]
Message-ID: <87pmou716o.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20211115235336.3814968-1-ricardo.martincoski@gmail.com> (Ricardo Martincoski's message of "Mon, 15 Nov 2021 20:53:36 -0300")

>>>>> "Ricardo" == Ricardo Martincoski <ricardo.martincoski@gmail.com> writes:

 > Currently this .mk snippet results in unexpected behavior from
 > check-package:
 > |VAR_1 = VALUE1
 > |ifeq (condition)
 > |VAR_1 := $(VAR_1), VALUE2
 > |endif

 > Fix commit "163f160a8e utils/{check-package, checkpackagelib}:
 > consistently use raw strings for re.compile" that ended up doing this:
 > -    CONCATENATING = re.compile("^([A-Z0-9_]+)\s*(\+|:|)=\s*\$\(\\1\)")
 > +    CONCATENATING = re.compile(r"^([A-Z0-9_]+)\s*(\+|:|)=\s*\$\(\\1\)")

 > But raw strings do not expect escaping when referencing \1 and the
 > pattern ends up searching for a raw '\\1' instead of an occurrence of
 > the first pattern inside parenthesis.

 > |$ python3
 > |Python 3.8.10 (default, Sep 28 2021, 16:10:42)
 > |[GCC 9.3.0] on linux
 > |Type "help", "copyright", "credits" or "license" for more information.
 > |>>> import re
 > |>>> p1 = re.compile('(foo)bar\\1')
 > |>>> p2 = re.compile(r'(foo)bar\\1')
 > |>>> p3 = re.compile(r'(foo)bar\1')
 > |>>> s1 = 'foobarfoo'
 > |>>> s2 = 'foobar\\1'
 > |>>> print(p1.search(s1))
 > |<re.Match object; span=(0, 9), match='foobarfoo'>
 > |>>> print(p2.search(s1))
 > |None
 > |>>> print(p3.search(s1))
 > |<re.Match object; span=(0, 9), match='foobarfoo'>
 > |>>> print(p1.search(s2))
 > |None
 > |>>> print(p2.search(s2))
 > |<re.Match object; span=(0, 8), match='foobar\\1'>
 > |>>> print(p3.search(s2))
 > |None
 > |>>>

 > So use '\1' instead of '\\1' in the raw string.

 > Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Cc: Titouan Christophe <titouan.christophe@railnova.eu>

Committed to 2021.02.x and 2021.11.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      parent reply	other threads:[~2022-01-14 16:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 23:53 [Buildroot] [PATCH] utils/checkpackagelib/lib_mk.py: fix check for overridden variable Ricardo Martincoski
2021-12-10 19:09 ` Arnout Vandecappelle
2021-12-26 22:39 ` Thomas Petazzoni
2021-12-27 10:45   ` ricardo.martincoski
2021-12-27 11:05     ` Thomas Petazzoni
2022-01-14 16:05 ` Peter Korsgaard [this message]

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=87pmou716o.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@buildroot.org \
    --cc=ricardo.martincoski@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=titouan.christophe@railnova.eu \
    /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.