Esempio n. 1
0
	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))))
Esempio n. 2
0
    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))))
Esempio n. 3
0
	def init(path, config_file=Config.CONFIGFILE):
		''' Needs the path to repo, or the repo name if specified in the config file '''
		try:
			Config.init(path, config_file)
			LocalRepo._repo = Repo(Config.get('path', path))
			Log.init(LocalRepo._repo.path)
			BuildLog.init(LocalRepo._repo.path)
			PkgbuildLog.init(LocalRepo._repo.path)
		except LocalRepoError as e:
			LocalRepo.error(e)
Esempio n. 4
0
 def init(path, config_file=Config.CONFIGFILE):
     ''' Needs the path to repo, or the repo name if specified in the config file '''
     try:
         Config.init(path, config_file)
         LocalRepo._repo = Repo(Config.get('path', path))
         Log.init(LocalRepo._repo.path)
         BuildLog.init(LocalRepo._repo.path)
         PkgbuildLog.init(LocalRepo._repo.path)
     except LocalRepoError as e:
         LocalRepo.error(e)
Esempio n. 5
0
    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
Esempio n. 6
0
	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
Esempio n. 7
0
	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'))