diff --git a/pisi/build.py b/pisi/build.py index b2d59bec..b3822a5c 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -53,11 +53,6 @@ class PisiBuild: #finished its work in the work_dir curDir = os.getcwd() - # FIXME: It's wrong to assume that unpacked archive - # will create a name-version top-level directory. - # Archive module should give the exact location. - # (from the assumption is evil dept.) - os.chdir(self.ctx.pkg_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version) locals = globals = {} try: @@ -65,7 +60,9 @@ class PisiBuild: except SyntaxError, e: ui.error ("Error : %s\n" % e) return - + + self.goToWorkDir(globals) + self.configureSource(locals) self.buildSource(locals) self.installSource(locals) @@ -81,6 +78,19 @@ class PisiBuild: def applyPatches(self): pass + def goToWorkDir(self, globals): + path = globals['WorkDir'] + if globals['WorkDir'] is not None: + path = self.ctx.pkg_work_dir() + "/" + path + else: + path = self.ctx.pkg_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version + + try: + os.chdir(path) + except OSError, e: + ui.error ("No such file or directory: %s\n" % e) + sys.exit() + def configureSource(self, locals): func = self.ctx.const.setup_func if func in locals: diff --git a/samples/popt/actions.py b/samples/popt/actions.py index 9375eca7..952c4886 100644 --- a/samples/popt/actions.py +++ b/samples/popt/actions.py @@ -4,6 +4,8 @@ from pisi.actionsapi import gnuconfig from pisi.actionsapi import autotools +WorkDir='popt-1.7' + def setup(): gnuconfig.gnuconfig_update() # libtoolize.libtoolize()