示例#1
0
def getPathLastRev(path):
    ''' Check the SVN revision of the given SVN path '''
    rev = None
    infostr = callCommand('svn', 'info', path)[0]
    for l in infostr.splitlines():
        m = re.match("Last Changed Rev: (\d+)", l)
        if m != None:
            rev = m.group(1)
            break
    return rev
示例#2
0
def checkOrDiff(package, versions=[], dodiff=True):
    '''Check if the package exists and check also the svn diffs
    returns a string for printing, terminated with a newline character'''
    if not lbsvn.hasVersion(package, versions[0]):
        return ("====================\n" + 'Error: ' + package + ' ' +
                versions[0] + ' does not exist\n' + '====================\n')
    if len(versions) == 1:
        return '=== ' + package + ' ' + versions[0] + ' OK ===\n'

    if len(versions) > 2:
        raise KeyError, "You sent more than two versions to diff, please send only one"
    if not lbsvn.hasVersion(package, versions[1]):
        return ("====================\n" + 'Error: ' + package + ' ' +
                versions[1] + ' does not exist\n' + '====================\n')
    if not dodiff:
        return '=== ' + package + ' ' + versions[0] + ' OK ===\n'

    path1 = lbsvn.url(package, versions[0])
    path2 = lbsvn.url(package, versions[1])
    diffs = callCommand("svn", "diff", "--summarize", path1, path2)[0].strip()
    #diffs=commands.getoutput("svn diff --summarize "+path1+' '+path2).strip()
    diffs = '\n'.join([
        line.strip() for line in diffs.split('\n')
        if "/usr/bin/xauth:  error in locking authority file" not in line
    ])
    #replace path with package to avoid annoying svn diff format
    while path1 in diffs:
        if '/' == path1[-1]:
            diffs = diffs.replace(path1, package + '/')
        else:
            diffs = diffs.replace(path1, package)
    #replace path with package to avoid annoying svn diff format
    while path2 in diffs:
        if '/' == path2[-1]:
            diffs = diffs.replace(path2, package + '/')
        else:
            diffs = diffs.replace(path2, package)

    if len(diffs):
        result = ('=== ' + package + ' ' + versions[0] + '->' + versions[1] +
                  ' ===\n')
        result = result + diffNotes(getNotes(path1),
                                    getNotes(path2)) + diffs + '\n'
        return result

    #if there are no diffs, state that the two are equal
    return ('=== ' + package + ' ' + versions[0] + '=' + versions[1] +
            ' ===\n')
示例#3
0
def getNotes(path):
    return callCommand('svn', 'cat', path + '/doc/release.notes')[0]
示例#4
0
def getCMakeLists(path):
    return callCommand('svn', 'cat', path + '/CMakeLists.txt')[0]
示例#5
0
def getRequirements(path):
    return callCommand('svn', 'cat', path + '/cmt/requirements')[0]
示例#6
0
 def testBadCommandWithReport(self):
     out, err, rc = callCommand("test", report_failure=True)
     self.assertNotEqual(rc,0)
示例#7
0
 def testBadCommand(self):
     out, err, rc = callCommand("test")
     self.assertNotEqual(rc,0)
示例#8
0
 def testGoodCommandWithReport(self):
     out, err, rc = callCommand("echo", "titi", report_failure=True)
     self.assertEqual(out,"titi\n")
     self.assertEqual(err,"")
     self.assertEqual(rc,0)
示例#9
0
 def testGoodCommand(self):
     out, err, rc = callCommand("echo", "titi")
     self.assertEqual(out,"titi\n")
     self.assertEqual(err,"")
     self.assertEqual(rc,0)
示例#10
0
def getProjectCmt(path):
    return callCommand('svn','cat',path+'/cmt/project.cmt')[0]