def api_diff(self, api1, api2): ''' Make a diff of APIs @param api1: the first API @param api2: the second API @return: list of API differences ''' ret = ServiceResult() ret.result = apidiff(api1, api2) ret.meta = {'language': 'golang', 'tool': 'gofedlib'} return ret
def scm_store(self, repo_url, commit=None, branch=None): ''' Store a SCM repo @param repo_url: repo URL @param commit: commit hash; if None, the latest is used @param branch: branch; if None, "master" is used @return: ''' ret = ServiceResult() if not branch: branch = "master" if commit: commit = commit[:7] dirname = self._get_dirname(repo_url, commit, branch) filename = self._get_filename(dirname) dst_path = self.dircache.get_location(dirname) with self.get_lock(dirname): if not self.dircache.is_available(filename): repo = GitCmd.git_clone_repo(repo_url, dst_path) repo.git_checkout(branch) if commit: repo.git_checkout(commit) else: commit = repo.git_rev_parse_head(dst_path)[:7] # if user did not supplied commit, we have to check it explicitly filename_old = filename filename = self._get_filename( self._get_dirname(repo_url, commit, branch)) # we have to move it so it will be available with specified commit and branch if filename_old != filename: shutil.move(filename_old, filename) if not self.dircache.is_available(filename): # if user did not supplied commit, we have to pack the repo self._pack_repo(dirname, filename) shutil.rmtree(dst_path) if not self.dircache.is_available(filename): self.dircache.register(filename) ret.result = FileId.construct(self, self.dircache.get_file_path(filename)) ret.meta = {'origin': repo_url} return ret
def spec_buildrequires(self, file_id): ''' Get all buildrequires for a package @param specfile_id: a file id of a specfile/src.rpm stored in the system @return: list of buildrequires per package ''' ret = ServiceResult() input_path = self._prepare_file(file_id) output = self._specker_call(SpecFileRenderer.buildrequires_show, input_path) ret.result = self._parse_specker_output(output) ret.meta = {'tool': 'specker'} return ret
def scm_store(self, repo_url, commit=None, branch=None): ''' Store a SCM repo @param repo_url: repo URL @param commit: commit hash; if None, the latest is used @param branch: branch; if None, "master" is used @return: ''' ret = ServiceResult() if not branch: branch = "master" if commit: commit = commit[:7] dirname = self._get_dirname(repo_url, commit, branch) filename = self._get_filename(dirname) dst_path = self.dircache.get_location(dirname) with self.get_lock(dirname): if not self.dircache.is_available(filename): repo = GitCmd.git_clone_repo(repo_url, dst_path) repo.git_checkout(branch) if commit: repo.git_checkout(commit) else: commit = repo.git_rev_parse_head(dst_path)[:7] # if user did not supplied commit, we have to check it explicitly filename_old = filename filename = self._get_filename(self._get_dirname(repo_url, commit, branch)) # we have to move it so it will be available with specified commit and branch if filename_old != filename: shutil.move(filename_old, filename) if not self.dircache.is_available(filename): # if user did not supplied commit, we have to pack the repo self._pack_repo(dirname, filename) shutil.rmtree(dst_path) if not self.dircache.is_available(filename): self.dircache.register(filename) ret.result = FileId.construct(self, self.dircache.get_file_path(filename)) ret.meta = {'origin': repo_url} return ret