diff options
-rw-r--r-- | g_common/g_common.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/g_common/g_common.py b/g_common/g_common.py index d499721..851a656 100644 --- a/g_common/g_common.py +++ b/g_common/g_common.py @@ -99,6 +99,7 @@ def generate_tree(repo_location): os.symlink(ebuild_file,os.path.join(ebuild_dir,package_file)) manifest_file=open(os.path.join(ebuild_dir,'Manifest'),"w") manifest_file.write(Manifest % package_file) + return 0 #list package details, in PMS's format def action_package(repo_location,package_name): @@ -107,8 +108,17 @@ def action_package(repo_location,package_name): return os.system(driver_conf['exec']+" "+repo_location+" package "+package_name) +def exec_phase(repo_location,phase): + repo_conf=read_repo_config(repo_location) + driver_conf=read_driver_config(repo_conf['driver']) + + env=os.environ + + return os.system(driver_conf['exec']+" "+repo_location+" "+phase) + def usage(): print __doc__ + return 0 def main(): arguments=sys.argv[1:] @@ -130,13 +140,13 @@ def main(): driver=arguments[2] if len(arguments)>3: remote_repo=arguments[3] - action_sync(repo_location,driver,remote_repo) + return action_sync(repo_location,driver,remote_repo) elif action=='list-categories': - list_categories(repo_location) + return list_categories(repo_location) elif action=='list-packages': - list_packages(repo_location) + return list_packages(repo_location) elif action=='generate-tree': - generate_tree(repo_location) + return generate_tree(repo_location) elif action=='package': if len(arguments)<3 or 'help' in arguments: print "The 'package' action takes the following parameters:" @@ -144,19 +154,18 @@ def main(): print " * [version]" sys.exit(1) package_name=arguments[2] - action_package(repo_location,package_name) + return action_package(repo_location,package_name) elif action=='usage' or action=='help': - usage() + return usage() elif action in pms_phases: #todo raise NotImplementedError elif action in actions_wanted: raise NotImplementedError else: - usage() - sys.exit(0) + return usage() if __name__ == "__main__": - main() + sys.exit(main()) |