PlanetLab support toon-up: home_cleanup only nepi folders + make server support longe...
[nepi.git] / src / nepi / testbeds / planetlab / application.py
index a192707..fe2994a 100644 (file)
@@ -91,7 +91,10 @@ class Dependency(object):
             self.__class__.__name__,
             ' '.join(filter(bool,(self.depends, self.sources)))
         )
-    
+   
+    def deployed(self):
+        return self._setup
+
     def validate(self):
         if self.home_path is None:
             raise AssertionError, "Misconfigured application: missing home path"
@@ -341,7 +344,7 @@ class Dependency(object):
             'home' : server.shell_escape(self.home_path),
             'token' : server.shell_escape(self._master_token),
         }
-        
+       
         return cStringIO.StringIO(slavescript)
          
     def _do_launch_build(self):
@@ -520,8 +523,24 @@ class Dependency(object):
             
         if self.sources:
             sources = self.sources.split(' ')
-            
-            # Copy all sources
+
+            http_sources = list()
+            for source in list(sources):
+                if source.startswith("http") or source.startswith("https"):
+                    http_sources.append(source)
+                    sources.remove(source)
+
+            # Download http sources
+            try:
+                for source in http_sources:
+                    path = os.path.join(self.home_path, source.split("/")[-1])
+                    command = "wget -o %s %s" % (path, source)
+                    self._popen_ssh(command)
+            except RuntimeError, e:
+                raise RuntimeError, "Failed wget source file %r: %s %s" \
+                        % (sources, e.args[0], e.args[1],)
+
+            # Copy all other sources
             try:
                 self._popen_scp(
                     sources,
@@ -582,7 +601,8 @@ class Dependency(object):
             except RuntimeError, e:
                 if self.check_bad_host(e.args[0], e.args[1]):
                     self.node.blacklist()
-                raise RuntimeError, "Failed install build sources: %s %s" % (e.args[0], e.args[1],)
+                raise RuntimeError, "Failed install build sources on node %s: %s %s" % (
+                        self.node.hostname, e.args[0], e.args[1],)
 
     def set_master(self, master):
         self._master = master
@@ -750,7 +770,6 @@ class Application(Dependency):
             stdout = 'stdout' if self.stdout else '/dev/null',
             stderr = 'stderr' if self.stderr else '/dev/null',
             sudo = self.sudo,
-            
             host = self.node.hostname,
             port = None,
             user = self.node.slicename,
@@ -905,9 +924,10 @@ class NS3Dependency(Dependency):
         self.buildDepends = 'make waf gcc gcc-c++ gccxml unzip bzr'
         
         # We have to download the sources, untar, build...
-        pygccxml_source_url = "http://leaseweb.dl.sourceforge.net/project/pygccxml/pygccxml/pygccxml-1.0/pygccxml-1.0.0.zip"
-        ns3_source_url = "http://nepi.pl.sophia.inria.fr/code/nepi-ns3.13/archive/tip.tar.gz"
-        passfd_source_url = "http://nepi.pl.sophia.inria.fr/code/python-passfd/archive/tip.tar.gz"
+        #pygccxml_source_url = "http://leaseweb.dl.sourceforge.net/project/pygccxml/pygccxml/pygccxml-1.0/pygccxml-1.0.0.zip"
+        pygccxml_source_url = "http://yans.pl.sophia.inria.fr/libs/pygccxml-1.0.0.zip"
+        ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.13/archive/tip.tar.gz"
+        passfd_source_url = "http://nepi.inria.fr/code/python-passfd/archive/tip.tar.gz"
         
         pybindgen_version = "797"
 
@@ -1111,9 +1131,12 @@ class CCNxDaemon(Application):
         self.ccnRoutes = None
         self.ccnxVersion = "ccnx-0.6.0"
         
-        self.ccnx_0_5_1_sources = "http://www.ccnx.org/releases/ccnx-0.5.1.tar.gz"
-        self.ccnx_0_6_0_sources = "http://www.ccnx.org/releases/ccnx-0.6.0.tar.gz"
-        self.buildDepends = 'make gcc development-tools openssl-devel expat-devel libpcap-devel libxml2-devel'
+        #self.ccnx_0_5_1_sources = "http://www.ccnx.org/releases/ccnx-0.5.1.tar.gz"
+        self.ccnx_0_5_1_sources = "http://yans.pl.sophia.inria.fr/libs/ccnx-0.5.1.tar.gz"
+        #self.ccnx_0_6_0_sources = "http://www.ccnx.org/releases/ccnx-0.6.0.tar.gz"
+        self.ccnx_0_6_0_sources = "http://yans.pl.sophia.inria.fr/libs/ccnx-0.6.0.tar.gz"
+        #self.buildDepends = 'make gcc development-tools openssl-devel expat-devel libpcap-devel libxml2-devel'
+        self.buildDepends = 'make gcc openssl-devel expat-devel libpcap-devel libxml2-devel'
 
         self.ccnx_0_5_1_build = (
             " ( "