From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D5AC31381F3 for ; Sat, 22 Jun 2013 15:24:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E3735E0AD5; Sat, 22 Jun 2013 15:24:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 32DBDE0AB2 for ; Sat, 22 Jun 2013 15:24:20 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 234AB33E6A6 for ; Sat, 22 Jun 2013 15:24:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A907BE5461 for ; Sat, 22 Jun 2013 15:24:17 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1371771518.7a98234f8f14a864be8a1ba2ebb8e45d202a9c00.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/main.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 7a98234f8f14a864be8a1ba2ebb8e45d202a9c00 X-VCS-Branch: master Date: Sat, 22 Jun 2013 15:24:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2dc9a4e7-2ad0-4a2f-bbef-2f500fb308c6 X-Archives-Hash: a6b6b9ba46c7c612dc2803e1fc81fc38 commit: 7a98234f8f14a864be8a1ba2ebb8e45d202a9c00 Author: André Erdmann mailerd de> AuthorDate: Thu Jun 20 23:38:38 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Jun 20 23:38:38 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7a98234f roverlay/main: run hook after overlay creation --- roverlay/main.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/roverlay/main.py b/roverlay/main.py index a0ca8e4..207bea6 100644 --- a/roverlay/main.py +++ b/roverlay/main.py @@ -81,6 +81,34 @@ def main ( return call ( *args, **kw ) # --- end of optionally (...) --- + def run_hook ( hook_key, phase ): + print ( "RUN_HOOK?", hook_key, phase ) + script = roverlay.config.get ( hook_key, None ) + if script: + print ( "YES.", str ( script ) ) + return roverlay.tools.shenv.run_script ( + script, phase.lower(), return_success=True + ) + else: + print ( "NO." ) + # nop + return True + # --- end of run_hook (...) --- + + def run_hook_lazy ( phase ): + crelpath, sepa, ckey = phase.rpartition ( '_' ) + if sepa: + # HOOK.~phase + cpath = ( + 'HOOK.' + crelpath.replace ( '_', '.' ).upper() + + '.' + ckey.lower() + ) + + return run_hook ( cpath, phase ) + else: + raise Exception ( "cannot parse phase {!r}".format ( phase ) ) + # --- end of run_hook_lazy (...) --- + def run_sync(): if "sync" in actions_done: return try: @@ -284,6 +312,14 @@ def main ( if OPTION ( 'print_stats' ): print ( "\n" + overlay_creator.stats_str() ) + + # FIXME/TODO: + # this hook should be called _after_ verifying the overlay + # (verification is not implemented yet) + # + if not run_hook_lazy ( 'overlay_success' ): + die ( "overlay_success hook returned non-zero", DIE.OV_CREATE ) + set_action_done ( "create" ) except KeyboardInterrupt: @@ -466,6 +502,9 @@ def main ( try: from roverlay.remote import RepoList from roverlay.overlay.creator import OverlayCreator + + import roverlay.config + import roverlay.tools.shenv except ImportError: if HIDE_EXCEPTIONS: die ( "Cannot import roverlay modules!", DIE.IMPORT ) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6E3A61381F3 for ; Thu, 20 Jun 2013 23:40:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6D211E09BA; Thu, 20 Jun 2013 23:40:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BA463E09BA for ; Thu, 20 Jun 2013 23:40:45 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BF69B33E61B for ; Thu, 20 Jun 2013 23:40:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 5A6CBE5468 for ; Thu, 20 Jun 2013 23:40:42 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1371771518.7a98234f8f14a864be8a1ba2ebb8e45d202a9c00.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/main.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 7a98234f8f14a864be8a1ba2ebb8e45d202a9c00 X-VCS-Branch: gsoc13/next Date: Thu, 20 Jun 2013 23:40:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 488d50cc-8d7e-4235-993c-5199996403ef X-Archives-Hash: ffbe7e0905737504a9e7c9956e15ebe7 Message-ID: <20130620234042.l0qUxBKEh8Y7FylLfbf6I8qXjY_MxQriAOy2lJMcHHY@z> commit: 7a98234f8f14a864be8a1ba2ebb8e45d202a9c00 Author: André Erdmann mailerd de> AuthorDate: Thu Jun 20 23:38:38 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Jun 20 23:38:38 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7a98234f roverlay/main: run hook after overlay creation --- roverlay/main.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/roverlay/main.py b/roverlay/main.py index a0ca8e4..207bea6 100644 --- a/roverlay/main.py +++ b/roverlay/main.py @@ -81,6 +81,34 @@ def main ( return call ( *args, **kw ) # --- end of optionally (...) --- + def run_hook ( hook_key, phase ): + print ( "RUN_HOOK?", hook_key, phase ) + script = roverlay.config.get ( hook_key, None ) + if script: + print ( "YES.", str ( script ) ) + return roverlay.tools.shenv.run_script ( + script, phase.lower(), return_success=True + ) + else: + print ( "NO." ) + # nop + return True + # --- end of run_hook (...) --- + + def run_hook_lazy ( phase ): + crelpath, sepa, ckey = phase.rpartition ( '_' ) + if sepa: + # HOOK.~phase + cpath = ( + 'HOOK.' + crelpath.replace ( '_', '.' ).upper() + + '.' + ckey.lower() + ) + + return run_hook ( cpath, phase ) + else: + raise Exception ( "cannot parse phase {!r}".format ( phase ) ) + # --- end of run_hook_lazy (...) --- + def run_sync(): if "sync" in actions_done: return try: @@ -284,6 +312,14 @@ def main ( if OPTION ( 'print_stats' ): print ( "\n" + overlay_creator.stats_str() ) + + # FIXME/TODO: + # this hook should be called _after_ verifying the overlay + # (verification is not implemented yet) + # + if not run_hook_lazy ( 'overlay_success' ): + die ( "overlay_success hook returned non-zero", DIE.OV_CREATE ) + set_action_done ( "create" ) except KeyboardInterrupt: @@ -466,6 +502,9 @@ def main ( try: from roverlay.remote import RepoList from roverlay.overlay.creator import OverlayCreator + + import roverlay.config + import roverlay.tools.shenv except ImportError: if HIDE_EXCEPTIONS: die ( "Cannot import roverlay modules!", DIE.IMPORT )