Example #1
0
def main():
	mode = 'default'
	submode = None
	if (len(sys.argv) > 1):
		mode = sys.argv[1]
	if (len(sys.argv) > 2):
		submode = sys.argv[2]

	if mode == 'default':
		print('usage:\n'
			'  eve.py update --- Update or install EiffelStudio; update and compile EVE.\n'
			'  eve.py finalize eve --- Finalize EVE.\n'
			'  eve.py eve --- Launch finalized EVE.\n'
			'  eve.py es --- Launch EiffelStudio.\n')
	elif mode == 'es':
		run_eiffel_studio()
	elif mode == 'eve':
		run_eve()
	elif mode == 'check':
		if not check_environment_variables():
			update_environment_variables()
	elif mode == 'update' and submode == None:
		update_EiffelStudio()
		esvn.update_repository(config.v_url_svn_trunk_src, elocation.trunk_source())
		compile_runtime()
		compile_eve('bench')
	elif mode == 'update' and (submode == 'EiffelStudio' or submode == 'es'):
		update_EiffelStudio()
	elif mode == 'update' and submode == 'source':
		esvn.update_repository(config.v_url_svn_trunk_src, elocation.trunk_source())
	elif mode == 'compile' and submode == 'runtime':
		if not check_environment_variables():
			update_environment_variables()
		ecompile.compile_runtime()
	elif mode == 'compile' and (submode == None or submode == 'eve'):
		if not check_environment_variables():
			update_environment_variables()
		#compile_eve('bench')
		compile_eve ('batch', 'ecb')
	elif mode == 'finalize' and (submode == None or submode == 'eve'):
		if not check_environment_variables():
			update_environment_variables()
		#finalize_eve('bench')
		finalize_eve ('batch', 'ecb')
	elif mode == 'delivery':
		if not check_environment_variables():
			update_environment_variables()
		make_delivery()
	elif mode == 'merge':
		make_merge()
	elif mode == 'eweasel':
		eweasel.main (sys.argv[1:])
	else:
		if submode == None:
			SystemLogger.error("invalid option " + mode)
		else:
			SystemLogger.error("invalid option " + mode + " / " + submode)
	return
Example #2
0
def update():
    esvn.update_repository(d_eweasel_svn, elocation.eweasel())
Example #3
0
def test_svn():
	esvn.update_repository(config.v_url_svn_trunk_src, "./test")
Example #4
0
def make_merge():
	global v_dir_eve_source

	# set up parameters
	merge_path = os.path.realpath(v_dir_merge)
	v_dir_eve_source = os.path.join(merge_path, 'Src')
	os.environ['EIFFEL_SRC'] = v_dir_eve_source
	os.environ['ISE_LIBRARY'] = v_dir_eve_source

	# update dependencies
	update_EiffelStudio()

	# update repository
	try:
		elocation.delete(merge_path)
		esvn.update_repository(v_url_svn_eve, merge_path)
	except Exception as e1:
		SystemLogger.warning("Checkout failed. Trying one more time.")
		send_mail(v_email_merge_info, "[EVE] WARNING: checkout failed", "I will try again.")
		try:
			elocation.delete(merge_path)
			esvn.update_repository(v_url_svn_eve, merge_path)
		except Exception as e2:
			SystemLogger.error("Checkout failed, again...")
			send_mail(v_email_merge_info, "[EVE] ERROR: checkout failed again", "I give up...")
			sys.exit(0)

	# send email to block commits
	send_mail(v_email_merge_update, '[EVE] merge started', """Dear assistants,

The eve branch is being synchronized with the trunk.
Please do not commit to the eve branch until the synchronization is complete.

Regards,
EVE""")

	# merge
	trunk_revision = esvn.info_remote_revision_number(v_url_svn_trunk)
	last_merge_revision = esvn.last_merge_revision_number(v_url_svn_eve)
	esvn.merge(merge_path, v_url_svn_trunk, pysvn.Revision(pysvn.opt_revision_kind.number, last_merge_revision), pysvn.Revision(pysvn.opt_revision_kind.number, trunk_revision))

	# wait for conflicts to be resolved
	success = not esvn.has_conflicts(merge_path)
	first = True
	while not success:
		if first:
			first = False
			SystemLogger.error("Merge has produced conflicts")
			send_mail(v_email_merge_info, "[EVE] WAITING: merge produced conflicts", "Resolve conflicts manually and then continue script.")
		else:
			SystemLogger.error("There are still conflits!")
		print ("---")
		print ("Press enter when conflicts are resolved.")
		input()
		success = not esvn.has_conflicts(merge_path)
	SystemLogger.success("Merge successful")

	# compile
	check_environment_variables()
	compile_runtime()
	compile_eve('bench')
	
	# wait for compilation to be successful
	success = is_eve_compilation_successful('bench')
	first = True
	while not success:
		if first:
			first = False
			SystemLogger.error("EVE compilation failed")
			send_mail(v_email_merge_info, "[EVE] WAITING: EVE compilation failed", "Solve compilation problems manually and then continue script.")
		else:
			SystemLogger.error("compilation still fails!")
		print ("---")
		print ("Press enter when compilation problems are resolved.")
		input()
		if not is_eve_compilation_successful('bench'):
			compile_runtime()
			compile_eve('bench')
		success = is_eve_compilation_successful('bench')
	SystemLogger.success("Compilation successful")

	# commit
	message = "<<Merged from trunk#" + str(trunk_revision) + ".>>"
	esvn.commit(merge_path, message)
	first = True
	esvn.update (merge_path, True)
	while esvn.info_local_revision_number(merge_path) <= trunk_revision and False: #???
		if first:
			first = False
			SystemLogger.error("EVE commit failed")
			send_mail(v_email_merge_info, "[EVE] WAITING: commit failed", "Commit manually and then continue script.")
		else:
			SystemLogger.error("Local revision (" + str(esvn.info_local_revision_number(merge_path)) + ") still smaller than TRUNK (" + str(trunk_revision) + ")")
		print ("---")
		print ("Press enter when you have commited the repository manually.")
		print ("Commit message: " + message)
		input()
		esvn.update (merge_path, true)
	SystemLogger.success("Commit successful")
	
	# make delivery
	delivery_url = make_delivery()
	version, path = get_installed_version()

	# send email
	if delivery_url == None:
		send_mail(v_email_merge_update, "[EVE] merge completed with trunk#" + str(trunk_revision) + ".", """Dear assistants,

The eve branch is now synchronized with trunk#""" + str(trunk_revision) + """ using EiffelStudio """ + str(version) + """.
You can now update your checkout of eve and commit again.

Regards,
EVE""")
		send_mail(v_email_merge_info, "[EVE] Delivery creation failed", "See log for more information.")
	else:
		send_mail(v_email_merge_update, "[EVE] merge completed with trunk#" + str(trunk_revision) + " and new delivery available.", """Dear assistants,

The eve branch is now synchronized with trunk#""" + str(trunk_revision) + """ using EiffelStudio """ + str(version) + """.
You can now update your checkout of eve and commit again.

A """ + d_ise_platform + """ delivery of EVE has been created and is available at
  """ + delivery_url + """

Regards,
EVE""")