;๒ ๓๋จEc@s/dkZdklZlZdklZdklZdkl Z dk l Z dk l Z dklZdkTd klZlZdkTdkZdkTd aead „Zd ad „Zd d „Zd„Zd„Ze djoedƒngd d„Z!gd„Z"gd„Z#gd„Z$dS(N(sprint_exceptionsformat_exception(sdoadddef(sdoargs(sdobuild(sdoread(s doinstall(s dump_cache(s*(ssign_write_allssign_clear_allicCs(t||ƒtdjo dandS(s6Print an error message and set the exit status to one.iiN(s msg_errorsrecdictsmsgs exit_status(srecdictsmsg((s)/mnt/gmirror/ports/devel/aap/work/Main.pys error_msgs   cCsฃdatatiddjottidƒdjodadtfSnti o)tit i i t i i t ƒƒƒntƒt}t} yŠt|ƒt_tiidƒotiiƒnt otiidƒo_dad k} | iƒ}z|it|||ƒ}Wd |itii i!dƒƒX|Sntiid ƒot"tii i!d ƒƒ} nจt#|ƒ} t$| | i%dƒ|ofd k&l&} d k'l'}d k(l(} | |t)dƒdƒgd|dƒ}| || i%dƒn|tjot+| ƒnWn่t,j o}|anฯt.j o}|at)dƒ}nฉt/j odat)dƒ}n…t0j o} da| i2}nbt3j o1} dati4ƒat)dƒt5| ƒ}n&dati4ƒat)dƒ}nX| oet6| i%ƒt7| i%ƒt8ƒdk9l:}|| i%ƒt;| i%ƒd k<}|i=| i%ƒn|tjot| fSn|d| fSd S(sCommon function for main() and execute(). "argv" is the list of command line arguments (excluding the program name). When "find_recipe" is non-zero, search for a recipe to load. When "commands" is None, execute the specified or default target(s). When "commands" is empty, do nothing. When "commands" is a non-empty string, execute these commands. Returns an error message and a work object. exit_status is set to a non-zero value when something failed. is1iiis+A-A-P requires Python version 1.5 or later.sverbosesprofileNsinstall(sParsePos(sRecPos(sProcesss execute()sstrings sAborteds Interrupteds Syntax errorsInternal Error(s close_sushell(>s exit_statussNones exit_infossyssversionsintsGlobals aap_rootdirsset_aap_rootdirsosspathsabspathsdirnames__file__s i18n_initsmsgsworksdoargssargvscmd_argss has_optionsprintits profilingsprofilesProfilesprofsruncalls do_the_works find_recipescommandssress dump_statssoptionssgets doinstallsdoreadsdoadddefsrecdictsParsePossRecPossProcesss_sfpsdobuilds NormalExitsrs SystemExitsKeyboardInterrupts UserErrorsesargss SyntaxErrorsexc_infosstrs dump_cachessign_write_allssign_clear_allsPorts close_sushellsclose_rootshellsDoConfscleanup(sargvs find_recipescommandssfpsressRecPossDoConfsmsgsprofsParsePossprofilesesProcesssworksrs close_sushell((s)/mnt/gmirror/ports/devel/aap/work/Main.pys do_the_work(sŒ . )                  cCsี|o‘ytiitidƒ}WnAyttidƒ}Wqhtiitidƒ}qhXnXt i tii |ƒƒtii t i ƒnttiddtƒ\}}t||ƒtitƒdS(s7 The main function to execute an A-A-P recipe. iiN(ssetrootsosspathsrealpathssyssargvsprognames myrealpathsabspathsGlobalsset_aap_rootdirsdirnamesappends aap_rootdirs do_the_worksNonesmsgsworkshandle_work_donesexits exit_status(ssetrootsworksprognamesmsg((s)/mnt/gmirror/ports/devel/aap/work/Main.pysmainฃs! cCs๙|o|ot|i|ƒntt|ƒtoNttdtdtdƒtttit tdtdtdƒƒƒqˆnt o%t ƒodt ƒ}qดd}nt ƒt o|o,|ot|i|ƒq๕tt|ƒndS(s*Handle errors after calling do_the_work().iiis!All messages are in the logfile: sN(smsgsworks error_msgsrecdictsNones exit_infosprint_exceptionsstringsjoinsformat_exceptions exit_statuss msg_lognameslogmsgs msg_stoplogsmsg_info(smsgsworkslogmsg((s)/mnt/gmirror/ports/devel/aap/work/Main.pyshandle_work_doneมs$    cCs tii|ƒ}dg|idƒd}xาtdt|ƒdƒD]ท}t tii t |d|!ƒƒ}tii |ƒo|ti|ƒ}tii|ƒ\}}tiitii ||ƒƒ}t tii t |g||ƒƒ}t|ƒSqFqFW|SdS(spReturn the canonical path of the specified filename, eliminating any symbolic links encountered in the path.s/iiiN(sosspathsabspathsfilenamessplitsbitssrangeslensisapplysjoinstuples componentsislinksreadlinksresolvedsadirsafilesnormpathsnewpaths myrealpath(sfilenamesresolvedsnewpathsadirsis componentsafilesbits((s)/mnt/gmirror/ports/devel/aap/work/Main.pys myrealpath฿s"!&s__main__icCsSt|||ƒ\}}to%|GHttdtdtdƒntƒ|SdS(s๒Execute recipe commands "commands". See do_the_work() for details about "commands". "argv" is a list of command line arguments. "find_recipe" is non-zero to find a default recipe. Returns an error message or None.iiiN( s do_the_worksargvs find_recipescommandssmsgsworks exit_infosprint_exceptions msg_stoplog(scommandssargvs find_recipesworksmsg((s)/mnt/gmirror/ports/devel/aap/work/Main.pysexecute๚s cCs+dkl}td||ƒ|dƒSdS(sทFetch files in list "fnames". "argv" is a list of command line arguments. Will search for a default recipe if none is specified. Returns an error message or None.(slist2strs :fetch %siN(sDictlistslist2strsexecutesfnamessargv(sfnamessargvslist2str((s)/mnt/gmirror/ports/devel/aap/work/Main.pysfetchs cCsUt|ddƒ\}}t||ƒ| oghfSn|iiƒ|ifSdS(sนObtain the information from the recipe specified with "argv" or the default recipe. Return a tuple with the list of nodes and a dictionary for the global variables.isN(s do_the_worksargvsmsgsworkshandle_work_donesnodessvaluessrecdict(sargvsmsgswork((s)/mnt/gmirror/ports/devel/aap/work/Main.pys get_nodelists  cCsLt|ddƒ\}}t||ƒ| ohSndk}|iƒSdS(sธObtain a dictionary that lists the actions supported for each file type. Can be used to make sure that executing the action will actually work. "argv" is usually empty.isN(s do_the_worksargvsmsgsworkshandle_work_donesActionsaction_get_list(sargvsworksActionsmsg((s)/mnt/gmirror/ports/devel/aap/work/Main.pysget_actionlist*s  (%ssyss tracebacksprint_exceptionsformat_exceptionsDoAddDefsdoadddefsDoArgssdoargssDoBuildsdobuildsDoReadsdoreads DoInstalls doinstallsCaches dump_cachesErrorsSignssign_write_allssign_clear_allsUtilsGlobalsMessages exit_statussNones exit_infos error_msgs profilings do_the_worksmainshandle_work_dones myrealpaths__name__sexecutesfetchs get_nodelistsget_actionlist(sprint_exceptions doinstalls get_nodelistsdoargss dump_caches myrealpathsdobuildsmainsdoadddefs do_the_workssysssign_write_alls error_msgsexecutessign_clear_allsformat_exceptionsGlobalshandle_work_donesdoreadsfetchsget_actionlist((s)/mnt/gmirror/ports/devel/aap/work/Main.pys? s4          {