def testRegister(self): self.assertEqual(None, registry.lookup("http://example.com/myrepo/foo.xml", missing_ok = True)) out = run_repo(['create', 'my-repo', 'Test Key for 0repo']) assert not out os.chdir('my-repo') out = run_repo(['register']) assert 'http://example.com/myrepo/:' in out, out out = run_repo(['register']) assert "Already registered" in out, out os.chdir(mydir) responses['/downloads/test-1.tar.bz2'] = FakeResponse(419419) out = run_repo(['add', 'test-1.xml']) assert "Updated public/tests/test.xml" in out, out reg = registry.lookup("http://example.com/myrepo/foo.xml") assert reg['type'] == 'local' try: reg = registry.lookup("http://example.com/notmyrepo/foo.xml") assert 0 except SafeException as ex: assert 'No registered repository for' in str(ex), ex
def handle(args): files = [abspath(f) for f in args.path] if not cmd.find_config(missing_ok = True): # Import into appropriate registry for this feed with open(files[0], 'rb') as stream: doc = qdom.parse(stream) master = incoming.get_feed_url(doc, files[0]) from_registry = registry.lookup(master) assert from_registry['type'] == 'local', 'Unsupported registry type in %s' % from_registry os.chdir(from_registry['path']) print("Adding to registry '{path}'".format(path = from_registry['path'])) config = cmd.load_config() messages = [] for feed in files: print("Adding", feed) msg = incoming.process(config, feed, delete_on_success = False) if msg: messages.append(msg) update.do_update(config, messages = messages)
def handle(args): files = [abspath(f) for f in args.path] if not cmd.find_config(missing_ok=True): # Import into appropriate registry for this feed with open(files[0], 'rb') as stream: doc = qdom.parse(stream) master = incoming.get_feed_url(doc, files[0]) from_registry = registry.lookup(master) assert from_registry[ 'type'] == 'local', 'Unsupported registry type in %s' % from_registry os.chdir(from_registry['path']) print("Adding to registry '{path}'".format(path=from_registry['path'])) config = cmd.load_config() messages = [] for feed in files: print("Adding", feed) msg = incoming.process(config, feed, delete_on_success=False) if msg: messages.append(msg) update.do_update(config, messages=messages)
def accept_and_publish(archive_file, src_feed_name): if status.tagged: print "Already tagged in SCM. Not re-tagging." else: scm.ensure_committed() head = scm.get_head_revision() if head != status.head_before_release: raise SafeException("Changes committed since we started!\n" + "HEAD was " + status.head_before_release + "\n" "HEAD now " + head) scm.tag(status.release_version, status.head_at_release) scm.reset_hard(TMP_BRANCH_NAME) scm.delete_branch(TMP_BRANCH_NAME) status.tagged = 'true' status.save() assert len(local_feed.feed_for) == 1 # Merge the source and binary feeds together first, so # that we update the master feed atomically and only # have to sign it once. with open(src_feed_name, 'rb') as stream: doc = minidom.parse(stream) for b in compiler.get_binary_feeds(): 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 repository = registry.lookup(master_feed, missing_ok = True) if repository: release_via_0repo(new_impls_feed) else: release_without_0repo(archive_file, new_impls_feed) os.unlink(new_impls_feed) print "Push changes to public SCM repository..." public_repos = options.public_scm_repository if public_repos: scm.push_head_and_release(status.release_version) else: print "NOTE: No public repository set => you'll have to push the tag and trunk yourself." os.unlink(support.release_status_file)
def handle(args): if not cmd.find_config(missing_ok=True): from_registry = registry.lookup(args.uri) assert from_registry[ 'type'] == 'local', 'Unsupported registry type in %s' % from_registry os.chdir(from_registry['path']) config = cmd.load_config() rel_uri = args.uri[len(config.REPOSITORY_BASE_URL):] feed_path = join('feeds', config.get_feeds_rel_path(rel_uri)) with open(feed_path, 'rb') as stream: doc = minidom.parse(stream) messages = [] for impl in merge.find_impls(doc.documentElement): impl_id = impl.getAttribute("id") impl_version = impl.getAttribute("version") impl_stability = impl.getAttribute("stability") if impl_id == args.id or impl_version == args.id: if args.stability and impl_stability != args.stability: messages.append( 'Implementation {id} (version {version}) stability set to {stability}' .format(id=impl_id, version=impl_version, stability=args.stability)) impl.setAttribute("stability", args.stability) if len(messages) > 0: commit_msg = 'Modified {uri}\n\n{messages}'.format( uri=args.uri, messages='\n'.join(messages)) new_xml = formatting.format_doc(doc) incoming.write_to_git(feed_path, new_xml, commit_msg, config) update.do_update(config) else: print("No changes made.")