Permalink
Browse files

Add more examples

  • Loading branch information...
1 parent 77ca9c3 commit 131391d20d227c79e0be7f5be1666357fe9023ce socketubs committed Jan 10, 2013
View
@@ -0,0 +1 @@
+*.pyc
@@ -1 +1 @@
-[{"vers": "novers", "dist": "osx", "name": "htop", "requires": [], "version": "0.8.2.1", "release": "4", "md5": "04c4357d69999bf93d429bab0cb0ed53", "arch": "x86_64", "description": "Htop is an interactive process viewer for Linux. It is a text-mode application (for console or X terminals) and requires ncurses."}, {"vers": "novers", "dist": "osx", "name": "spilleliste", "requires": [], "version": "0.1.0", "release": "0", "md5": "40f71436462412a24a2a5ff51e102eb9", "arch": "x86_64", "description": "Spilleliste read your iTunes playlist and generate for you a simple but beautiful html page to share with your friends with all the Spotify links (Youtube fallback) you want."}, {"vers": "novers", "dist": "osx", "name": "wget", "requires": [], "version": "1.14", "release": "0", "md5": "56b2e7390105c5b4e422908deb9db753", "arch": "x86_64", "description": "GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc."}]
+[{"vers": "novers", "dist": "nodist", "name": "beautifulsoup4", "requires": [], "version": "4.1.3", "release": "0", "md5": "45b68b6457589597e0b70bb11ea351ec", "arch": "noarch", "description": "Python HTML parser"}, {"vers": "novers", "dist": "nodist", "name": "isit", "requires": [], "version": "0.2.5", "release": "0", "md5": "88030785f57e8d79bec8462cea133c58", "arch": "noarch", "description": "Environment runtime detection (Python,Linux,Distribution,etc...)"}, {"vers": "novers", "dist": "nodist", "name": "pyhn", "requires": ["isit", "urwid", "beautifulsoup4"], "version": "0.1.8", "release": "0", "md5": "44206d06a2de6936230a633c64725c09", "arch": "noarch", "description": "Hacker news client in Ncurses"}, {"vers": "novers", "dist": "nodist", "name": "urwid", "requires": [], "version": "1.1.1", "release": "0", "md5": "a27f2d5efc64f5d94e627e99750b1751", "arch": "noarch", "description": "A full-featured console (xterm et al.) user interface library"}, {"vers": "novers", "dist": "osx", "name": "spilleliste", "requires": [], "version": "0.1.0", "release": "0", "md5": "40f71436462412a24a2a5ff51e102eb9", "arch": "x86_64", "description": "Spilleliste read your iTunes playlist and generate for you a simple but beautiful html page to share with your friends with all the Spotify links (Youtube fallback) you want."}, {"vers": "novers", "dist": "osx", "name": "htop", "requires": [], "version": "0.8.2.1", "release": "4", "md5": "04c4357d69999bf93d429bab0cb0ed53", "arch": "x86_64", "description": "Htop is an interactive process viewer for Linux. It is a text-mode application (for console or X terminals) and requires ncurses."}, {"vers": "novers", "dist": "osx", "name": "wget", "requires": [], "version": "1.14", "release": "0", "md5": "56b2e7390105c5b4e422908deb9db753", "arch": "x86_64", "description": "GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc."}, {"vers": "1204", "dist": "ubuntu", "name": "python3", "requires": [], "version": "3.3.0", "release": "0", "md5": "9a192231ebec1c06655eb996e4299c36", "arch": "x86_64", "description": "Python 3 interpreter"}]
@@ -28,10 +28,6 @@ def __init__(self):
self.archive_name = "%s-%s.tar.gz" % (self.name, self.version)
self.dir_name = "%s-%s" % (self.name, self.version)
- #
- # You can easily add some pre_install, post_install, *_upgrade and *_remove methods
- #
-
def build(self):
stream_logger.info('Building...')
@@ -0,0 +1,77 @@
+# coding: utf-8
+import os
+
+from ubik.core import conf
+
+from ubik_toolbelt.logger import stream_logger
+from ubik_toolbelt.control import Control
+
+from shutil import copy2 as copy
+from shutil import rmtree
+
+class Package(Control):
+ def __init__(self):
+ Control.__init__(self)
+ self.name = 'flask'
+ self.version = '0.9'
+ self.release = '0'
+ self.requires = []
+ self.arch = ''
+ self.dist = ''
+ self.vers = ''
+ self.description = 'Environment runtime detection (Python,Linux,Distribution,etc...)'
+
+ self.cur_dir = os.getcwd()
+ self.src_dir = os.path.join(os.getcwd(), 'source')
+ self.pkg_dir = os.path.join(os.getcwd(), 'build')
+
+ self.archive_name = "Flask-%s.tar.gz" % self.version
+ self.dir_name = "Flask-%s" % self.version
+
+ self.url = "http://pypi.python.org/packages/source/F/Flask/Flask-%s.tar.gz#md5=4a89ef2b3ab0f151f781182bd0cc8933" % self.version
+ self.md5 = self.url.split('#md5=')[-1]
+
+ def build(self):
+ stream_logger.info('Building...')
+
+ def package(self):
+ stream_logger.info('Packaging...')
+ if not os.path.exists(os.path.join(self.pkg_dir, 'tmp', 'ubik')):
+ os.makedirs(os.path.join(self.pkg_dir, 'tmp', 'ubik'))
+ copy(os.path.join(self.src_dir, self.archive_name), os.path.join(self.pkg_dir, 'tmp', 'ubik'))
+
+ def pre_install(self):
+ pass
+
+ def post_install(self):
+ # Go to tmp and extract pacakge
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ os.system('tar xvf %s' % self.archive_name)
+ # Go into package and install it
+ os.chdir(self.dir_name)
+ os.system('python setup.py install --no-compile --prefix=%s' % conf.get('settings', 'packages'))
+ # Clean package dir and archive
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ rmtree(self.dir_name)
+ os.remove(self.archive_name)
+
+ def pre_upgrade(self):
+ pass
+
+ def post_upgrade(self):
+ # Go to tmp and extract pacakge
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ os.system('tar xvf %s' % self.archive_name)
+ # Go into package and install it
+ os.chdir(self.dir_name)
+ os.system('python setup.py install --upgrade --no-compile --prefix=%s' % conf.get('settings', 'packages'))
+ # Clean package dir and archive
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ rmtree(self.dir_name)
+ os.remove(self.archive_name)
+
+ def pre_remove(self):
+ pass
+
+ def post_remove(self):
+ pass
@@ -0,0 +1,86 @@
+# coding: utf-8
+import os
+
+from ubik.core import conf
+
+from ubik_toolbelt.logger import stream_logger
+from ubik_toolbelt.control import Control
+
+from ubik_toolbelt.contrib import get_md5
+
+from shutil import copy2 as copy
+from shutil import rmtree
+
+class Package(Control):
+ def __init__(self):
+ Control.__init__(self)
+ self.name = 'werkzeug'
+ self.version = '0.8.3'
+ self.release = '0'
+ self.requires = []
+ self.arch = ''
+ self.dist = ''
+ self.vers = ''
+ self.description = 'Environment runtime detection (Python,Linux,Distribution,etc...)'
+
+ self.cur_dir = os.getcwd()
+ self.src_dir = os.path.join(os.getcwd(), 'source')
+ self.pkg_dir = os.path.join(os.getcwd(), 'build')
+
+ self.archive_name = "Werkzeug-%s.tar.gz" % self.version
+ self.dir_name = "Werkzeug-%s" % self.version
+
+ self.url = "http://pypi.python.org/packages/source/W/Werkzeug/Werkzeug-%s.tar.gz#md5=12aa03e302ce49da98703938f257347a" % self.version
+ self.md5 = self.url.split('#md5=')[-1]
+
+ def build(self):
+ stream_logger.info('Building...')
+ if not os.path.exists(os.path.join(self.src_dir, self.archive_name)):
+ os.system('wget %s' % self.url)
+ else:
+ if get_md5(os.path.join(self.src_dir, self.archive_name)) != self.md5:
+ os.system('wget %s' % self.url)
+ rmtree(self.dir_name)
+ os.system('tar xvf %s' % self.archive_name)
+
+ def package(self):
+ stream_logger.info('Packaging...')
+ if not os.path.exists(os.path.join(self.pkg_dir, 'tmp', 'ubik')):
+ os.makedirs(os.path.join(self.pkg_dir, 'tmp', 'ubik'))
+ copy(os.path.join(self.src_dir, self.archive_name), os.path.join(self.pkg_dir, 'tmp', 'ubik'))
+
+ def pre_install(self):
+ pass
+
+ def post_install(self):
+ # Go to tmp and extract pacakge
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ os.system('tar xvf %s' % self.archive_name)
+ # Go into package and install it
+ os.chdir(self.dir_name)
+ os.system('python setup.py install --no-compile --prefix=%s' % conf.get('settings', 'packages'))
+ # Clean package dir and archive
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ rmtree(self.dir_name)
+ os.remove(self.archive_name)
+
+ def pre_upgrade(self):
+ pass
+
+ def post_upgrade(self):
+ # Go to tmp and extract pacakge
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ os.system('tar xvf %s' % self.archive_name)
+ # Go into package and install it
+ os.chdir(self.dir_name)
+ os.system('python setup.py install --upgrade --no-compile --prefix=%s' % conf.get('settings', 'packages'))
+ # Clean package dir and archive
+ os.chdir(os.path.join(conf.get('settings', 'packages'), 'tmp', 'ubik'))
+ rmtree(self.dir_name)
+ os.remove(self.archive_name)
+
+ def pre_remove(self):
+ pass
+
+ def post_remove(self):
+ pass
@@ -0,0 +1,3 @@
+source/*
+*.tar
+build/*
@@ -0,0 +1,74 @@
+# coding: utf-8
+import os
+import shutil
+
+from ubik_toolbelt.logger import stream_logger
+from ubik_toolbelt.control import Control
+
+from ubik_toolbelt.contrib import get_md5
+
+class Package(Control):
+ def __init__(self):
+ Control.__init__(self)
+ self.name = 'python3'
+ self.version = '3.3.0'
+ self.release = '0'
+ self.requires = []
+ self.arch = 'x86_64'
+ self.dist = 'ubuntu'
+ self.vers = '1204'
+ self.description = 'Python 3 interpreter'
+
+ self.cur_dir = os.getcwd()
+ self.src_dir = os.path.join(os.getcwd(), 'source')
+ self.pkg_dir = os.path.join(os.getcwd(), 'build')
+
+ self.archive_md5 = '198a64f7a04d1d5e95ce2782d5fd8254'
+
+ self.archive_name = 'Python-%s.tgz' % self.version
+ self.dir_name = 'Python-%s' % self.version
+
+ def build(self):
+ stream_logger.info('=> Building...')
+ os.chdir(self.src_dir)
+ if not os.path.exists(self.archive_name):
+ stream_logger.info('=> Downloading %s' % self.archive_name)
+ os.system('wget http://www.python.org/ftp/python/%s/%s' % (self.version, self.archive_name))
+ elif get_md5(self.archive_name) != self.archive_md5:
+ stream_logger.info('!! Invalid archive md5')
+ os.remove(self.archive_name)
+ stream_logger.info('=> Downloading %s' % self.archive_name)
+ os.system('wget http://www.python.org/ftp/python/%s/%s' % (self.version, self.archive_name))
+
+ if os.path.exists(self.dir_name):
+ stream_logger.info('=> Clean old builds')
+ shutil.rmtree(self.dir_name)
+ stream_logger.info('=> Extract archive')
+ os.system('tar xvf %s' % self.archive_name)
+ os.chdir(self.dir_name)
+ os.system('./configure --prefix=/usr/local/ubik')
+ os.system('make')
+
+ def package(self):
+ stream_logger.info('=> Packaging...')
+ os.chdir(self.src_dir)
+ os.chdir(self.dir_name)
+ os.system('make prefix=%s install' % self.pkg_dir)
+
+ def pre_install(self):
+ pass
+
+ def post_install(self):
+ pass
+
+ def pre_upgrade(self):
+ pass
+
+ def post_upgrade(self):
+ pass
+
+ def pre_remove(self):
+ pass
+
+ def post_remove(self):
+ pass
Binary file not shown.

0 comments on commit 131391d

Please sign in to comment.