Re: problems with try-ark

Edward Moy <[email protected]> Thu, 22 Jan 2004 16:04:00 -0800
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
On 14 Nov 2003, at 09:14, Jonathan Hogg wrote:

> On 14 Nov 2003, at 17:06, Sang Yi wrote:
>
>> my output's the same as yours:
>> [...]
>> any other suggestions?  meanwhile, i'll review my test drive setup
>> again... maybe i missed something
>
> Hmmm. OK, that's odd. The only other thing I can suggest is turning on
> the debugging info and seeing what that turns up just before it fails.
> You can enable that by setting the environment variable ARK_DEBUG=255
> (which will output pretty much everything).
>
> It certainly looks like a broken XML parser, but I can't figure out 
> why.

I ran into this problem as well.  Looks like it is because comments are 
being handled differently in Python 2.3.x:

% python
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import xml.dom.minidom
 >>> doc = xml.dom.minidom.parseString( '<test><!-- comment --></test>' )
 >>> root = doc.documentElement
 >>> len(root.attributes)
0
 >>> children = root.childNodes
 >>> print children
[<DOM Comment node " comment ">]
 >>> len(children[0].attributes)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: len() of unsized object

I just added:

     if node.attributes == None:
         return

to zero_attributes() in ARK/arkbase/ark/xmlfile.py.

However, then I ran into:

Panic: sigh: element <#comment> is bogus

Seems that:

 >>> print children[0].nodeName
#comment

so I changed the line in _process_subfields() to:

     elif hname == 'comment' or hname == '#comment':

which then results in:

Panic: sigh: <comment> must have exactly one child node

which seems to be because comments don't have children:

 >>> children2 = children[0].childNodes
 >>> len(children2)
0

So I added:

     if len(children) == 0:
         return ''

to _process_comment().

Now, I get:

     raise 'duff code:',child.nodeName, child.nodeType
TypeError: raise: arg 3 must be a traceback or None

Seems that some of the <code> sections in sidai/package/ALL.xml use 
CDATA, and _process_code() is unhappy:

(Pdb) p children
[<DOM CDATASection node "\ncd $PKG_B...">]
(Pdb) p children[0].nodeType
4
(Pdb) p node.TEXT_NODE
3
(Pdb) p children[0].nodeValue
u'\ncd $PKG_BUILD_DIR\n\nLNDIR=`sidaiPickProgram "$LNDIR" 
"$LNDIR_BOOT"`\n\n# clear out any old symlinks that point to the wrong 
thing\n[ -d src ] && /bin/rm -rf src\n\n$MKDIR_P src\ncd src && $LNDIR 
$GEN_PKG_SRC_LOC .\n'

So I change the line in _process_code() to:

        if len(children) == 1 and (children[0].nodeType == 
node.TEXT_NODE or children[0].nodeType == node.CDATA_SECTION_NODE):

but being new to Arusha, I don't know if this is quite correct, though 
it seemed to finally get it going.  Now, I get a failure for what looks 
like a configuration error on my part.

Edward Moy
[email protected]
---------------------------------------------------------------
(This messages is from me as a reader of this list, and not a statement 
from Apple.)



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn