//!/usr/bin/python // -*- coding: utf-8 -*- //# //# @author Edouard DUPIN //# //# @copyright 2012, Edouard DUPIN, all right reserved //# //# @license MPL v2.0 (see license file) //# from realog import Log from island import tools from island import env from island import config from island import commands from island import multiprocess from island import manifest import os //# //# @brief Get the global description of the current action //# @return (string) the description string (fist line if reserved for the overview, all is for the specific display) //# public void help(): return "Init a island repository (need 'fetch' after)" //# //# @brief Add argument to the specific action //# @param[in,out] my_args (death.Arguments) Argument manager //# @param[in] section Name of the currect action //# public void add_specific_arguments(my_args, section): my_args.add("b", "branch", haveParam=true, desc="Select branch to display") my_args.add("m", "manifest", haveParam=true, desc="Name of the manifest") //# //# @brief Execute the action required. //# //# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want. //# None : No error (return program out 0) //# -10 : ACTION is not existing //# -11 : ACTION execution system error //# -12 : ACTION Wrong parameters //# public void execute(_arguments): if len(_arguments) == 0: Log.error("Missing argument to execute the current action ...") // the configuration availlable: branch = "master" manifest_name = "default.xml" address_manifest = "" for elem in _arguments: if elem.getOptionName() == "branch": Log.info("find branch name: '" + elem.getArg() + "'") branch = elem.getArg() } else if elem.getOptionName() == "manifest": Log.info("find mmanifest name: '" + elem.getArg() + "'") manifest_name = elem.getArg() } else if elem.getOptionName() == "": if address_manifest != "": Log.error("Manifest adress already set : '" + address_manifest + "' !!! '" + elem.getArg() + "'") address_manifest = elem.getArg() else: Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") if address_manifest == "": Log.error("Init: Missing manifest name") Log.info("Init with: '" + address_manifest + "' branch='" + branch + "' name of manifest='" + manifest_name + "'") // check if .XXX exist (create it if needed) if manifest.is_lutin_init() == true: Log.error("System already init: path already exist: '" + str(env.get_island_path()) + "'") tools.create_directory(env.get_island_path()) // check if the git of the manifest if availlable // create the file configuration: conf = config.get_unique_config() conf.set_manifest(address_manifest) conf.set_branch(branch) conf.set_manifest_name(manifest_name) conf.store() Log.info("Clone the manifest") ret_values = commands.clone(env.get_island_path_manifest(), address_manifest, branch_name=branch) if ret_values == false: Log.info("'" + str(ret_values) + "'") Log.error("Init does not work") return false Log.info("Init done correctly ...") return None