Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 130103 - comment without newline at end of spec not handled as comment
Summary: comment without newline at end of spec not handled as comment
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: Catalyst (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Catalyst Developers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2006-04-15 16:00 UTC by Jonas Bernoulli
Modified: 2006-04-18 17:18 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
cleanup of parse_spec() (catalyst_support.py.diff,2.98 KB, patch)
2006-04-15 16:59 UTC, Andrew Gaffney (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Bernoulli 2006-04-15 16:00:33 UTC
if a spec file ends with a comment and the last character isnt a newline, catalyst takes the line as an option:

!!! catalyst: Argument "# this is a comment" not recognized.


steps to reproduce:
create a spec file with a comment at the end that doesnt end with a newline.

workaround:
add a newline if your file ends with a comment.

affected versions:
i have only tried 2.0_rc41
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2006-04-15 16:59:06 UTC
Created attachment 84747 [details, diff]
cleanup of parse_spec()

This patch cleans up some horribly ugly python code and fixes this bug. I have done some limited testing of the code, and it seems to work fine.

>>> import catalyst_support
>>> foo = ["livecd/use: a b c\n", "    d e f\n", "  g h i\n", "livecd/foo: bar\n", "   baz\n", "# this is a comment"]
>>> catalyst_support.parse_spec(foo)
{'livecd/foo': ['bar', 'baz'], 'livecd/use': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']}
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2006-04-15 17:01:18 UTC
I also tested that it preserves the old "single value is a string, multiple values is a list" behavior.

>>> import catalyst_support
>>> foo = ["livecd/use: a b c\n", "    d e f\n", "  g   h i\n", "livecd/foo: bar\n", "   baz\n", "livecd/bar:    baz\n", "# this is a comment"]
>>> catalyst_support.parse_spec(foo)
{'livecd/foo': ['bar', 'baz'], 'livecd/use': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], 'livecd/bar': 'baz'}
Comment 3 Andrew Gaffney (RETIRED) gentoo-dev 2006-04-17 08:20:29 UTC
And if you don't want to use the entire cleanup patch, this particular bug can be fixed with just a small part of it:

-	trailing_comment=re.compile("#.*\n")
+	trailing_comment=re.compile("#.*$")

Comment 4 Chris Gianelloni (RETIRED) gentoo-dev 2006-04-18 13:59:35 UTC
I've added Andrew's patch to CVS and I'll resolve this after the next catalyst release.
Comment 5 Chris Gianelloni (RETIRED) gentoo-dev 2006-04-18 17:18:18 UTC
Fixed in 2.0_rc42!

Thanks for the patch, Andrew.