<commit_before>#!/usr/bin/env python

import sys
import string
import random
import os
import socket


globalhostname = ""

def generateCode():
	# Fill the template with the correct data
	
	global jabber_template
	global globalhostname

	if os.name == "posix":
			# If no hostname was previously specified, get one from the system
		if globalhostname == "":	
			hostname = socket.gethostname()
		else:
			hostname = globalhostname
		errorlog = "/dev/null"
	else:
		# If no hostname was previously specified, get one from the system
		if globalhostname == "":	
			hostname = socket.gethostbyaddr(socket.gethostname())[0]
		else:
			hostname = globalhostname

	#acc_passwd = "".join([string.ascii_letters[int(random.randint(0,len(string.ascii_letters)-1))] for a in range(8)])
	ams_passwd = "".join([string.ascii_letters[int(random.randint(0,len(string.ascii_letters)-1))] for a in range(8)])
	df_passwd = "".join([string.ascii_letters[int(random.randint(0,len(string.ascii_letters)-1))] for a in range(8)])


	spadexml = """
	<spade>

               <platform>
                       <hostname>""" + hostname + """</hostname>
                       <port>5222</port>
               </platform>

               <acc>
	       #MTPS#
               </acc>

               <ams>
                      <hostname>ams."""+hostname+"""</hostname>
                      <password>"""+ams_<PASSWORD>+"""</password>
                      <port>9001</port>
               </ams>

               <df>
                      <hostname>df."""+hostname+"""</hostname>
                      <password>"""+df_passwd+"""</password>
                      <port>9002</port>
               </df>
	       
        </spade>
	"""

	# Now fill the MTPs information
	mtp_str = ""
	for file in os.listdir("spade/mtp"):
		try:
			# If its a python script
			if file[-3:] == ".py":
				fname = file[:-3]
				mtp_str = mtp_str + """<mtp name = """ + fname + """><instance>""" + fname + """</instance>"""
				mtp_str = mtp_str + """<protocol>""" + fname + """</protocol>"""
				mtp_str = mtp_str + """</mtp>"""
		except:
			pass
		
		# Fill the data
		spadexml = spadexml.replace("#MTPS#", mtp_str)	

	file = open("etc/spade.xml", "w+")
	file.write(spadexml)
	file.close()

	# Generating real xmppd.xml
	if os.name == 'posix':
		xmppdxml = '''
		<server>
	        	<servernames><commit_msg>packaging<commit_after>#!/usr/bin/env python

import sys
import string
import random
import os
import socket


globalhostname = ""

def generateCode():
	# Fill the template with the correct data
	
	global jabber_template
	global globalhostname

	if os.name == "posix":
			# If no hostname was previously specified, get one from the system
		if globalhostname == "":	
			hostname = socket.gethostname()
		else:
			hostname = globalhostname
		errorlog = "/dev/null"
	else:
		# If no hostname was previously specified, get one from the system
		if globalhostname == "":	
			hostname = socket.gethostbyaddr(socket.gethostname())[0]
		else:
			hostname = globalhostname

	#acc_passwd = "".join([string.ascii_letters[int(random.randint(0,len(string.ascii_letters)-1))] for a in range(8)])
	ams_passwd = "".join([string.ascii_letters[int(random.randint(0,len(string.ascii_letters)-1))] for a in range(8)])
	df_passwd = "".join([string.ascii_letters[int(random.randint(0,len(string.ascii_letters)-1))] for a in range(8)])


	spadexml = """
	<spade>

               <platform>
                       <hostname>""" + hostname + """</hostname>
                       <port>5222</port>
               </platform>

               <acc>
	       #MTPS#
               </acc>

               <ams>
                      <hostname>ams."""+hostname+"""</hostname>
                      <password>"""+ams_passwd+"""</password>
                      <port>9001</port>
               </ams>

               <df>
                      <hostname>df."""+hostname+"""</hostname>
                      <password>"""+df_passwd+"""</password>
                      <port>9002</port>
               </df>
	       
        </spade>
	"""

	# Now fill the MTPs information
	mtp_str = ""
	for file in os.listdir("spade/mtp"):
		try:
			# If its a python script
			if file[-3:] == ".py":
				fname = file[:-3]
				mtp_str = mtp_str + '''<mtp name = "''' + fname + '''><instance>''' + fname + '''</instance>'''
				mtp_str = mtp_str + """<protocol>""" + fname + """</protocol>"""
				mtp_str = mtp_str + """</mtp>"""
		except:
			pass
		
		# Fill the data
		spadexml = spadexml.replace("#MTPS#", mtp_str)	

	file = open("etc/spade.xml", "w+")
	file.write(spadexml)
	file.close()

	# Generating real xmppd.xml
	if os.name == 'posix':
		xmppdxml = '''
		<server>
	        	<servernames>
{'fraction_non_alphanumeric': 0.16216790648246546, 'fraction_numerical': 0.010201912858660999, 'mean_word_length': 2.3164200140944327, 'pattern_counts': {'":': 8, '<': 72, '<?xml version=': 0, '>': 72, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4956611', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1569, 'n_words': 333}