From bacb591ad98b47953ebc88d928095c7d6550136e Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Sun, 25 Mar 2007 09:17:05 +0000 Subject: [PATCH] * Patch by Caglar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea is to run tests that comes with some packages between build and install operations. Tests run either when explicitly given from command line as a command # pisi build --check pspec.xml or if --debug option is given to build command # pisi build -d pspec.xml If neither --check or -d is given, tests are not run. This is done for quick build operations and to not wait a boring long test step. ---------- --- actions.py (revision 12260) +++ actions.py (local) @@ -18,6 +18,9 @@ autotools.make("-j2 CC=%s AR=%s RANLIB=%s" % (get.CC(), get.AR(), get.RANLIB())) autotools.make("-f Makefile-libbz2_so") +def check(): + autotools.make("test") + def install(): autotools.rawInstall("PREFIX=%s/usr" % get.installDIR()) ----------- [caglar@zangetsu][~/svk/devel/system/base/bzip2]> sudo pisi build pspec.xml --check Paketler çalışma dizinine yazılıyor. Last state was buildpackages Testing package... --- pisi/build.py | 16 ++++++++++++++++ pisi/cli/commands.py | 2 ++ pisi/constants.py | 1 + 3 files changed, 19 insertions(+) diff --git a/pisi/build.py b/pisi/build.py index fdacd03d..dee29028 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -198,6 +198,8 @@ class Builder: self.run_setup_action() self.run_build_action() + if ctx.get_option('debug'): + self.run_check_action() self.run_install_action() # after all, we are ready to build/prepare the packages @@ -324,6 +326,10 @@ class Builder: self.run_action_function(ctx.const.build_func) self.set_state("buildaction") + def run_check_action(self): + ctx.ui.action(_("Testing package...")) + self.run_action_function(ctx.const.check_func) + def run_install_action(self): ctx.ui.action(_("Installing...")) @@ -947,6 +953,12 @@ def __buildState_buildaction(pb, last): __buildState_setupaction(pb, last) pb.run_build_action() +def __buildState_checkaction(pb, last): + + if order[last] < order["buildaction"]: + __buildState_buildaction(pb, last) + pb.run_check_action() + def __buildState_installaction(pb, last): if order[last] < order["buildaction"]: @@ -989,6 +1001,10 @@ def build_until(pspec, state): __buildState_buildaction(pb, last) return + if state == "check": + __buildState_checkaction(pb, last) + return + if state == "install": __buildState_installaction(pb, last) return diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 5aff320a..2adc33c5 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -461,6 +461,8 @@ to be downloaded from a repository containing sources. const="setup", help=_("Break build after running configure step")) group.add_option("--build", dest="until", action="store_const", const="build", help=_("Break build after running compile step")) + group.add_option("--check", dest="until", action="store_const", + const="check", help=_("Break build after running check step")) group.add_option("--install", dest="until", action="store_const", const="install", help=_("Break build after running install step")) group.add_option("--package", dest="until", action="store_const", diff --git a/pisi/constants.py b/pisi/constants.py index a8d24a66..619ce2fd 100644 --- a/pisi/constants.py +++ b/pisi/constants.py @@ -87,6 +87,7 @@ class Constants: # functions in actions_file self.__c.setup_func = "setup" self.__c.build_func = "build" + self.__c.check_func = "check" self.__c.install_func = "install" # file types