Ejemplo n.º 1
0
def svnUpdateFiles(svnPLADirectory):
    """
    Code to execute after an update operation has been detected. 

    The SVN repository uses '.pladata' to store the events observed for the
    different tools in *.tgz files. At this level, the folder 'feedback' is
    used to store the resources made available to the user. 

    The task to perform is to synchronize the content of this folder with a
    fixed folder in the user account after the update is executed.

    ~/.pladata/feedback

    Additionally and as a measure to allow changes in the tool WHILE the users
    are being monitored, the folder 'bin' is also synchronized.
    """

    # Perform the synchronization for the feedback, skip the svn admin folders
    try:
        pla.synchronizeFolders(
            os.path.join(svnPLADirectory, "feedback"),
            os.path.join(pla.plaDirectory, "feedback"),
            exclude=[".*/\.svn/?.*"],
        )
    except e:
        pla.dumpException(e)

    # Perform the synchronization for the bin, skip the svn admin folders
    try:
        pla.synchronizeFolders(
            os.path.join(svnPLADirectory, "bin"), os.path.join(pla.plaDirectory, "bin"), exclude=[".*/\.svn/?.*"]
        )
    except e:
        pla.dumpException(e)
Ejemplo n.º 2
0
def svnSendEvents(svnClient, svnPLADirectory):
    # 1) Gather information depending on the tool and place it in the proper
    # location
    # 2) Create a TGZ with all the files
    # 3) Add the file to SVN
    # 4) Commit the new file to SVN
    dataFiles = []
    tarFileName = pla.getUniqueFileName()

    ############################################################
    #
    # INSTRUMENTATION
    #
    ############################################################

    ############################################################
    # Bash instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(pla.bash.dataDir, pla.bash.dataFile, "bash", tarFileName))

    ############################################################
    # Last instrumentation
    ############################################################
    dataFiles.extend(pla.last.prepareDataFile(tarFileName))

    ############################################################
    # GCC instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAGcc.dataDir, PLAGcc.dataFile, "gcc", tarFileName))

    ############################################################
    # GDB instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAGdb.dataDir, PLAGdb.dataFile, "gdb", tarFileName))

    ############################################################
    # Valgrind instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAValgrind.dataDir, PLAValgrind.dataFile, "valgrind", tarFileName))

    ############################################################
    # Kdevelop instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAKdevelop.dataDir, PLAKdevelop.dataFile, "kdevelop", tarFileName))

    ############################################################
    # Kate instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAKate.dataDir, PLAKate.dataFile, "kate", tarFileName))

    ############################################################
    # iWatch instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(pla.iwatch.dataDir, pla.iwatch.dataFile, "iwatch", tarFileName))

    ############################################################
    # Firefox instrumentation
    ############################################################
    dataFiles.extend(pla.firefox.prepareDataFile(tarFileName))

    ############################################################
    # Javac instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAJavac.dataDir, PLAJavac.dataFile, "javac", tarFileName))

    ############################################################
    # ArgoUML instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAArgouml.dataDir, PLAArgouml.dataFile, "argouml", tarFileName))

    ############################################################
    # WebRatio instrumentation
    ############################################################
    dataFiles.extend(pla.prepareDataFile(PLAWebratio.dataDir, PLAWebratio.dataFile, "webratio", tarFileName))

    ############################################################
    pla.logMessage("placlient: Data files = " + str(dataFiles))

    # If empty list of data files, terminate
    if dataFiles == []:
        pla.logMessage("placlient: empty tar file")
        return

    # TGZ all the data files
    tarFile = os.path.join(svnPLADirectory, tarFileName + ".tgz")
    pla.createTarFile(dataFiles, tarFile)

    ############################################################
    #
    # REMOVE TEMPORARY FILES
    #
    ############################################################
    pla.removeTemporaryData(pla.bash.dataDir, pla.bash.dataFile, "bash", tarFileName)
    pla.removeTemporaryData(pla.last.dataDir, pla.last.dataFile, "last", tarFileName)
    pla.removeTemporaryData(PLAGcc.dataDir, PLAGcc.dataFile, "gcc", tarFileName)
    pla.removeTemporaryData(PLAGdb.dataDir, PLAGdb.dataFile, "gdb", tarFileName)
    pla.removeTemporaryData(PLAValgrind.dataDir, PLAValgrind.dataFile, "valgrind", tarFileName)
    pla.removeTemporaryData(PLAKdevelop.dataDir, PLAKdevelop.dataFile, "kdevelop", tarFileName)
    pla.removeTemporaryData(PLAKate.dataDir, PLAKate.dataFile, "kate", tarFileName)
    pla.removeTemporaryData(pla.iwatch.dataDir, pla.iwatch.dataFile, "iwatch", tarFileName)
    pla.removeTemporaryData(pla.firefox.dataDir, pla.firefox.dataFile, "firefox", tarFileName)
    try:
        pla.logMessage("placlient: update " + svnPLADirectory)
        svnClient.update(svnPLADirectory)
    except pysvn.ClientError, e:
        # Exception when updating, not much we can do, log a message if in
        # debug, and terminate.
        pla.dumpException(e)
        # Remove tar file, will not be used
        os.remove(tarFile)
        return
Ejemplo n.º 3
0
    except pysvn.ClientError, e:
        # Exception when updating, not much we can do, log a message if in
        # debug, and terminate.
        pla.dumpException(e)
        # Remove tar file, will not be used
        os.remove(tarFile)
        return

    # Add the tar file to subversion
    try:
        pla.logMessage("placlient: add " + tarFile)
        svnClient.add(tarFile)
    except pysvn.ClientError, e:
        # Remove tar file, will not be used
        os.remove(tarFile)
        pla.dumpException(e)

    # If the "add" operation has been successfull, we may assume that the data
    # will eventually reach the server. The following commit could fail, but the
    # files are already under subversion. As a consequence, update the
    # footprint.
    pla.setLastExecutionTStamp()

    # TO BE DONE: Walk over the svnPLADirectory and find files that are NOT
    # under version control. It might be due to previous SVN command failures.

    # COMMIT: Final commit of the data directory. If there is a problem,
    try:
        pla.logMessage("placlient: commit " + tarFile)
        svnClient.checkin(tarFile, "PLA Automatic commit")
    except pysvn.ClientError, e: