public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	backports@vger.kernel.org, linux-kernel@vger.kernel.org,
	yann.morin.1998@free.fr, mmarek@suse.cz, sassmann@kpanic.de
Subject: Re: [RFC v2 3/4] backports: use BACKPORT_DIR prefix on kconfig sources
Date: Fri, 31 Oct 2014 21:03:16 +0100	[thread overview]
Message-ID: <20141031200316.GC12953@wotan.suse.de> (raw)
In-Reply-To: <1414741562.3014.8.camel@jlt4.sipsolutions.net>

On Fri, Oct 31, 2014 at 08:46:02AM +0100, Johannes Berg wrote:
> On Wed, 2014-10-29 at 01:21 -0700, Luis R. Rodriguez wrote:
> 
> >  src_line = re.compile(r'^\s*source\s+"?(?P<src>[^\s"]*)"?\s*$')
> > +bk_src_line = re.compile(r'^\s*source\s+"?\$BACKPORT_DIR/(?P<src>[^\s"]*)"?\s*$')
> >  tri_line = re.compile(r'^(?P<spc>\s+)tristate')
> >  bool_line = re.compile(r'^(?P<spc>\s+)bool')
> >  cfg_line = re.compile(r'^(?P<opt>config|menuconfig)\s+(?P<sym>[^\s]*)')
> > @@ -21,23 +22,47 @@ class ConfigTree(object):
> >          yield f
> >          for l in open(os.path.join(self.basedir, f), 'r'):
> >              m = src_line.match(l)
> > -            if m and os.path.exists(os.path.join(self.basedir, m.group('src'))):
> > -                for i in self._walk(m.group('src')):
> > -                    yield i
> > +            if m:
> > +                bm = bk_src_line.match(l)
> > +                if bm:
> > +                    if os.path.exists(os.path.join(self.basedir, bm.group('src'))):
> > +                        for i in self._walk(os.path.join(self.basedir, bm.group('src'))):
> > +                            yield i
> > +                    elif os.path.exists(os.path.join(self.basedir, 'backports/' + bm.group('src'))):
> > +                        for i in self._walk(os.path.join(self.basedir, 'backports/' + bm.group('src'))):
> > +                            yield i
> > +                else:
> > +                    if os.path.exists(os.path.join(self.basedir, m.group('src'))):
> > +                        for i in self._walk(m.group('src')):
> > +                            yield i
> 
> Are you even using the src_line regular expression any more? Seems like
> you could just modify it though to make the (\$BACKPORT_DIR/) part
> optional.

Sure make sense. I suppose we should be consistant too and use $BACKPORT_DIR.

> >      def _prune_sources(self, f, ignore):
> >          for nf in self._walk(f):
> >              out = ''
> >              for l in open(os.path.join(self.basedir, nf), 'r'):
> > -                m = src_line.match(l)
> > -                if not m:
> > -                    out += l
> > -                    continue
> > -                src = m.group('src')
> > -                if src in ignore or os.path.exists(os.path.join(self.basedir, src)):
> > -                    out += l
> > +                bm = bk_src_line.match(l)
> > +                if bm:
> > +                    bp_src = bm.group('src')
> > +                    if bp_src in ignore or \
> > +                       os.path.exists(os.path.join(self.basedir, bp_src)) or \
> > +                       os.path.exists(os.path.join(self.basedir, 'backports/' + bp_src)):
> 
> I'd prefer parentheses instead of \ line continuations :)

OK :)

> the backports/ part seems to be for integration only?

I think I went trigger happy since the bk_src_line should have picked
up on the fact that backports directory prefix would already have been
used. I'll re-test and remove not needed thing and try to consolidate
the regexp.

> > +                    m = src_line.match(l)
> > +                    # we should consider disallowing these as it could mean
> > +                    # someone forgot to add the BACKPORT_DIR prefix to
> > +                    # the kconfig source entries which we will need to
> > +                    # support built-in integration.
> 
> If you put it in the same RE then you can just print a warning on this
> if detected but skip it otherwise.

What I meant by this was more of the things that could go into a Kconfig
which we perhaps are not parsing yet which might depend on a path, so
its not clear to me what regexp to use. Right now it will just leave
the lines intact and I guess that's fine for now.

  Luis

  reply	other threads:[~2014-10-31 20:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29  8:21 [RFC v2 0/4] backports: kernel integration support Luis R. Rodriguez
2014-10-29  8:21 ` [RFC v2 1/4] backports: replace CPTCFG prefix for CONFIG_BACKPORT Luis R. Rodriguez
2014-10-31  7:41   ` Johannes Berg
2014-10-31 19:34     ` Luis R. Rodriguez
2014-10-31 20:22       ` Johannes Berg
2014-10-31 20:33         ` Luis R. Rodriguez
2014-11-03 19:30           ` Luis R. Rodriguez
2014-11-03 19:40             ` Johannes Berg
2014-11-03 19:56               ` Luis R. Rodriguez
2014-11-03 20:20                 ` Johannes Berg
2014-11-03 20:21                   ` Luis R. Rodriguez
2014-11-03 20:24                     ` Johannes Berg
2014-11-03 20:26                       ` Luis R. Rodriguez
2014-10-29  8:21 ` [RFC v2 2/4] backports: replace BACKPORT_PWD with BACKPORT_DIR Luis R. Rodriguez
2014-10-31  7:41   ` Johannes Berg
2014-10-31 19:35     ` Luis R. Rodriguez
2014-10-29  8:21 ` [RFC v2 3/4] backports: use BACKPORT_DIR prefix on kconfig sources Luis R. Rodriguez
2014-10-31  7:46   ` Johannes Berg
2014-10-31 20:03     ` Luis R. Rodriguez [this message]
2014-10-29  8:21 ` [RFC v2 4/4] backports: add kernl integration support to gentree.py Luis R. Rodriguez
2014-10-29 15:36   ` Stefan Assmann
2014-10-29 16:00     ` Luis R. Rodriguez
2014-10-31  7:50       ` Johannes Berg
2014-10-31 20:10         ` Luis R. Rodriguez

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=20141031200316.GC12953@wotan.suse.de \
    --to=mcgrof@suse.com \
    --cc=backports@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@do-not-panic.com \
    --cc=mmarek@suse.cz \
    --cc=sassmann@kpanic.de \
    --cc=yann.morin.1998@free.fr \
    /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