Bug 131504 - Insufficent parsing of make.conf by parse_makeconf function.
Bug#: 131504 Product:  Gentoo Hosted Projects Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: catalyst@gentoo.org Reported By: unik@compot.ru
Component: Catalyst
URL: 
Summary: Insufficent parsing of make.conf by parse_makeconf function.
Keywords:  
Status Whiteboard: 
Opened: 2006-04-27 13:11 0000
Description:   Opened: 2006-04-27 13:11 0000
Using catalyst 2.0 rc44.
If variables in make.conf are written as:

VAR="\
 flag1 flag2 flag3 \
 -flag4 -flag5 \
"

then function "parse_makeconf" in file
/usr/lib/catalyst2/modules/catalyst_support.py chokes. This is legal shell
syntax, but it is not caught by regexp. Maybe if the regexp could be made
multiline, then it would work. But I'm not a python expert.

------- Comment #1 From Andrew Gaffney 2007-08-13 20:38:15 0000 -------
As far as I can tell, parse_makeconf is only used for reading the make.conf
generated by catalyst itself. Since catalyst doesn't create multi-line entries
in make.conf, the current function is sufficient. It can probably be made
multi-line relatively easily, but it'd get done faster if you submitted a
patch.

The fact that this bug has gone 16 months without being touched shows that
nobody else is sticking multi-line entries in make.conf in their stage tarballs
by hand like you are.

------- Comment #2 From Chris Gianelloni (RETIRED) 2007-09-18 18:26:08 0000 -------
OK.  I was checking back over the mailing list and noticed that Charles Duffy
<cduffy@spamcop.net> had created his own catalyst patch which resolved this.

Now, the only real issue with it is that it would fail on a non-Gentoo machine.
 I am attaching the patch to this bug, but it will need to be adjusted to
determine whether or not the portage_util stuff is even available, and to fall
back to the old parser if it isn't.  This should keep compatibility, even in
the lowest of stages.  Of course, if portage isn't available, we might have
other issues, especially when we start looking into non-portage package manager
support.

------- Comment #3 From Chris Gianelloni (RETIRED) 2007-09-18 18:28:08 0000 -------
Created an attachment (id=131229) [details]
catalyst-misc_enhancements.patch

Unfortunately, this patch adds additional features that I'm not very interested
in supporting, just yet, but it will work for most uses.

------- Comment #4 From Andrew Gaffney 2007-09-25 22:01:09 0000 -------
Created an attachment (id=131900) [details]
try pkgcore and paludis config parsing

This patch first tries the snakeoil.fileutils.read_bash_dict() function from
pkgcore, then portage_util.getconfig() from portage, and then the internal
parse_makeconf() function. The first 2 work fine on my system make.conf with
both multi-line vars and a sourced file. The fallback functionality seems to
work just fine. This can be run on a system with pkgcore, portage, or a
non-Gentoo system with neither. Of course, catalyst itself can't yet :)

------- Comment #5 From Andrew Gaffney 2007-09-25 22:01:50 0000 -------
Err, s/paludis/portage/ in that patch description.

------- Comment #6 From Andrew Gaffney 2007-09-25 22:29:36 0000 -------
My patch is in SVN and will be released in 2.0.5

------- Comment #7 From Chris Gianelloni (RETIRED) 2007-10-12 00:08:13 0000 -------
This should be fixed in 2.0.5_pre4.  Please test this version of catalyst (or
newer) and report back if it does not work.

Thanks