Always depend on 0compile
authorThomas Leonard <talex5@gmail.com>
Fri, 15 Mar 2013 13:17:24 +0000 (15 13:17 +0000)
committerThomas Leonard <talex5@gmail.com>
Fri, 15 Mar 2013 13:25:39 +0000 (15 13:25 +0000)
This avoids needing to use 0launch internally, which makes unit-testing
easiler.

0release.xml
compile.py
tests/testrelease.py

index 1299b19..b3390c8 100644 (file)
     <command name="run" path="0release">
       <runner interface="http://repo.roscidus.com/python/python"/>
     </command>
-    <command name="build-slave" path="0release">
-      <runner interface="http://repo.roscidus.com/python/python"/>
-      <arg>--build-slave</arg>
-      <requires interface='http://0install.net/2006/interfaces/0compile.xml'>
-       <version not-before='0.30'/>
-       <executable-in-var name='0COMPILE'/>
-      </requires>
-    </command>
+
     <command name="test" path="tests/testall.py">
       <runner interface="http://repo.roscidus.com/python/python"/>
       <executable-in-path name="0release"/>
       <requires interface="http://repo.roscidus.com/devel/make">
        <executable-in-path name="make"/>
       </requires>
-      <requires interface='http://0install.net/2006/interfaces/0compile.xml'>
-        <version not-before='0.30'/>
-       <environment insert="0compile.xml" mode="replace" name="0COMPILE_FEED"/>
-      </requires>
     </command>
+
     <requires interface="http://repo.roscidus.com/python/python">
       <version before="3"/>
     </requires>
+
     <requires interface="http://0install.net/2006/interfaces/0publish">
       <version not-before="0.17"/>
       <environment if-0install-version="..!1.13" insert="0publish" mode="replace" name="0PUBLISH"/>
       <executable-in-var name="0PUBLISH"/>
     </requires>
+
     <requires interface="http://0install.net/2007/interfaces/ZeroInstall.xml">
       <version not-before="1.6"/>
       <environment insert="" mode="replace" name="0RELEASE_ZEROINSTALL"/>
     </requires>
+
     <requires interface="http://0install.net/2008/interfaces/0test.xml">
       <version not-before="0.4-post"/>
       <environment if-0install-version="..!1.13" insert="0test" mode="replace" name="0TEST"/>
       <executable-in-var name="0TEST"/>
     </requires>
+
+    <requires interface='http://0install.net/2006/interfaces/0compile.xml'>
+      <version not-before='0.30'/>
+      <executable-in-var name='0COMPILE'/>
+    </requires>
+
     <implementation id="." version="0.14.2-post"/>
   </group>
 </interface>
index aa80035..649cf0d 100644 (file)
@@ -23,7 +23,7 @@ class Compiler:
 
                self.config.add_section('builder-host')
                #self.config.set('builder-host', 'build', '0launch --not-before 0.10 http://0install.net/2007/interfaces/0release.xml --build-slave "$@"')
-               self.config.set('builder-host', 'build', '0launch --command=build-slave http://0install.net/2007/interfaces/0release.xml "$@"')
+               self.config.set('builder-host', 'build', '')
 
                self.src_impl = support.get_singleton_impl(self.src_feed)
                if self.src_impl.arch and self.src_impl.arch.endswith('-src'):
@@ -69,7 +69,12 @@ class Compiler:
 
                                if start: support.show_and_run(start, [])
                                try:
-                                       support.show_and_run(command, [os.path.basename(self.src_feed_name), archive_file, self.archive_dir_public_url, binary_feed + '.new'])
+                                       args = [os.path.basename(self.src_feed_name), archive_file, self.archive_dir_public_url, binary_feed + '.new']
+                                       if not command:
+                                               assert target == 'host', 'Missing build command'
+                                               support.check_call([sys.executable, sys.argv[0], '--build-slave'] + args)
+                                       else:
+                                               support.show_and_run(command, args)
                                finally:
                                        if stop: support.show_and_run(stop, [])
 
@@ -97,9 +102,7 @@ def build_slave(src_feed, archive_file, archive_dir_public_url, target_feed):
        try:
                COMPILE = [os.environ['0COMPILE']]
        except KeyError:
-               print >>sys.stdout, ("\n\n*****\n"
-                       "Please update your ~/.config/0install.net/0release/builders.conf file to use --command=build-slave."
-                       "\n*****\n\n")
+               # (build slave has an old 0release)
                COMPILE = ['0launch', '--not-before=0.30', 'http://0install.net/2006/interfaces/0compile.xml']
 
        feed = support.load_feed(src_feed)
index 88ec995..159fba9 100755 (executable)
@@ -85,17 +85,6 @@ class TestRelease(unittest.TestCase):
                imp.reload(basedir)
                assert basedir.xdg_config_home == config_dir
 
-               # Register the local 0release/0compile feeds so we can test against those
-               self.config = load_config()
-
-               iface = self.config.iface_cache.get_interface("http://0install.net/2007/interfaces/0release.xml")
-               iface.extra_feeds = [model.Feed(release_feed, arch = None, user_override = True)]
-               writer.save_interface(iface)
-       
-               iface = self.config.iface_cache.get_interface("http://0install.net/2006/interfaces/0compile.xml")
-               iface.extra_feeds = [model.Feed(os.environ["0COMPILE_FEED"], arch = None, user_override = True)]
-               writer.save_interface(iface)
-
        def tearDown(self):
                os.chdir(mydir)
                ro_rmtree(self.tmp)