You may be right. In any case, please post your solution as I think it
is an interesting problem to solve =)

2010/4/23 Сева Глущенко <seva.glusche...@gmail.com>:
> Michael,
>
> When we're going to any shell/perl construction, it would be rather
> natural to write a module instead. Of course I'm going to file a FR,
> but I almost sure the response will be sorta "write a module".
>
> 23 апреля 2010 г. 15:57 пользователь Michael Potter <mega...@gmail.com> 
> написал:
>> Of course it didn't work, I was just making the general point that
>> constructs like "ifvarclass      => !canonify(fileexists(" are not
>> valid, use you to use classes: to define them.
>>
>> I would try and approach your rather tricky problem like this:
>>
>> vars:
>>
>>     "filestring" string => execresult("ls $(base)/  | perl -ne
>> '/$base[/](\S+)[/]/ && print \"$1\n\"'","useshell");
>>
>>     "filelist" slist => splitstring("$(filestring)","\n",9999);
>>
>> classes:
>>
>>     "$(filelist)_not_there" not => fileexists("$(dst)/$(filelist)");
>>
>> files:
>>
>>        "$(base)/$(filelist)/.compile"
>>                create          => "true",
>>                ifvarclass      => "$(filelist)_not_there",
>>                comment         => "force compiler execution";
>>
>> You would probably have to tweak the regex in Perl to get it to work
>> right, and I have no idea if I escaped the " correctly. I am pretty
>> sure you could make this technique work with some fiddling however.
>>
>> That being said, I think your original attempt *would* be a nice
>> construct to have available, why not send a feature request to the
>> cfengine team?
>>
>> 2010/4/23 Сева Глущенко <seva.glusche...@gmail.com>:
>>> Michael,
>>>
>>> Predictably, it doesn't work. Just because file existence cannot be
>>> checked before $(match.1) is evaluated which cannot be evaluated until
>>> the class is set.
>>>
>>> 2010/4/23 Michael Potter <mega...@gmail.com>:
>>>> You have to defined a class separately:
>>>>
>>>> classes:
>>>>
>>>>   "notthere" not => fileexists("$(dst)/$(match.1)");
>>>>
>>>> On Fri, Apr 23, 2010 at 8:38 PM, Сева Глущенко
>>>> <seva.glusche...@gmail.com> wrote:
>>>>> Hello folks,
>>>>>
>>>>> I'm trying to make a promise which creates files when their
>>>>> counterparts not exist yet. But when I'm writing something like
>>>>>
>>>>>    compile::
>>>>>       "$(base)/(.*)/.compile"
>>>>>               create          => "true",
>>>>>               ifvarclass      => 
>>>>> !canonify(fileexists("$(dst)/$(match.1)")),
>>>>>               comment         => "force compiler execution";
>>>>>
>>>>> The Cfengine reports syntax error on that. Am I missed something? Is
>>>>> there a way to accomplish this task at all?
>>>>>
>>>>> --
>>>>> SY, Seva Gluschenko.
>>>>> _______________________________________________
>>>>> Help-cfengine mailing list
>>>>> Help-cfengine@cfengine.org
>>>>> https://cfengine.org/mailman/listinfo/help-cfengine
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> SY, Seva Gluschenko.
>>>
>>
>
>
>
> --
> SY, Seva Gluschenko.
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to