summaryrefslogtreecommitdiffstats
path: root/modules/haskellport.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/haskellport.py')
-rw-r--r--modules/haskellport.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/modules/haskellport.py b/modules/haskellport.py
new file mode 100644
index 0000000..eff0d70
--- /dev/null
+++ b/modules/haskellport.py
@@ -0,0 +1,96 @@
+# Fedora Developer Shell
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Authors: Yaakov M. Nemoy <ynemoy@redhat.com>
+#
+
+from modules.dirfactory import DirFactory
+from modules.port import Port
+
+class HaskellPort(Port):
+ def __init__(self, package):
+ self.pkg = DirFactory(package)
+
+ def copy_in(self, tarball):
+ '''copies a tarball into the package
+
+ tarball is a path to some tarball
+ '''
+ self.package.add_sourceball(tarball)
+
+ def darcs_get(self, url, tgt):
+ '''creates a darcs variant of a cabal package using darcs source
+
+ url is a url to some darcs repo
+ tgt is the local name of the darcs repo
+ '''
+ self.package.checkout(tgt, url)
+
+ def install_tag(self, tag):
+ '''assuming a package that supports tagging, install a specific tag
+
+ tag is the name of the tag in the DVCS
+ '''
+ with pwd(self.package.dir):
+ with self.package.tag(tag):
+ self.install()
+
+ def install_source(self, target='home', *args):
+ '''perform configure, build, and install steps in one
+ '''
+ with self.pkg_src.src(*args):
+ self.configure(target, orig)
+ self.build(orig)
+ self.install(orig)
+
+ def install_sourceball(self, tarball, target='home'):
+ '''given a tarball, copy it in and install it
+ '''
+ self.copy_in(tarball)
+ self.install_source(target, '')
+
+ def install_latest(self, pkg, target='home'):
+ '''get and install the latest version of a package from hackage'''
+ self.get_latest(pkg)
+ self.install_source(target, '')
+
+ def get_from_hackage(self, pkg, ver):
+ '''get a specific package from hackage
+
+ pkg is the name of the package desired
+ ver is the version wanted
+ '''
+ sb_file = self.hackage_url(pkg, ver)
+ self.copy_in(sb_file)
+
+ def get_latest(self, pkg):
+ '''get the latest version of a package from hackage
+
+ pkg is the package desired
+ '''
+ ver = self.latest_version(pkg)
+ self.get_from_hackage(pkg, ver)
+
+ def install_from_hackage(self, pkg, ver, target='home'):
+ '''get and install a specific package from hackage
+
+ pkg is the desired package
+ ver is the version wanted
+ target is the location to install to, either 'home' or 'root'
+ '''
+ self.get_from_hackage(pkg, ver)
+ self.install_source(target, '')
+
+ pass