예제 #1
0
 def _action(self):
     AbstractAction._action(self)
     time = datetime.datetime.now().strftime('%y%m%d%H%M');
     tag = self.brand + "_" + self.app_name 
     deploy_file = self.deploy_dir + "/" + tag + "_" + time + ".tar.gz"
     cmd = "/bin/tar zcf " + deploy_file + " -C " + self.temp_dir + " " + self.app_name
     def f(x):
         return x.find(tag) > -1
     
     callCommand(cmd)
 
     archives = list(filter(f, os.listdir(self.deploy_dir)))
     archives.sort()
     length = len(archives)
     
     numofversion = int(self.numofversion)
     if length > numofversion:
         for item in archives[0:length - numofversion - 1]:
             os.remove(self.deploy_dir + "/" + item)
예제 #2
0
 def updateSVN(svn_path, svn_rev):
     cmd_svn_info = """svn info {0}"""
     cmd_svn_up = """svn update {0} -r {1}"""
     
     # svn update
     cmd = cmd_svn_up.format(svn_path, svn_rev)
     command.callCommand(cmd)
     
     # svn info
     cmd = cmd_svn_info.format(svn_path)
     stdoutdata = command.callCommand(cmd)
     svn_infos = {}
     for line in stdoutdata.decode().split("\n"):
         splits = line.split(":")
         if len(splits) < 1:
             break;
         left = splits[0].strip()
         right = "".join(splits[1:]).strip()
         svn_infos[left] = right
     return svn_infos
예제 #3
0
 def getSVNLog(svn_path):
     try:
         cmd_svn_log = """svn log -r HEAD:1 {0} -l 5 --xml"""  
         # svn log
         cmd = cmd_svn_log.format(svn_path)
         stoutdata = command.callCommand(cmd)
     
         bio = BytesIO(stoutdata)
         tree = ET.parse(bio)
         #tree = ET.parse("d:\log.xml")
         root = tree.getroot()
         entries = []
         for logentry in root.findall("logentry"): 
             author = logentry.find('author').text   
             date = logentry.find('date').text
             msg = logentry.find('msg').text
             revision = logentry.get('revision')
             entries.append((revision, author, date, msg))
         return entries
     except Exception as e:
         logging.debug(e)
         return None