summaryrefslogtreecommitdiffstats
path: root/nbb
diff options
context:
space:
mode:
Diffstat (limited to 'nbb')
-rw-r--r--nbb/nbblib/bs.py7
-rw-r--r--nbb/nbblib/commands.py37
-rw-r--r--nbb/nbblib/progutils.py1
3 files changed, 45 insertions, 0 deletions
diff --git a/nbb/nbblib/bs.py b/nbb/nbblib/bs.py
index a254c95..341b563 100644
--- a/nbb/nbblib/bs.py
+++ b/nbb/nbblib/bs.py
@@ -5,6 +5,7 @@
import os
from nbblib.plugins import *
+from nbblib.progutils import *
class NotABSSourceTree(Exception):
@@ -95,6 +96,8 @@ class AutomakeSourceTree(BSSourceTree):
"""'configure --prefix'"""
builddir = self.config.builddir
if not os.path.exists(builddir): os.makedirs(builddir)
+ if not os.path.exists(os.path.join(builddir, 'configure')):
+ self.init
os.chdir(builddir)
prog_run(["%s/configure" % self.config.srcdir,
"--prefix=%s" % self.config.installdir
@@ -102,11 +105,15 @@ class AutomakeSourceTree(BSSourceTree):
def build(self):
"""'make'"""
+ if not os.path.exists(os.path.join(self.config.builddir, 'config.status')):
+ self.configure()
os.chdir(self.config.builddir)
prog_run(["make", ], self.context)
def install(self):
"""'make install'"""
+ if not os.path.exists(os.path.join(self.config.builddir, 'config.status')):
+ self.configure()
os.chdir(self.config.builddir)
prog_run(["make", "install", "INSTALL=/usr/bin/install -p"], self.context)
diff --git a/nbb/nbblib/commands.py b/nbb/nbblib/commands.py
index 9fcb038..fd55289 100644
--- a/nbb/nbblib/commands.py
+++ b/nbb/nbblib/commands.py
@@ -1,4 +1,5 @@
import os
+import sys
from nbblib.package import *
from nbblib.plugins import *
@@ -172,6 +173,42 @@ class BuildTestCommand(SourceClassCommand):
self.bs_sourcetree.install()
+class InitCommand(SourceClassCommand):
+ name = 'init'
+ summary = 'initialize buildsystem'
+ def run(self):
+ self.bs_sourcetree.init()
+
+class ConfigureCommand(SourceClassCommand):
+ name = 'configure'
+ summary = 'configure buildsystem'
+ def run(self):
+ self.bs_sourcetree.configure()
+
+class BuildCommand(SourceClassCommand):
+ name = 'build'
+ summary = 'build from source'
+ def run(self):
+ self.bs_sourcetree.build()
+
+class InstallCommand(SourceClassCommand):
+ name = 'install'
+ summary = 'install the built things'
+ def run(self):
+ self.bs_sourcetree.install()
+
+
+class MakeCommand(SourceClassCommand):
+ name = 'make'
+ summary = 'run make in builddir'
+ def validate_args(self, *args, **kwargs):
+ pass
+ def run(self):
+ os.chdir(self.bs_sourcetree.config.builddir)
+ prog_run(["make"] + list(self.args),
+ self.context)
+
+
class ConfigCommand(SourceClassCommand):
name = 'config'
summary = 'set/get config values'
diff --git a/nbb/nbblib/progutils.py b/nbb/nbblib/progutils.py
index 5807d76..456405e 100644
--- a/nbb/nbblib/progutils.py
+++ b/nbb/nbblib/progutils.py
@@ -3,6 +3,7 @@
########################################################################
+import os
import subprocess