def get_modules(self): try: # First layout repo = create_repository('svn', 'http://svn.gnome.org/svn/gnome-common') module = repo.get_modules() if module[0] != 'gnome-common': print "SVN get_modules: FAILED" return except: print "SVN get_modules: FAILED" return try: # Second layout repo = create_repository( 'svn', 'https://svn.forge.morfeo-project.org/svn/libresoft-tools') modules = repo.get_modules() if len(modules) <= 0: print "SVN get_modules: FAILED" return except: print "SVN get_modules: FAILED" return print "SVN get_modules: PASSED"
def checkout(self): # checkout self.repo = create_repository('svn', 'http://svn.gnome.org/svn/gnome-common') self.repo.checkout('gnome-common', '/tmp/', branch="trunk", rev="3910") if not os.path.exists('/tmp/gnome-common/.svn') or \ self.repo.get_last_revision('/tmp/gnome-common') != "3910": print "SVN checkout: FAILED" return self.repo.checkout('gnome-common', '/tmp/', newdir='gnome-common-2.16', branch='gnome-2-16') if os.path.exists('/tmp/gnome-common-2.16/.svn'): print "SVN checkout: PASSED" try: repo2 = create_repository_from_path('/tmp/gnome-common-2.16') except: print "SVN create_repository_from_path: FAILED" return try: repo2 = create_repository_from_path('/tmp/') except RepositoryUnknownError: print "SVN create_repository_from_path: PASSED" except: print "SVN create_repository_from_path: FAILED" else: print "SVN checkout: FAILED" return try: # Repository without trunk dir repo2 = create_repository( 'svn', 'https://svn.forge.morfeo-project.org/svn/libresoft-tools') repo2.checkout('octopus/trunk', '/tmp/', newdir='octopus') if not os.path.exists('/tmp/octopus/.svn'): print "SVN checkout repo without /trunk: FAILED" return except: print "SVN checkout repo without /trunk: FAILED" return print "SVN checkout repo without /trunk: PASSED" try: # Download unconditionally the whole repo repo3 = create_repository('svn', 'http://svn.gnome.org/svn/asyncworker') repo3.checkout('.', '/tmp/') if not os.path.exists('/tmp/asyncworker/.svn'): print "SVN checkout the whole repo: FAILED" return except: print "SVN checkout the whole repo: FAILED" return print "SVN checkout the whole repo: PASSED"
def checkout (self): self.repo = create_repository ('git', 'git://git.kernel.org/pub/scm/') self.repo.checkout ('utils/kernel/cpufreq/cpufrequtils.git', '/tmp/', newdir = 'cpufrequtils') if not os.path.exists ('/tmp/cpufrequtils/.git'): print "Git checkout: FAILED" return self.repo.checkout ('utils/pciutils/pciutils.git', '/tmp/', newdir = 'pciutils', branch = 'network') if not os.path.exists ('/tmp/pciutils/.git'): print "Git checkout: FAILED" return # Test module = '.' repo2 = create_repository ('git', 'git://anongit.freedesktop.org/libspectre') repo2.checkout ('.', '/tmp') if not os.path.exists ('/tmp/libspectre/.git'): print "Git checkout (module = '.'): FAILED" return try: repo2 = create_repository_from_path ('/tmp/cpufrequtils') except: print "Git create_repository_from_path: FAILED" return try: repo2 = create_repository_from_path ('/tmp/') except RepositoryUnknownError: print "Git create_repository_from_path: PASSED" except: print "Git create_repository_from_path: FAILED" return print "Git checkout: PASSED"
def checkout(self): # checkout self.repo = create_repository('tarball', None) self.repo.checkout( 'http://cairographics.org/snapshots/pycairo-0.4.0.tar.gz', '/tmp/') if not os.path.exists('/tmp/pycairo-0.4.0.tar.gz'): print "Tarball checkout: FAILED" return elif not os.path.exists('/tmp/pycairo-0.4.0/ChangeLog'): print "Tarball checkout: FAILED" return # checkout with local path self.repo.checkout('/tmp/pycairo-0.4.0.tar.gz', '/tmp/pycairo-local') if not os.path.exists('/tmp/pycairo-local/pycairo-0.4.0/ChangeLog'): print "Tarball checkout: FAILED" return # Mbox self.repo.checkout('http://lists.morfeo-project.org/pipermail/' 'libresoft-tools-devel/2007-April.txt.gz', '/tmp') if not os.path.exists('/tmp/2007-April.txt'): print "Tarball checkout: FAILED" return print "Tarball checkout: PASSED"
def checkout (self): # checkout self.repo = create_repository ('cvs', ':pserver:[email protected]:/cvs/poppler') self.repo.add_watch (CHECKOUT, output, "check out") self.repo.checkout ('poppler', '/tmp/') if not os.path.exists ('/tmp/poppler/CVS'): print "CVS checkout: FAILED" return self.repo.checkout ('poppler', '/tmp/', newdir = 'poppler-0.5', rev = 'POPPLER_0_5_X') if os.path.exists ('/tmp/poppler-0.5/CVS'): print "CVS checkout module: PASSED" try: repo2 = create_repository_from_path ('/tmp/poppler-0.5/') except: print "CVS create_repository_from_path: FAILED" return try: repo2 = create_repository_from_path ('/tmp/') except RepositoryUnknownError: print "CVS create_repository_from_path: PASSED" except: print "CVS create_repository_from_path: FAILED" else: print "CVS checkout: FAILED" # checkout of all modules module print "CVS checkout of all modules" self.repo.checkout ('.', '/tmp/', newdir = 'poppler_modules-0.5', rev = 'POPPLER_0_5_X') if not os.path.exists ('/tmp/poppler_modules-0.5/CVS'): print "CVS checkout: FAILED" return print "CVS checkout: PASSED"
def checkout(self): # checkout self.repo = create_repository('tarball', None) self.repo.checkout( 'http://cairographics.org/snapshots/pycairo-0.4.0.tar.gz', '/tmp/') if not os.path.exists('/tmp/pycairo-0.4.0.tar.gz'): print "Tarball checkout: FAILED" return elif not os.path.exists('/tmp/pycairo-0.4.0/ChangeLog'): print "Tarball checkout: FAILED" return # checkout with local path self.repo.checkout('/tmp/pycairo-0.4.0.tar.gz', '/tmp/pycairo-local') if not os.path.exists('/tmp/pycairo-local/pycairo-0.4.0/ChangeLog'): print "Tarball checkout: FAILED" return # Mbox self.repo.checkout( 'http://lists.morfeo-project.org/pipermail/libresoft-tools-devel/2007-April.txt.gz', '/tmp') if not os.path.exists('/tmp/2007-April.txt'): print "Tarball checkout: FAILED" return print "Tarball checkout: PASSED"
def __init__ (self, repo, repo_uri, jobs_done = True, poolsize = POOL_SIZE, queuesize = None): self.jobs_done = jobs_done self.queue = AsyncQueue (queuesize or 0) if self.jobs_done: self.done = AsyncQueue () for i in range (poolsize): rep = rh.create_repository (repo.get_type (), repo.get_uri ()) thread = threading.Thread (target=self._job_thread, args=(rep, repo_uri)) thread.setDaemon (True) thread.start ()
def checkout(self): self.repo = create_repository('git', 'git://git.kernel.org/pub/scm/') self.repo.checkout('utils/kernel/cpufreq/cpufrequtils.git', '/tmp/', newdir='cpufrequtils') if not os.path.exists('/tmp/cpufrequtils/.git'): print "Git checkout: FAILED" return self.repo.checkout('utils/pciutils/pciutils.git', '/tmp/', newdir='pciutils', branch='network') if not os.path.exists('/tmp/pciutils/.git'): print "Git checkout: FAILED" return # Test module='.' repo2 = create_repository('git', 'git://anongit.freedesktop.org/libspectre') repo2.checkout('.', '/tmp') if not os.path.exists('/tmp/libspectre/.git'): print "Git checkout(module='.'): FAILED" return try: repo2 = create_repository_from_path('/tmp/cpufrequtils') except: print "Git create_repository_from_path: FAILED" return try: repo2 = create_repository_from_path('/tmp/') except RepositoryUnknownError: print "Git create_repository_from_path: PASSED" except: print "Git create_repository_from_path: FAILED" return print "Git checkout: PASSED"
def checkout (self): self.repo = create_repository ('bzr', 'http://pkg-config.freedesktop.org/bzr/') self.repo.checkout ('pkg-config', '/tmp/', newdir = 'pkg-config') if not os.path.exists ('/tmp/pkg-config/.bzr'): print "Bzr checkout: FAILED" return try: repo2 = create_repository_from_path ('/tmp/pkg-config') except: print "Bzr create_repository_from_path: FAILED" return print "Bzr checkout: PASSED"
def checkout(self): self.repo = create_repository( 'bzr', 'http://pkg-config.freedesktop.org/bzr/') self.repo.checkout('pkg-config', '/tmp/', newdir='pkg-config') if not os.path.exists('/tmp/pkg-config/.bzr'): print "Bzr checkout: FAILED" return try: repo2 = create_repository_from_path('/tmp/pkg-config') except: print "Bzr create_repository_from_path: FAILED" return print "Bzr checkout: PASSED"
def log(self): # log(current branch) def log_cb(data, user_data=None): self.log_data += data self.repo.add_watch(LOG, log_cb) try: # Using a local path self.log_data = "" self.repo.log('/tmp/gnome-common', files=['ChangeLog']) except: print "SVN log: FAILED" return if len(self.log_data) <= 0: print "SVN log: FAILED" return try: # Using an URI self.log_data = "" self.repo.log('http://svn.gnome.org/svn/gnome-common/trunk', files=['ChangeLog']) except: print "SVN log: FAILED" return if len(self.log_data) <= 0: print "SVN log: FAILED" # Repository without trunk dir repo2 = create_repository( 'svn', 'https://svn.forge.morfeo-project.org/svn/libresoft-tools') repo2.add_watch(LOG, log_cb) try: self.log_data = "" repo2.rlog('octopus/trunk') except: print "SVN rlog: FAILED" return if len(self.log_data) <= 0: print "SVN rlog: FAILED" else: print "SVN rlog: PASSED"
print "(%s: %s) on branch %s" % (action.f2, action.rev, commit.branch or action.branch_f1) else: print "on branch %s" % (commit.branch or action.branch_f1) print "Message" print commit.message def new_line(line, user_data=None): user_data.feed(line) reader = LogReader() if os.path.isfile(sys.argv[1]): # Parser from logfile p = create_parser_from_logfile(sys.argv[1]) reader.set_logfile(sys.argv[1]) else: path = uri_to_filename(sys.argv[1]) if path is not None: repo = create_repository_from_path(path) else: repo = create_repository('svn', sys.argv[1]) path = sys.argv[1] p = create_parser_from_repository(repo) reader.set_repo(repo, path) p.set_content_handler(StdoutContentHandler()) reader.start(new_line, p) p.end()
class Job: def __init__(self): self.failed = False def run (self, repo, repo_uri): raise NotImplementedError if __name__ == '__main__': class JobLastRev (Job): def __init__ (self, module): self.module = module def run (self, repo, repo_uri): uri = repo_uri + self.module print "%s -> %s" % (uri, repo.get_last_revision (uri)) modules = ['cvsanaly', 'octopus', 'cmetrics', 'repositoryhandler', 'retrieval_system', 'bicho', 'pandaRest'] repo = rh.create_repository ('svn', 'https://svn.forge.morfeo-project.org/svn/libresoft-tools/') repo_uri = 'https://svn.forge.morfeo-project.org/svn/libresoft-tools/' pool = JobPool (repo, repo_uri, False) for module in modules: job = JobLastRev (module) pool.push (job) pool.join ()
class Job(object): def __init__(self): self.failed = False def run(self, repo, repo_uri): raise NotImplementedError if __name__ == '__main__': class JobLastRev(Job): def __init__(self, module): self.module = module def run(self, repo, repo_uri): uri = repo_uri + self.module print "%s -> %s" % (uri, repo.get_last_revision(uri)) repo_uri = 'https://svn.forge.morfeo-project.org/svn/libresoft-tools/' modules = ['cvsanaly', 'octopus', 'cmetrics', 'repositoryhandler', 'retrieval_system', 'bicho', 'pandaRest'] repo = rh.create_repository('svn', repo_uri) repo_uri = 'https://svn.forge.morfeo-project.org/svn/libresoft-tools/' pool = JobPool(repo, repo_uri, False) for module in modules: job = JobLastRev(module) pool.push(job) pool.join()
printdbg("Creating repositoryhandler instance") repo = create_repository_from_path(path) repo.timeout = 120 except RepositoryUnknownError: printerr("Path %s doesn't seem to point to a repository " + \ "supported by cvsanaly", (path,)) sys.exit(1) except Exception, e: printerr("Unknown error creating repository for path %s (%s)", (path, str(e))) sys.exit(1) uri = repo.get_uri_for_path(path) return (uri, repo) else: uri = uri.strip('/') repo = create_repository('svn', uri) # Check uri actually points to a valid svn repo if repo.get_last_revision(uri) is None: printerr("URI %s doesn't seem to point to a valid svn repository", (uri,)) sys.exit(1) else: return (uri, repo) def _get_parser_from_repository(repo): return create_parser_from_repository(repo) def _get_extensions_manager(extensions, hard_order=False): try: printdbg("Starting ExtensionsManager") emg = ExtensionsManager(extensions,
def join(self): self.queue.join() class Job: def run(self, repo, repo_uri): raise NotImplementedError if __name__ == "__main__": class JobLastRev(Job): def __init__(self, module): self.module = module def run(self, repo, repo_uri): uri = repo_uri + self.module print "%s -> %s" % (uri, repo.get_last_revision(uri)) modules = ["cvsanaly", "octopus", "cmetrics", "repositoryhandler", "retrieval_system", "bicho", "pandaRest"] repo = rh.create_repository("svn", "https://svn.forge.morfeo-project.org/svn/libresoft-tools/") repo_uri = "https://svn.forge.morfeo-project.org/svn/libresoft-tools/" pool = JobPool(repo, repo_uri, False) for module in modules: job = JobLastRev(module) pool.push(job) pool.join()
print "%s %s " % (action.type, action.f1), if action.f2 is not None: print "(%s: %s) on branch %s" % (action.f2, action.rev, commit.branch or action.branch_f1) else: print "on branch %s" % (commit.branch or action.branch_f1) print "Message" print commit.message def new_line(line, user_data=None): user_data.feed(line) reader = LogReader() if os.path.isfile(sys.argv[1]): # Parser from logfile p = create_parser_from_logfile(sys.argv[1]) reader.set_logfile(sys.argv[1]) else: path = uri_to_filename(sys.argv[1]) if path is not None: repo = create_repository_from_path(path) else: repo = create_repository("svn", sys.argv[1]) path = sys.argv[1] p = create_parser_from_repository(repo) reader.set_repo(repo, path) p.set_content_handler(StdoutContentHandler()) reader.start(new_line, p) p.end()
if __name__ == '__main__': import sys import os from utils import uri_to_filename from repositoryhandler.backends import create_repository, create_repository_from_path def new_line(line, user_data=None): print line.strip('\n') if user_data is not None: user_data.add_line(line) path = uri_to_filename(sys.argv[1]) if path is not None: repo = create_repository_from_path(path) else: repo = create_repository('svn', sys.argv[1]) path = sys.argv[1] reader = LogReader() reader.set_repo(repo, path) writer = None if len(sys.argv) > 2: if os.path.isfile(sys.argv[2]): reader.set_logfile(sys.argv[2]) else: writer = LogWriter(sys.argv[2]) reader.start(new_line, writer) writer and writer.close()
def run(self, repo, repo_uri): raise NotImplementedError if __name__ == '__main__': class JobLastRev(Job): def __init__(self, module): self.module = module def run(self, repo, repo_uri): uri = repo_uri + self.module print "%s -> %s" % (uri, repo.get_last_revision(uri)) repo_uri = 'https://svn.forge.morfeo-project.org/svn/libresoft-tools/' modules = [ 'cvsanaly', 'octopus', 'cmetrics', 'repositoryhandler', 'retrieval_system', 'bicho', 'pandaRest' ] repo = rh.create_repository('svn', repo_uri) repo_uri = 'https://svn.forge.morfeo-project.org/svn/libresoft-tools/' pool = JobPool(repo, repo_uri, False) for module in modules: job = JobLastRev(module) pool.push(job) pool.join()
# Create repository path = uri_to_filename(uri) if path is not None: try: repo = create_repository_from_path(path) except RepositoryUnknownError: printerr("Path %s doesn't seem to point to a repository supported by guilty", (path,)) return 1 except Exception, e: printerr("Unknown error creating repository for path %s (%s)", (path, str(e))) return 1 uri = repo.get_uri_for_path(path) else: uri = uri.strip("/") repo = create_repository("svn", uri) # Check uri actually points to a valid svn repo if repo.get_last_revision(uri) is None: printerr("URI %s doesn't seem to point to a valid svn repository", (uri,)) return 1 # Check we have a parser for the given repo try: p = create_parser(repo.get_type(), "foo") except ParserUnknownError: printerr("%s repositories are not supported by guilty (yet)", (repo.get_type(),)) return 1 except Exception, e: printerr("Unknown error creating parser for repository %s (%s)", (repo.get_uri(), str(e))) return 1 del p
printdbg("Creating repositoryhandler instance") repo = create_repository_from_path(path) repo.timeout = 120 except RepositoryUnknownError: printerr("Path %s doesn't seem to point to a repository " + \ "supported by cvsanaly", (path,)) sys.exit(1) except Exception, e: printerr("Unknown error creating repository for path %s (%s)", (path, str(e))) sys.exit(1) uri = repo.get_uri_for_path(path) return (uri, repo) else: uri = uri.strip('/') repo = create_repository('svn', uri) # Check uri actually points to a valid svn repo if repo.get_last_revision(uri) is None: printerr("URI %s doesn't seem to point to a valid svn repository", (uri, )) sys.exit(1) else: return (uri, repo) def _get_parser_from_repository(repo): return create_parser_from_repository(repo) def _get_extensions_manager(extensions, hard_order=False): try:
def build(self): options = BuilderOptions() options.setWorkFolder(self.folderName + os.sep + 'work') options.setDataFolder(self.folderName + os.sep + 'data') if self.cleanProjectFolder or (not os.path.exists(self.folderName)): shutil.rmtree(self.folderName, True) os.mkdir(self.folderName) os.mkdir(options.getWorkFolder()) os.mkdir(options.getDataFolder()) os.mkdir(options.getBackupFolder()) separator = '/' paths = self.repositoryUri.split(separator) repositoryProjectName = paths.pop() options.setRepositoryRoot(repositoryProjectName) options.setRepositoryProjectName(repositoryProjectName) shortenedRepositoryUri = separator.join(paths) if self.repositoryType == "cvs": repo = ExtendedCVSRepository(shortenedRepositoryUri) elif self.repositoryType == "git": repo = ExtendedGitRepository(shortenedRepositoryUri) else: repo = create_repository(self.repositoryType, shortenedRepositoryUri) uri = repo.get_uri() if uri != shortenedRepositoryUri: newRoot = shortenedRepositoryUri[ len(uri):] + separator + options.getRepositoryRoot() if newRoot[0] == separator: newRoot = newRoot[1:] options.setRepositoryRoot(newRoot) options.setRepository(repo) transactionDict = self.extractor.getTransactionDictionary() self.firstTransaction = True firstTransactionToProcess = True priorTransaction = None transactionList = transactionDict.dictByNumber.keys() transactionList.sort() for transactionNumber in transactionList: transaction = transactionDict.getEntityByNumber(transactionNumber) cdifFile = options.getDataFolder( ) + os.sep + options.getRepositoryProjectName( ) + '_' + transaction.getUniqueName() + '.cdif' if self.transactionHasSourceChanges(transaction): if (not firstTransactionToProcess) or ( not os.path.exists(cdifFile)): if firstTransactionToProcess and ( not (priorTransaction is None)): self.reprocess = True self.processTransaction(priorTransaction, options) self.reprocess = False self.processTransaction(transaction, options) firstTransactionToProcess = False priorTransaction = transaction self.firstTransaction = False