On Jul 11, 2007, at 10:41, Simon Ruderich wrote:
I'm having some problems with liveupdate.
The first was to find some documentation about it. I only found it in "man portfile" and it wasn't very precise (for example regarding the regex syntax).
That's the only place I know of where it's documented. I expect that the regex syntax is standard PCRE syntax, but things like slashes and other special symbols need to be escaped from the TCL interpreter.
The second is even regex of some Portfiles in the repository are not working. For example the zlib port (and others). It uses this regex:
"<B> *${name} (\\d+(?:\\.\\d+)*)</B>"
But it isn't working and I don't know why; it should match the text on the webpage. After I changed it to the following it worked:
"<B> *${name} (\[0-9\]+(?:\\.\[0-9\]+)*)</B>"
Is \d and such special characters allowed or not? I'm not sure about it.
I'm sorry, I didn't see your message and already fixed the zlib liveupdate. I changed it to this: livecheck.regex "${name}-(\\\\d+(?:\\\\.\\\\d+)*)\\\\.tar\\\\.bz2" I'm having a hard time figuring out, however, why I need *4* slashes every time PCRE syntax would lead me to expect to need only one. One doubled slash will be to escape it from the TCL string, but why it needs to be doubled again, I'm not sure. I have a sneaking suspicion that something in the livecheck processor changed between MacPorts 1.4.42 and 1.5.0 to cause this, because I had to fix the livecheck of several of my ports recently.
PS: I attached a patch for zlib to fix this problem. Also added another patch to fix some whitespace and other minor issues in the zlib Portfile. CCing one of the maintainers.
Landon is the true maintainer of zlib. I only jumped in because I thought Landon had abandoned the port, but it turned out he hadn't. I say it's bad form to do both whitespace changes and other changes in one commit. Makes it difficult to see later what functional changes were made, when a straightforward diff shows every line to have changed because of whitespace adjustments. Ideally, each change should be committed separately. Also, whitespace is currently something of a personal preference of the maintainer. In fact, Landon has specifically complained before when the whitespace of the zlib port was changed without his consent. See: http://trac.macosforge.org/projects/macports/changeset/23414 We should leave a port's whitespace up to its maintainer. And, your diffs are difficult to read because they are in context format (well, the "whitespace and other minor issues" one is), and because they're pasted into the email, which has probably reformatted them some. Please submit unified diffs instead, ideally attached to a ticket in Trac, or if it must be by email, then as an attachment, not inline.