; kx?c@s|dkZdkZdkZdkZdkZdkTdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZeaeadZdZdZeedZedZeedZeedZeedZeedZ eedZ!eedZ"dZ#eedZ$dZ%edZ&eed Z'd!Z(d"Z)dS(#N(s*snoteswarningserrorssystemsresultsinfosextras changedirsdependslogsallsprintiiic Csdkl}l}ttiidjotiiddjodSn|| odSn|d}t i i |od}x|djo|djo |}n|d|}t i i |o|d|d}|djod kl}||nyt i||WqRtj o}td ||fGHPqRXn|d}qWnyt|d aWn*tj o}td Gt|GHnXt i i|adS( snOpen the logfile. Can only be done after locating the main recipe file and changing to it's directory.(sassert_aap_dirs in_aap_diriiscleanALLNslogislog%d(s try_deletes&Warning: Could not rename "%s" to "%s"sws+Warning: Cannot open log file for writing: (sUtilsassert_aap_dirs in_aap_dirslensGlobalscmd_argsstargetssrecdictslog_namesosspathsexistssissrcsdsts try_deletesrenames StandardErrorses_sopenslogfilesstrsabspathslogname( srecdictslog_namessrcs in_aap_dirsdstsis try_deletesesassert_aap_dir((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_startlog.s@0       cCstSdS(s Return the name of the log file.N(slogname(((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_logname_scCs%totitatandS(s;Stop using a logfile. Used just before finishing the work.N(slogfilesclosesNoneslogname(((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_stoplogds  c Cs|o!dkl}|||}nd}| o d}nfdkl}||d}|t jp/t i ||djpt i |t djo d}n|oU|tjo d|GHq|tjod|Gtiiq|Gtiint||d|dS( s Generic function to print a message "msg" of type "type". All messages are written in the log file (if it exists). A message is displayed if its type is in the MESSAGE variable. The optional "rpstack" can be used to prepend the recipe position to the message. (sget_recipe_msgii(sget_var_val_intsMESSAGEsAap: smodeN(srpstacksProcesssget_recipe_msgsmsgsdoprintsrecdictsUtilsget_var_val_intsmsNonesstringsfindstypesmsgt_allsmodes msgm_normals msgm_startssyssstdoutsflushs_log( srecdictsmsgstypesmodesrpstacksget_var_val_intsdoprintsmsget_recipe_msg((s,/mnt/gmirror/ports/devel/aap/work/Message.pysmsg_msgms(   ?    cCstoya|tjotid||fn6|tjotid||fnti|Wqtj o"}t t dt |qXndS(Ns%s: %s s%s: %ss!Error while writing to log file: ( slogfilesmodes msgm_normalswritestypesmsgs msgm_startsIOErrorses UserErrors_sstr(smsgstypesmodese((s,/mnt/gmirror/ports/devel/aap/work/Message.pys_logs  cCs t||td|d|dS(sPrint a note message.smodesrpstackN(smsg_msgsrecdictsmsgs msgt_notesmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pysmsg_notescCs t||td|d|dS(sPrint a warning message.smodesrpstackN(smsg_msgsrecdictsmsgs msgt_warningsmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_warningscCs t||td|d|dS(sPrint an error message.smodesrpstackN(smsg_msgsrecdictsmsgs msgt_errorsmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_errorscCsLt|o|ddjo|d }nt||td|d|dS(s!Print an executed system command.is smodesrpstackN(slensmsgsmsg_msgsrecdicts msgt_systemsmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_systemscCsLt|o|ddjo|d }nt||td|d|dS(s!Print an executed system command.is smodesrpstackN(slensmsgsmsg_msgsrecdicts msgt_resultsmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_resultscCs t||td|d|dS(sPrint an informational message.smodesrpstackN(smsg_msgsrecdictsmsgs msgt_infosmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pysmsg_infoscCspdkl}dkl}y%|||||d|i}Wn |}nXt |t d||fdS(s(Print a message about a skipped command.(sExpand(sexpandisskip line %d: %sN( sUtilsExpandsCommandssexpandsline_nrsrecdictscmds quote_aapsssmsg_infos_(sline_nrsrecdictscmdsssExpandsexpand((s,/mnt/gmirror/ports/devel/aap/work/Message.pysmsg_skips  % cCs t||td|d|dS(s%Print an extra informational message.smodesrpstackN(smsg_msgsrecdictsmsgs msgt_extrasmodesrpstack(srecdictsmsgsmodesrpstack((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_extrascCst|d|tdS(s+Print a message about changing directories.sEntering directory `%s'N(smsg_msgsrecdictsdirsmsgt_changedir(srecdictsdir((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_changedirscCs-|od||}nt||tdS(s#Print a message about dependencies.s%d - N(slevelsmsgsmsg_msgsrecdicts msgt_depend(srecdictsmsgslevel((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_dependscCs?|o!dkl}|||}nt|td|dS(s"Log a message only, never printed.(sget_recipe_msgsmodeN(srpstacksProcesssget_recipe_msgsmsgs_logsmsgt_logsmode(srecdictsmsgsmodesrpstacksget_recipe_msg((s,/mnt/gmirror/ports/devel/aap/work/Message.pysmsg_logs  cCs|GHt|tdS(s#Print a message always, and log it.N(smsgs_logs msgt_print(smsg((s,/mnt/gmirror/ports/devel/aap/work/Message.pys msg_printscCsdkl}||dtjohtiidot|d