Red Hat Bugzilla – Bug 979247
Bug: Allows space in book version
Last modified: 2013-10-17 19:49:50 EDT
Description of problem:
The version field in the CSP map allows a value with a space, which is not allowed by publican.
For example, this is a valid value:
Version = 6.2-Beta
This should not be allowed:
Version = 6.2 Beta
I accidentally added a space instead of the intended hyphen and it was not caught out till I eventually ran publican package.
Fixed in 0.33.2
The regex used for validation has been updated to remove the ability to have spaces.
0.33.2 has been released.
Tested, works as expected.
(In reply to Misha H. Ali from comment #0)
> Description of problem:
> The version field in the CSP map allows a value with a space, which is not
> allowed by publican.
That's not /quite/ true; it's not allowed by Publican if a valid "version:" parameter is not set in the Publican.cfg file.
Publican looks first to the "version:" parameter in the publican.cfg file for a value with which it can generate a valid RPM name. If it doesn't find the parameter set there, it looks at the <productnumber> in the Book_Info.xml file. If it doesn't find a valid value there either, it errors out.
So PressGang should allow spaces in the "version:" parameter, since I assume that anything in PressGang's publican.cfg parameter gets used, and this can contain a valid version; ie, the topic map could specify:
version = 6.6 Beta
publican.cfg = [xml_lang: "en-US"
PressGang might even implement logic so that if the (PressGang) version parameter is not valid for RPM naming, then the (publican.cfg) version parameter must, or the topic map fails validation.
I definitely agree with Rudi that this isn't the case and the "Version" metadata should allow spaces (sorry I should have looked into this more originally). As such I'll be reverting this change for 1.2.
Adding a little bit more detail to the way the publican.cfg "version" is currently configurable. This can be configured as Rudi mentioned above via the "publican.cfg" metadata. If it's not used by that then it will attempt to get the value from the "Book Version" and lastly fallback to the "Version" metadata.
So I believe what needs to be done here is to re-enable spaces in the Version field and then alter the mechanism that sets the publican.cfg "version" value to escape the "Book Version" or "Version" metadata fields accordingly (this is the way we currently do it for "product" and "docname".
Sorry folks, looks like I jumped the gun on reporting this as a bug.
I've updated this so that the Version can now have spaces and will be escaped accordingly if it fallen back to when setting the "version" in publican.cfg.
Confirmed that the content spec Version field can take a space, and that the publican.cfg file (or files if more than one publican.cfg file is specified) will get a version field with the space replaced with a dash.
Confirmed that any version information specified in the publican.cfg file won't be overwritten by the Version metadata in the spec.
Also confirmed that if one publican.cfg file does have a version, and a second does not, the one that does not will have a fixed version added and the one that does will not be touched.