def test_store_buildlog(self): BuildLog.init(self.repo) for pkg in ['pkg1', 'pkg2', 'pkg1']: l, f = mkstemp(prefix='local-repo-test-buildlog-file-') BuildLog.store(pkg, f) self.assertIs(True, isfile(join(self.buildlog, pkg, basename(f))))
def _process_build_output(name, path): ''' Stores buildlogs and finds the package file ''' try: files = (f for f in listdir(path) if f.startswith(name)) except OSError: raise BuildError(_('Could not list directory: {0}').format(path)) pkgfile = None log = Config.get('buildlog', False) for f in files: if log and f.endswith(Package.LOGEXT): BuildLog.store(name, join(path, f)) elif f.endswith(Package.EXT): pkgfile = f return pkgfile
def from_pkgbuild(path, ignore_deps=False): ''' Makes a package from a pkgbuild ''' path = abspath(path) if basename(path) != Package.PKGBUILD: path = join(path, Package.PKGBUILD) if not isfile(path): raise BuildError(_('Could not find PKGBUILD: {0}').format(path)) info = PkgbuildParser(path).parse() if not ignore_deps: unresolved = Pacman.check_deps(info['depends'] + info['makedepends']) if unresolved: raise DependencyError(path, unresolved) path = dirname(path) log = bool(Config.get('buildlog', False)) if Config.get('pkgbuild', False): path = Package._load_pkgbuild(info['name'], path) try: Pacman.make_package(path, log=log) except PacmanError as e: raise e finally: pkgfile = None for f in (f for f in listdir(path) if f.startswith(info['name'])): if log and f.endswith(Package.LOGEXT): BuildLog.store(info['name'], join(path, f)) elif f.endswith(Package.EXT): pkgfile = f if pkgfile: return Package.from_file(join(path, pkgfile)) raise BuildError(_('Could not find any package'))