Skip to content

Commit

Permalink
Adding additional example recipes. Things I like.
Browse files Browse the repository at this point in the history
* I've mainly only guaranteed 'stable' working so far.
* Added recipes: ack, cmake, git, hg, libjsoncpp, zsh
  • Loading branch information
starcraftman committed Sep 14, 2015
1 parent 304cbf4 commit cdb53b4
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pakit/shell.py
Expand Up @@ -802,7 +802,7 @@ def terminate(self):
os.killpg(self._proc.pid, signal.SIGTERM)
self._proc.wait()

def wait(self, max_time=30):
def wait(self, max_time=60):
"""
Block here until the command is done.
Expand Down
38 changes: 38 additions & 0 deletions pakit_recipes/ack.py
@@ -0,0 +1,38 @@
""" Formula for building ack """
import os
import shutil

from pakit import Git, Recipe


class Ack(Recipe):
""" Advanced grep tool based on perl """
def __init__(self):
super(Ack, self).__init__()
self.desc = 'Advanced grep tool based on perl'
self.src = 'https://github.com/petdance/ack2.git'
self.homepage = self.src
self.repos = {
'stable': Git(self.src, tag='2.14'),
'unstable': Git(self.src),
}

def build(self):
self.cmd('perl Makefile.PL')
self.cmd('make ack-standalone manifypods')
ack_bin = os.path.join(self.opts['prefix'], 'bin', 'ack')
man_dir = os.path.join(self.opts['prefix'], 'share',
'man', 'man1')
for path in [os.path.dirname(ack_bin), man_dir]:
try:
os.makedirs(path)
except OSError:
pass
shutil.move(os.path.join(self.opts['source'], 'ack-standalone'),
ack_bin)
shutil.move(os.path.join(self.opts['source'], 'blib', 'man1',
'ack.1p'), man_dir)

def verify(self):
lines = self.cmd('{link}/bin/ack --version')
assert lines[0].find('ack') != -1
25 changes: 25 additions & 0 deletions pakit_recipes/cmake.py
@@ -0,0 +1,25 @@
""" Formula for building cmake """
from pakit import Archive, Git, Recipe


class Cmake(Recipe):
""" A cross-platform build tool for C++ """
def __init__(self):
super(Cmake, self).__init__()
self.desc = 'A cross-platform build tool for C++'
self.homepage = 'www.cmake.org'
self.repos = {
'stable': Archive('http://www.cmake.org/files/v3.3/cmake-3.3.1.tar.gz',
hash='799aff559e9f330fefc60e6509f1d025fc3d9c8c'),
'unstable': Git('git://cmake.org/cmake.git '),
}

def build(self):
self.cmd('./bootstrap --prefix={prefix} --mandir=share/man '
'--sphinx-html --sphinx-man')
self.cmd('make')
self.cmd('make install')

def verify(self):
lines = self.cmd('{link}/bin/cmake --version')
assert lines[0].find('cmake version') != -1
25 changes: 25 additions & 0 deletions pakit_recipes/git.py
@@ -0,0 +1,25 @@
""" Formula for building git """
from pakit import Archive, Recipe
from pakit import Git as GitRepo

class Git(Recipe):
""" The version control system """
def __init__(self):
super(Git, self).__init__()
self.desc = 'The version control system'
self.homepage = 'https://git-scm.com'
self.repos = {
'stable': Archive('https://www.kernel.org/pub/software/scm/git/git-2.5.2.tar.xz',
hash='5078512c7dba1db2d98814c1abe7550dc18507c9'),
'unstable': GitRepo('https://github.com/git/git'),
}

def build(self):
self.cmd('make configure')
self.cmd('./configure --prefix={prefix}')
self.cmd('make')
self.cmd('make install')

def verify(self):
lines = self.cmd('{link}/bin/git --version')
assert lines[0].find('git version') != -1
24 changes: 24 additions & 0 deletions pakit_recipes/hg.py
@@ -0,0 +1,24 @@
""" Formula for building hg """
from pakit import Archive, Recipe


class Hg(Recipe):
""" The distributed version control system """
def __init__(self):
super(Hg, self).__init__()
self.desc = 'The distributed version control system'
self.homepage = 'https://mercurial.selenic.com'
repo = Archive('http://mercurial.selenic.com/release/mercurial-3.5.1.tar.gz',
hash='fbe9c64dd4c065dbc9330aff4533fa1631d75c79')
self.repos = {
'stable': repo,
'unstable': repo,
}

def build(self):
self.cmd('make all')
self.cmd('make PREFIX={prefix} install')

def verify(self):
lines = self.cmd('{link}/bin/hg --version')
assert lines[0].find('Mercurial Distributed SCM') != -1
26 changes: 26 additions & 0 deletions pakit_recipes/libjsoncpp.py
@@ -0,0 +1,26 @@
""" Formula for building ag """
import os

from pakit import Git, Recipe


class Libjsoncpp(Recipe):
""" A json parser for c++ """
def __init__(self):
super(Libjsoncpp, self).__init__()
self.desc = 'A json parser for c++'
self.src = 'https://github.com/open-source-parsers/jsoncpp'
self.homepage = self.src
self.repos = {
'stable': Git(self.src, tag='0.10.5'),
'unstable': Git(self.src, branch='0.y.z'),
}

def build(self):
self.cmd('cmake -DCMAKE_INSTALL_PREFIX={prefix} -DCMAKE_BUILD_TYPE=release '
'-DJSONCPP_LIB_BUILD_SHARED=ON .')
self.cmd('make install')

def verify(self):
libpath = os.path.join(self.opts['link'], 'lib', 'libjsoncpp.a')
assert os.path.exists(libpath)
26 changes: 26 additions & 0 deletions pakit_recipes/zsh.py
@@ -0,0 +1,26 @@
""" Formula for building zsh """
from pakit import Archive, Git, Recipe


class Zsh(Recipe):
""" The zshell, a powerful interactive shell """
def __init__(self):
super(Zsh, self).__init__()
self.desc = 'The zshell, a powerful interactive shell'
self.homepage = 'http://zsh.sourceforge.net/'
self.repos = {
'stable': Archive('http://sourceforge.net/projects/zsh/files/zsh/5.0.7/' \
'zsh-5.0.7.tar.bz2/download',
hash='1500191d16af8a71aec4f719a92775a074682096'),
'unstable': Git('git://git.code.sf.net/p/zsh/code'),
}

def build(self):
self.cmd('./Util/preconfig')
self.cmd('autoconf')
self.cmd('./configure --prefix={prefix} --with-tcsetpgrp')
self.cmd('make install')

def verify(self):
lines = self.cmd('{link}/bin/zsh --version')
assert lines[0].find('zsh') != -1

0 comments on commit cdb53b4

Please sign in to comment.