;ò ÝO¸Fc@sºdkZdkZdkZdkZdklZdkTdklZlZl Z dk l Z l Z dk l Z dk lZl Z dkTdklZlZdklZlZd klZd klZd klZlZlZlZd klZlZl Z d kl!Z!dk"l#Z#l$Z$l%Z%l&Z&l'Z'l(Z(l)Z)dk*Tdk+l,Z,l-Z-dk.l/Z/l0Z0dk1l2Z2l3Z3dk1l4Z4l5Z5d„Z6e7dd„Z8dd„Z9dfd„ƒYZ:ga;d„Z<d„Z=dZ>dZ?dZ@dZAd„ZBde7d„ZCe7d „ZDd!„ZEd"„ZFdZGdZHd#ZIdde7d$„ZJd%fd&„ƒYZKd'„ZLd(„ZMe7d)„ZNd*„ZOd+„ZPd,„ZQd-„ZRe7d.„ZSdS(/N(sNode(s*(s dictlist2strsvarname2dictlists listitem2str(sProcesss recipe_error(sParsePos(srpcopysRecPos(sDepends depend_auto(surl_timesis_url(sfetch_nodelist(s local_name(s get_old_signs get_new_signs sign_clearssign_clear_target(s sign_updatedsbuildcheckstr2signsbuildcheck_updated(s check_name(sexpands do_fetch_allsdo_verscont_alls do_remove_addsdo_publish_alls do_revise_allsaap_do(s setrpstacksgetwork(s local_argserror_continue(sget_build_recdicts rule_in_tree(sprepend_user_scopesundo_user_scopecCszd}xi|D]a}|o|d}nxC||D]7}tid|ƒdjo|d}n||}q3Wq W|SdS(s™Turn a dictlist into a string that can be used as an argument for a shell command. TODO: let this depend on the type of shell used. ss s'" is\N(sresslistsiskeyscsstringsfind(slistskeyscsisres((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysdictlist2shellstr#s ic Cswt|ƒ} t}|i o tiƒ}t ||i ƒnt ||i d|i d|id|i| ƒƒ}||d<|iƒ|dalways" and ">nobuild" sections of a command block. skeep_current_scopesrpstacksxscopes _really_builds buildtargetistargetcCs|dS(Nsname(sx(sx((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysTss target_lists target_dlsdepends depend_lists depend_dlcCs|diidƒ S(Ns_nodesvirtual(sxs attributessget(sx((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys_sssourceisnamesfnamess source_lists source_dlsfiletypesactionsaaps targettypesmatch(sget_vars_from_attriÿÿÿÿsstringN(.sgetworksrecdictsworksNonescwdsdepsstartupsossgetcwdsgoto_dirsbuilddirsget_build_recdicts buildrecdictskeep_current_scopesrpstacksget_scope_namess new_recdicts really_buildstargetsget_namesshorten_dictlists targetlistsdlsadd_node_attributessExpands quote_aapsxps dictlist2strsmaps sourcelistsfiltersslslens listitem2strsfiletypesmatchstrsActionsget_vars_from_attrsssParsePossrpcopysline_nrscommandssfpsProcesss use_recdict(sdepsrecdictstargetsfiletypes really_buildsdlsxps new_recdictscwdsfpsget_vars_from_attrsworkssssl((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys exec_commands3sZ                     cCs|}d}xønoðtii|ƒ}||joPntii|ƒ}t |ƒdjo>tii |ƒd djo!t |ƒdjp|ddjo6| o|Sn|otii ||ƒSn|Sn|}|otii ||ƒ}q|}qWt SdS(s÷ Locate the build subdirectory (builddir) "build" or "build-*" in "name". When "remove" is True return the name with the builddir part removed. When "remove" is False return the builddir name. Return None if no builddir found. siisbuilds-N(snamesheadstailsosspathsdirnamesnewheadsbasenamesnslensnormcasesremovesjoinsNone(snamesremovesheadsnewheadstailsn((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys locate_bdir‹s( T sUpdatecBs2tZdZd„Zd„Zd„Zd„ZRS(sgObjects used to remember which source of a dependencey is outdated and the newest time for "newer".cCsItiiidƒ|_d|_d|_d|_d|_ d|_ dS(Nsforceis( sGlobalscmd_argssoptionssgetsselfsforcedstimes time_sourcessources buildchecksnewsig(sself((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys__init__´s     cCsF|ip8|ip.|ip$|iidƒo|iidƒ SdS(s~Return TRUE if we already know that updating is required. This doesn't handle a source being newer than the target.svirtualsrememberN(sselfsforcedstimessourcestargets attributessget(sselfstarget((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysoutdated½scCs¯t|ƒ}||_|i|ƒ o…t|dd|ƒ}| o d|_ n|i|joGt i i i dƒo$t|tdƒ|iƒ|ƒq§d|_q«ndS(szSet the buildcheck signature from string "str" for target "target". Check if it's different from the last time.ss buildcheckiscontentssABuildcheck for "%s" changed, ignored because of --contents optionN(sbuildcheckstr2signsstrs buildchecksselfsoutdatedstargets get_old_signsrecdictsoldsnewsigsGlobalscmd_argssoptionssgets msg_depends_s short_nameslevelssource(sselfsrecdictsstrstargetslevels buildchecksold((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysset_buildcheckÆs   $cCsw|iogtiiidƒotdƒ}qo|iotdƒt |iƒ}qotdƒ|i ƒ}nÿ|i idƒo,|i idƒ o|i p |idjotdƒ}n­|ioD|i otd ƒt |iƒ}qotd ƒt |iƒ}n_||ijotd ƒ|i}n8|d jo|i idƒ otd ƒ}nd}|SdS(s]Check if "target" needs to be updated. "dst_time" is the timestamp of the target.sforces#-F or --force command line arguments"%s" has force attributestarget "%s" has force attributesvirtualsremembers buildchecksvirtual targetsno old signature for "%s"s"%s" has changeds "%s" is newerisit doesn't existsN(sselfsforcedsGlobalscmd_argssoptionssgets_sreasonssources shorten_namestargets short_names attributessnewsigsdst_timestimes time_source(sselfsdst_timestargetsreason((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys upd_reasonÛs&  B  !(s__name__s __module__s__doc__s__init__soutdatedsset_buildchecks upd_reason(((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysUpdate±s  c Cs |iodSn|iidƒ o4t|iƒddƒ} | o| |id||jo| |djo| |djo|d }q#W|| ||!}|}|ddj} qkW|i1||||ƒdS(s¡ Check if the "checkstring" value changed since the last build and change "update" accordingly. "dep.commands" are the commands for the build rule. isNsvirtualsrememberiÿÿÿÿ(saction_expand_dos is#ssourcestargetsfnamesmatch(sget_vars_from_attrsnamescommandss skip_errorss xcommandss s (3s skip_whites checkstringsislensupdates buildcheckstargets attributessgetsgetworksrecdictsworksdepsrpstacksline_nrs setrpstacksprepend_user_scopesget_scope_namess saved_scopesActionsaction_expand_doscommandss targetlists sourcelistsclsssstringsfindsessavessavedsksget_vars_from_attrs save_attrs find_nodesnodesExpands quote_aapsxpsexpands check_strshas_keyskeyssNonesundo_user_scopesbstrsleadings check_str_lenscsset_buildcheckslevel(srecdicts checkstringsdepstargetsupdateslevelsclsaction_expand_dosline_nrsxpssavedsleadings check_strssaves save_attrsnodescsget_vars_from_attrs check_str_lens saved_scopesbstrscommandssesksworksiss((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysbuildcheck_update(sœ '               j  /c Cs|iƒ}|iƒ}t}t}d}t}d} d}d} x|iD]}|idjo'|id|idj oqLq»n3|idjo"t|i|iƒ oqLq»n|i||ƒ\}}} |o|i||ƒ} t| ƒdjo| dd|joqLnd}xã| D]Û}tii|dƒ}| o=t!tii"|dƒƒ}|otii|ƒ}qŒn| o |i$dƒoO|i%|dd|ƒ}t'|i(ƒ||gdƒtii|dƒ}n| o d}Pq+q+W|i*o |oE|o | |jo d}n| |jo|}| }d}q°qX|i+ oE|o | | jo d} n| | jo|}| } d} q°qXq\|ot,|t-dƒt.|i/t0dt0i1ƒƒt.|i2t0dt0i1ƒƒ|f|ƒ||_4t5| |||i||dd |ƒ}t|_4|i9|ƒq\qLqLW|ot:t-d ƒ|‚n| o| ot;|t-d ƒ|ƒtSn| o|o |}n|o<t,|t-d ƒt.|i/t0dt0i1ƒƒt.|i2t0dt0i1ƒƒ|f|ƒ|i||ƒ} t<|i=||ƒ|i>| ||i(|i*d |iƒ}|i||ƒ\|_}} x3|i/D](} | d|jo|i@| ƒq’q’W||_4t5| |||i||dd |ƒ}t|_4|i9|ƒn|SdS(sÛFind rules that match "target" and do the work for each of them. "src_list_list" is extended for items that need their sign updated. Returns a dependency made out of a rule with build commands or None islocals_recipesnormalisnamesfetchs$Using rule "%s : %s" for target "%s"slevels*More than one matching build rule for "%s"s4More than one matching build rule for "%s", skippings*Using build rule "%s : %s" for target "%s"s.N(Astargetsget_names target_names short_names target_snamesNonesdeps buildrules buildrule_lens buildrule_psbuildrule_p_lensdoublesdouble_psworksrulessrsscopes scope_recdicts buildrecdicts rule_in_trees match_targetsmatchstrsadirsmatchlenstarget2sourcelistssrc_listslens full_matchsssosspathsexistsses locate_bdirsabspathsnsgetsget_nodesnodesfetch_nodelistsrpstacksrecdictscommandss sourceexistss msg_depends_s dictlist2strs targetlistsExpands quote_aaps sourcelistslevels current_rulesdictlist_updatesupdatesslists src_list_listsappends UserErrorsmsg_notesDependstarget2targetlists build_attrsdsset_attributes(sworksrecdictstargetsupdates src_list_listslevelsslists target_namesadirsdouble_psdssrc_listsbuildrule_p_lensmatchlensnodes target_snames full_matchs buildrule_ps buildrule_lens buildrulesmatchstrsesdepsdoublesnsssr((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys target_rule¡sÄ     (                 iÿÿÿÿc Cs¾ t}|iƒ}|iƒ}|idjo|i ƒ|Sn|i t i jo| o3|djot|tdƒ||ƒn|Sn|i t ijo"t|tdƒ||ƒtSn|ot|tdƒ||ƒnt|tdƒ||ƒ|i t ijo|io|ii}d}n'|io|ii}d}nd }|o,|td ƒ|d i|d if}n|iid ƒo]|id|_|it|iid ƒƒjo'ttd ƒ|id||f‚qq$ttdƒ||f‚n d|_xV|iƒD]H}|i!o8ttdƒ||id i|id if‚t"Sq1q1W|o|d} nt$} t i|_ |iidƒ} t&ƒ}|p|iidƒo d|_(ng}xu|iƒD]g}tdƒt*|i+t,dt,i-ƒƒt*|i.t,dt,i-ƒƒf} t0|i+ƒdjo| tdƒ|} nt|| | ƒt1||i2d|i3d|id|i4|ƒƒ|_5t$}|i7 o t8i9ƒ}t:||i;ƒnd|_!||_t<|i.||i5|i2||dd| ƒ}t$|_d|_!|i>|ƒ|ot:||ƒqùqùW|i?ƒ}|i@ƒ} | o| oCtB|||||| ƒ}|o:t1||i2d|i3d|id|i4|ƒƒ|_5qÏt8iCiD|ƒ o|iiEdƒo tF|iƒ||gdƒn|iidƒo0t|tdƒ||ƒ| o t"}qËqÏ|pt8iCiD|ƒ o$t|tdƒ||ƒt"}qÏt|tdƒ||ƒn|o|iHƒ} | o |g} nx'| D]Q}ytK||||||ƒWqþtj otLƒ o‚nt}qþXqþWnË| o1t8iCiD|ƒoMt8iCi@|ƒ otM|tdƒ|ƒq‹t|tdƒ||ƒq! tNƒotO|tdƒ|ƒq! yod kP}tQ| |iRƒo| dd!jot8iS|tT| ƒƒnt8iS|ƒtO|td"ƒ|ƒWq! tUj o*}tWgtd#ƒ|tX|ƒƒq! Xn“|idjo'tYg|hƒo t}q! t}n\|id$jo(tZg|hƒ o t}q! t}n$|id%jo*t[g|d%hƒo t}q! t}nê|id&jo*t[g|d&hƒo t}q! t}n°|id'jo*t[g|d'hƒo t}q! t}nv|id(jo*t[g|d(hƒo t}q! t}n<|id)jo0t\g|ht]ƒd)ƒo t}q! t}nü|id*jo0t\g|ht]ƒd*ƒo t}q! t}n¼|id+jo*t[g|d+hƒo t}q! t}n‚|id,jo-t^g|ht]ƒƒo t}q! t}nE|id-jot_d|d.ƒt}n|id/jo t}n|tjot i |_ n*|tjot i|_ n t i`|_ |id|_| t$jo%|iiEdƒo|id=q¶ n| |id<|Sd S(0s Update a target by finding the build rule for it and executing the build commands if it's outdated. "target" is a Node object. If "toplevel" is non-zero it is an error not to have build commands. Return a non-zero number for success. scommentis Target was already updated: "%s"s,skip updating target "%s": previously failedsupdating target "%s" forcefullysupdating target "%s"s from rules from dependencyss in recipe "%s" line %diÿÿÿÿs recursives.Cyclic dependency exceeds %d levels for "%s"%ssCyclic dependency for "%s"%ss1Cyclic dependency for "%s" in recipe "%s" line %dsvirtualsforcesUsing dependency "%s : %s"s for target "%s"skeep_current_scopesrpstacksxscopeislevelsfetchs*Virtual target has no build commands: "%s"sDo not know how to build "%s"s-Target has no build commands and exists: "%s"sTarget is not a directory: "%s"sDirectory exists: "%s"sskip creating directory "%s"Ns0sCreated directory: "%s"sCould not create directory "%s"spublishscommitscheckoutscheckinsunlocksaddsremovestagsrevises referencesreference $SOURCE $?INCLUDEsrefresh(as updated_OKsretvalstargetsget_names target_names short_names target_snamesnamesworksprint_commentssstatussNodesupdatedsforceslevels msg_dependsrecdicts_s builderrors updated_ERRORsbusys current_rulesrpstackswheres current_depsline_nrs attributessgetsrecursive_levelsints UserErrorsget_dependenciessdepsin_uses updated_FAILsnlevelsNones save_virtualsUpdatesupdatesforceds src_list_lists dictlist2strs targetlistsExpands quote_aaps sourcelistsmsgslensget_build_recdicts buildrecdictskeep_current_scopesget_scope_namess use_recdictscwdsstartupsossgetcwdsgoto_dirsbuilddirsdictlist_updatesslistsappendsget_first_build_dependencysisdirsdirmodes target_rulespathsexistsshas_keysfetch_nodeliststoplevelsget_build_dependenciessdeplistsdsmay_exec_dependserror_continues msg_warnings skip_commandssmsg_infostypess isinstances StringTypesmakedirssoct2intsEnvironmentErrorses recipe_errorsstrs do_fetch_allsdo_publish_allsdo_verscont_alls do_remove_adds local_args do_revise_allsaap_dosnew(sworksrecdictstargetstoplevelsforceslevelsslists target_names src_list_listsdeplistsnlevels save_virtualsdirmodesmsgstypesscwds target_snamesrpstacksupdatesdsesdepsretvalswhere((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys target_updateCsx            ,"+   0                    '             $ *                           sDepNodecBstZdZd„ZRS(s[Object to keep the node of a dependency with the attributes local to the dependency.cCs||_||_dS(N(snodesselfsdicts attributes(sselfsnodesdict((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pys__init__…s (s__name__s __module__s__doc__s__init__(((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysDepNode‚s cCs«g}xš|D]’}|idƒo|d}n|i|ddƒ}|it||ƒƒ|i i dƒo |i dƒot gt dƒ|dƒq q W|SdS(s>Turn the items in "dictlist" into DepNodes, return the result.s_nodesnameisvirtualsremembers2Cannot use "remember" attribute on virtual node %sN( snlsdictlistsitemshas_keysnsworksget_nodesappendsDepNodes attributessgets recipe_errors_(sworksdictlistsnlsnsitem((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysdictlist2depnodelistŠs#cCs¿t|ƒ}d}x¢||jo”t||ƒ}||joPn||}|djodSn|djo |djoPnti|d|ƒ}|djoPn|d}qWdSdS(s¥ Return non-zero when sections exist in command block "s". A section starts with ">always", ">build" or ">nobuild". Ignore white space and comments. is>is s#N(slensssslensis skip_whitescsstringsfind(ssscsslensi((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pyscommands_with_sections›s$      cCs|iƒ}|iƒ} t||ƒ}|djo|ii dƒot |t dƒ| ƒn|i idƒo|i d}nd}t|i|||||ƒ|i||ƒ}|o d}nd}|itijo|Sn|o d} n*t|t dƒ| |ƒt|iƒ} | ok|otii i dƒoti! o3|i"ti#j ot$|t d ƒ| ƒq×nP|o |} n t d ƒ} t|t d ƒ| t&t'|i(ƒƒ| f|ƒt)ƒ o(t*|ƒot+|i,||ƒq nt-|||d |d |ƒ|ot)ƒ o\|djo|ii dƒ o7t||ƒ}|djot0t dƒ|‚qq”q˜n|p|i1ocx`|i2D]Q}|idƒ oq³n|d} | i"ti#joq³nt5| iƒƒtii i dƒ ptii i dƒpti!o¥t6|| ƒxS|D]K}xB|D]:} | i4ii dƒ ot:|| i4| i| ƒq]q]WqPW| |joti;| _n|iot<|| |iƒqánt=| _>xt?D]}t=|_>qñWq³Wn|SdS(sãExecute the build commands of dependency "dep" if the target "target" is outdated. When updating succeeds, remember the signs for the items in "src_list_list". Return non-zero when building was done.isvirtuals&target is virtual but does exist: "%s"s buildchecks $xcommandsisTarget "%s" is up-to-datestouchs Touching "%s"scommand block with sectionssUpdating "%s" from "%s": %ssfiletypes really_buildsBuilding failed for "%s"s_nodesnobuildN(Astargetsget_names target_names short_names target_snamesurl_timesrecdictsdst_times attributessgets msg_warnings_sdeps build_attrshas_keys buildchecksbuildcheck_updates use_recdictsupdateslevels upd_reasonsreasonsretvalsstatussNodes builderrorsbuilds msg_dependscommands_with_sectionsscommandssGlobalscmd_argssoptionss force_buildsnamesvirtual_targetssmsg_infosmsgs dictlist2strsshorten_dictlists sourcelists skip_commandss locate_bdirs aap_checkdirsrpstacks exec_commandssfiletypests UserErrorsnewsigs targetliststrgsnodes sign_clearssign_clear_targets src_list_listslsdns sign_updatedsupdatedsbuildcheck_updatedsNonesautodep_dictlistsclear_autodep_listsn(srecdictsdepsupdatestargets src_list_listslevelsfiletypes target_names buildchecksdnsbuildsmsgsnodes target_snamesdst_timesreasonslstrgsnstsretval((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysmay_exec_depend³s„     (  +   ! #  7 %   c Cs¶|iotii|iƒƒodkl}||||iƒƒ}|oV|i |ƒ|o(x%|D]}t||||ƒqjWn|it||ƒƒn||_ndS(sÀ Read an auto-dependency file and extract the source dependencies. If "update" isn't None check for the sources to be outdated. Add the sources to list of DepNodes "src_list". (sread_auto_dependN(ssourcesautodep_recursivesosspathsexistsstargetsget_namesDependsread_auto_dependsrecdictsauto_depsworksdictlist_nodessupdatesascheck_need_updatessrc_listsextendsdictlist2depnodelistsautodep_dictlist( sworksrecdictssrc_listsupdatestargetssourcesasread_auto_dependsauto_dep((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysautodepend_recurse<s#  c Cs°dkl}||ƒ}| ottfSn|idƒ}| o1|i idƒ}| ot |dƒ}qwn|i tii||iƒƒddƒ}||fSdS(s¥ Find the action and name of the autodepend recipe used for Node "source" for an "stype"file. Returns (None, None) when there is no matching action. (sfind_depend_actionsdepdirsBDIRs.aapiN(sActionsfind_depend_actionsstypesactionsNones source_dictsgetsdssources attributessget_var_val_intsrecdictsworksget_nodesosspathsjoins short_namesrecipe( sworksrecdictsstypessources source_dictsfind_depend_actionsrecipesactionsd((s,/mnt/gmirror/ports/devel/aap/work/DoBuild.pysfind_autodep_itemsOs  +c Cs.t|||||ƒ\}}| otSnt |t dƒ||i ƒf|ƒt ƒ} |iiƒ} || d