def from_pkgbuild(path, ignore_deps=False, force=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)) path, info = Package._process_pkgbuild(path) if not ignore_deps: unresolved = Pacman.check_deps(info['depends'] + info['makedepends']) if unresolved: raise DependencyError(path, unresolved) try: Pacman.make_package(path, force=force) except PacmanError as e: raise e finally: pkgfile = Package._process_build_output(info['name'], path) if pkgfile: return Package.from_file(join(path, pkgfile)) raise BuildError(_('Could not find any package: {0}').format(path))
def from_pkgbuild(path, ignore_deps=False, force=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)) path, info = Package._process_pkgbuild(path) if not ignore_deps: unresolved = Pacman.check_deps(info['depends'] + info['makedepends']) if unresolved: raise DependencyError(path, unresolved) try: Pacman.make_package(path, force=force) except PacmanError as e: raise e finally: pkgfile = Package._process_build_output(info['name'], path) if pkgfile: return Package.from_file(join(path, pkgfile)) raise BuildError(_('Could not find any package: {0}').format(path))
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'))
def test_make_package(self): Config.init('mytestrepo') Config.set('sign', False) Config.set('buildlog', '') Pacman.make_package('/tmp') self.assertEqual('/usr/bin/makepkg -d --nosign', PacmanTest.cmd) Pacman.make_package('/tmp', force=True) self.assertEqual('/usr/bin/makepkg -d -f --nosign', PacmanTest.cmd) Config.set('buildlog', '/some/path') Pacman.make_package('/tmp') self.assertEqual('/usr/bin/makepkg -d -L -m --nosign', PacmanTest.cmd) Config.set('sign', True) Pacman.make_package('/tmp') self.assertEqual('/usr/bin/makepkg -d -L -m --sign', PacmanTest.cmd)
def test_make_package(self): Config.init('mytestrepo') Config.set('sign', False) Config.set('buildlog', '') Pacman.make_package('/tmp') self.assertEqual('/usr/bin/makepkg -d --nosign', PacmanTest.cmd) Pacman.make_package('/tmp', force=True) self.assertEqual('/usr/bin/makepkg -d -f --nosign', PacmanTest.cmd) Config.set('buildlog', '/some/path') Pacman.make_package('/tmp') self.assertEqual('/usr/bin/makepkg -d -L -m --nosign', PacmanTest.cmd) Config.set('sign', True) Pacman.make_package('/tmp') self.assertEqual('/usr/bin/makepkg -d -L -m --sign', PacmanTest.cmd)