Пример #1
0
static void call_action_rule
(
    TARGET * target,
    int status,
    timing_info const * time,
    char const * executed_command,
    char const * command_output
)
{
    LIST * action_rule;

    pushsettings( root_module(), target->settings );
    action_rule = var_get( root_module(), constant_ACTION_RULE );
    popsettings( root_module(), target->settings );

    if ( !list_empty( action_rule ) )
    {
        /* rule action-rule (
            args * :
            target :
            command status start end user system :
            output ? ) */

        /* Prepare the argument list. */
        FRAME frame[ 1 ];
        OBJECT * rulename = list_front( action_rule );
        frame_init( frame );

        /* args * :: $(__ACTION_RULE__[2-]) */
        lol_add( frame->args, list_copy_range( action_rule, list_next(
            list_begin( action_rule ) ), list_end( action_rule ) ) );

        /* target :: the name of the target */
        lol_add( frame->args, list_new( object_copy( target->name ) ) );

        /* command status start end user system :: info about the action command
         */
        lol_add( frame->args,
            list_push_back( list_push_back( list_push_back( list_push_back( list_push_back( list_new(
                object_new( executed_command ) ),
                outf_int( status ) ),
                outf_time( &time->start ) ),
                outf_time( &time->end ) ),
                outf_double( time->user ) ),
                outf_double( time->system ) ) );

        /* output ? :: the output of the action command */
        if ( command_output )
            lol_add( frame->args, list_new( object_new( command_output ) ) );
        else
            lol_add( frame->args, L0 );

        /* Call the rule. */
        evaluate_rule( bindrule( rulename, root_module() ), rulename, frame );

        /* Clean up. */
        frame_free( frame );
    }
}
Пример #2
0
/* Look up the __ACTION_RULE__ variable on the given target, and if
 * non-empty, invoke the rule it names, passing the given info, 
 * timing_info, executed command and command output
 */
static void call_action_rule(TARGET* target, int status, timing_info* time,
    char *executed_command, char *command_output)
{
    LIST* action_rule;

    pushsettings(target->settings);
    action_rule = var_get( "__ACTION_RULE__" );
    popsettings(target->settings);

    if (action_rule)
    {
        /* rule action-rule (
            args * :
            target :
            command status start end user system :
            output ? ) */

        /* Prepare the argument list */
        FRAME frame[1];
        frame_init( frame );

        /* args * :: $(__ACTION_RULE__[2-]) */
        lol_add( frame->args, list_copy( L0, action_rule->next ) );

        /* target :: the name of the target */
        lol_add( frame->args, list_new( L0, target->name ) );

        /* command status start end user system :: info about the action command */
        lol_add( frame->args,
            list_new( list_new( list_new( list_new( list_new( list_new( L0,
                newstr(executed_command) ),
                outf_int(status) ),
                outf_time(time->start) ),
                outf_time(time->end) ),
                outf_double(time->user) ),
                outf_double(time->system) ) );

        /* output ? :: the output of the action command */
        if (command_output)
            lol_add(frame->args, list_new(L0, newstr(command_output)));
        else
            lol_add(frame->args, L0);

        /* Call the rule. */
        evaluate_rule( action_rule->string, frame );

        /* Clean up */
        frame_free( frame );
    }
}
Пример #3
0
LIST *svnrevinfo( FRAME *frame, int flags )
{
    LIST* filepaths = lol_get( frame->args, 0 );
    LIST* revision_info;
    LISTITER iter = list_begin( filepaths ), end = list_end( filepaths );

    int warnonmissing = lol_get( frame->args, 1 ) ? 1 : 0;
    int printrevisioninfo = lol_get( frame->args, 2 ) ? 1 : 0;

    int max_build, accum_build;
    int max_year, max_month, max_day;
    int modifiedfiles, filemodified;

    max_build = 0;
    accum_build = 0; /* for RCS / CVS */
    max_year = max_month = max_day = 0;
    modifiedfiles = 0;
    for (; iter != end; iter = list_next( iter ) )
    {
        /* phase 1: scan through all files and get the highest build number */

        filemodified = 0;
        processfile(object_str(list_item( iter )),
                    0, warnonmissing, printrevisioninfo, 
                    &max_build, &accum_build, &max_year, &max_month, &max_day,
                    &filemodified);
        modifiedfiles += filemodified;
    } /* for */

    revision_info = list_push_back(L0, outf_int(max_build));
    revision_info = list_push_back(revision_info, outf_int(max_year));
    revision_info = list_push_back(revision_info, outf_int(max_month));
    revision_info = list_push_back(revision_info, outf_int(max_day));
    revision_info = list_push_back(revision_info, outf_int(modifiedfiles));

    return revision_info;
}
Пример #4
0
LIST *svnrevinfo( FRAME *frame, int flags )
{
    LIST* filepaths = lol_get( frame->args, 0 );
    LIST* revision_info;

    int warnonmissing = lol_get( frame->args, 1 ) ? 1 : 0;
    int printrevisioninfo = lol_get( frame->args, 2 ) ? 1 : 0;

    int max_build, accum_build;
    int max_year, max_month, max_day;
    int modifiedfiles, filemodified;

    max_build = 0;
    accum_build = 0; /* for RCS / CVS */
    max_year = max_month = max_day = 0;
    modifiedfiles = 0;
    for (; filepaths; filepaths = filepaths->next)
    {
        /* phase 1: scan through all files and get the highest build number */

        filemodified = 0;
        processfile(object_str(filepaths->value),
                    0, warnonmissing, printrevisioninfo, 
                    &max_build, &accum_build, &max_year, &max_month, &max_day,
                    &filemodified);
        modifiedfiles += filemodified;
    } /* for */

    revision_info = list_new(0, outf_int(max_build));
    revision_info = list_new(revision_info, outf_int(max_year));
    revision_info = list_new(revision_info, outf_int(max_month));
    revision_info = list_new(revision_info, outf_int(max_day));
    revision_info = list_new(revision_info, outf_int(modifiedfiles));

    return revision_info;
}