Use 0repo's merge code rather than 0publish's
authorThomas Leonard <talex5@gmail.com>
Sun, 5 May 2013 18:47:24 +0000 (5 19:47 +0100)
committerThomas Leonard <talex5@gmail.com>
Sun, 5 May 2013 19:01:19 +0000 (5 20:01 +0100)
0repo's version has a better API and is more up-to-date.

0release.xml
release.py
support.py

index 4dcb551..09cfbe8 100644 (file)
@@ -36,6 +36,7 @@
 
     <requires interface='http://0install.net/tools/0repo.xml'>
       <environment name='RELEASE_0REPO' insert='.' mode='replace'/>
+      <version not-before='0.2'/>
     </requires>
 
     <requires interface="http://0install.net/2006/interfaces/0publish">
index d750648..2e06841 100644 (file)
@@ -2,13 +2,14 @@
 # See the README file for details, or visit http://0install.net.
 
 import os, subprocess, shutil, sys
+from xml.dom import minidom
 from zeroinstall import SafeException
 from zeroinstall.injector import model
 from zeroinstall.support import ro_rmtree
 from logging import info, warn
 
 sys.path.insert(0, os.environ['RELEASE_0REPO'])
-from repo import registry
+from repo import registry, merge
 
 import support, compile
 from scm import get_scm
@@ -353,10 +354,15 @@ def do_release(local_feed, options):
                # Merge the source and binary feeds together first, so
                # that we update the master feed atomically and only
                # have to sign it once.
-               new_impls_feed = 'merged.xml'
-               shutil.copyfile(src_feed_name, new_impls_feed)
+               with open(src_feed_name, 'rb') as stream:
+                       doc = minidom.parse(stream)
                for b in compiler.get_binary_feeds():
-                       support.publish(new_impls_feed, local = b)
+                       with open(b, 'rb') as stream:
+                               bin_doc = minidom.parse(b)
+                       merge.merge(doc, bin_doc)
+               new_impls_feed = 'merged.xml'
+               with open(new_impls_feed, 'wb') as stream:
+                       doc.writexml(stream)
 
                # TODO: support uploading to a sub-feed (requires support in 0repo too)
                master_feed, = local_feed.feed_for
index 399129e..9dfeb2a 100644 (file)
@@ -252,3 +252,4 @@ def make_archives_relative(feed):
                        elem.setAttribute('href', href.rsplit('/', 1)[1])
        with open(feed, 'wb') as stream:
                doc.writexml(stream)
+               stream.write(b'\n')