Ben Greear wrote:
On 12/04/2009 09:09 AM, Bruce Simpson wrote:
Ben Greear wrote:
On 12/04/2009 06:28 AM, Bruce Simpson wrote:
...and promptly backed out again, the cure is worse than the disease.
:-(
Well, try compiling it on Linux. The problem happened every time for me
(first build attempt works, the rest fail until 'obj' is blown away.

Did you try my code as I posted, ie w/out the 'fixups' ?

I did not -- mkdirs() looked like a mis-spelling of makedirs(), so this
code wouldn't have run anyway.

You're right about mkdirs.  I changed it to makedirs and it gets
farther on Fedora 8 (with your previous patch applied).

Now it's complaining about something else:

Checking for C library pcap... yes
Checking for C function pcap_sendpacket()... yes
Checking for C library curses... yes
Detected libraries: boost_regex rt resolv crypto dl pcap curses
Symlink("/home/greearb/git/xorp.ct/obj/x86_64-unknown-linux-gnu/lib", as "/home/greearb/git/xorp.ct/obj/x86_64-unknown-linux-gnu/lib/xorp/lib")
RuntimeError: Unexpected arguments:
  File "/home/greearb/git/xorp.ct/SConstruct", line 644:
    env.Dir('$xorp_sbindir').abspath))
  File "/home/greearb/git/xorp.ct/relpath.py", line 13:
    raise RuntimeError("Unexpected arguments")

OK, this is good, we know that the monkey-patching works, however the replacement implementation of relpath() is too naive.

relpath() is being used here to evaluate RPATHs upfront before they get passed down to the SConstructs. It is exploiting the fact that if the absolute path of the binary is deeper than the lib path, os.path.relpath() (in Python 2.6) will return a path of the form ../../lib.

Try this one, it's a bit smarter.

Still researching Mkdir() issue.


Index: SConstruct
===================================================================
--- SConstruct  (revision 11676)
+++ SConstruct  (working copy)
@@ -21,6 +21,8 @@
 # TODO Fix default include/lib paths, pass in from environment.
 # TODO Merge scons-unfamiliar syntactic sugar from YHC's sconsfiles.
 
+import relpath
+
 gnutoolwarning = """
 WARNING: The GNU %s was not detected on your system.
 Some combinations of linker or compiler flags, specific to building XORP,
@@ -29,7 +31,7 @@
 
 # The XRL tgt-gen and clnt-gen scripts use Python 2.3+'s optparse
 # class. However, os.path.relpath() requires Python 2.6.
-EnsurePythonVersion(2, 6)
+EnsurePythonVersion(2, 3)
 
 # SCons 0.98.4 is the earliest release that we have tested.  Earlier
 # ones may work.  If so, please submit a Trac issue so the check can
Index: relpath.py
===================================================================
--- relpath.py  (revision 0)
+++ relpath.py  (revision 0)
@@ -0,0 +1,24 @@
+#
+# Monkey patch for os.path to include relpath if python version is < 2.6.
+#
+# Obtained from: http://code.activestate.com/recipes/302594/
+#
+
+import os
+
+if not hasattr(os.path, "relpath"):
+    def relpath(target, base=os.curdir):
+        if not os.path.exists(target):
+            raise OSError, 'Target does not exist: ' + target
+        if not os.path.isdir(base):
+            raise OSError, 'Base is not a directory or does not exist: '+ base
+        base_list = (os.path.abspath(base)).split(os.sep)
+        target_list = (os.path.abspath(target)).split(os.sep)
+        for i in range(min(len(base_list), len(target_list))):
+            if base_list[i] <> target_list[i]: break
+        else:
+            i += 1
+        rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:]
+        return os.path.join(*rel_list)
+
+    os.path.relpath = relpath
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to