[Scons-users] Order of execution of a one-file builder

Bill Deegan bill at baddogconsulting.com
Wed Nov 23 11:18:22 EST 2022


env.Sign = Action(....)

But as I said earlier a better solution would be to change your Installer
builder to optionally do the signing Action.

On Wed, Nov 23, 2022 at 4:25 AM Javier Llopis <javier at llopis.me> wrote:

> I'm exploring creating an Action instead of a builder. Is there any way I
> can give a name to my Action, just like the built-in actions "env.Chmod" or
> "env.Copy" have? If possible, I'd like my action to be called "Sign", so
> the code would like AddPostAction(installer, env.Sign)
>
> TIA
> J
>
>
> ------------------------------
> *From*: Bill Deegan <bill at baddogconsulting.com>
> *Sent*: 11/22/22 6:52 PM
> *To*: SCons users mailing list <scons-users at scons.org>
> *Cc*: "javier at llopis.me" <javier at llopis.me>
> *Subject*: Re: [Scons-users] Order of execution of a one-file builder
> Another way to do this would be to alter the Installer() builder to
> optionally do the signing step based on KEYFILE and PASSWORD being set.
> That might be a better solution.
>
> On Tue, Nov 22, 2022 at 10:08 AM Matthew Marinets <
> Matthew.Marinets at kardium.com> wrote:
>
>> Rather than a builder, you can refactor your action into a SCons Action
>> object, then use AddPostAction (or AddPreAction if you want and action to
>> run before another one).
>>
>>
>>
>> So if signing happens after your Install builder, something like:
>>
>>                 my_sign_action = Action(string_or_python_function,
>> print_str)
>>
>>                 installed_exe = env.Install(target_exe, source_exe)
>>
>>                 env.AddPostAction(installed_exe, my_sign_action)
>>
>>
>>
>> Hope this helps!
>>
>> —Matthew
>>
>>
>>
>> *From:* Scons-users <scons-users-bounces at scons.org> *On Behalf Of *Javier
>> Llopis
>> *Sent:* November 22, 2022 08:57
>> *To:* SCons users mailing list <scons-users at scons.org>
>> *Subject:* [Scons-users] Order of execution of a one-file builder
>>
>>
>>
>> Hello All,
>>
>>
>>
>> I have written a builder around SignTool.exe, a program that comes with
>> Visual Studio which digitally signs an executable or a DLL, and have
>> included it in the build system for a piece of software that I have written.
>>
>>  The problem is that the input and output of the builder are the same
>> file, i.e. the builder just runs SignTool on the source[0] parameter and
>> the target is the same file which can create the problem below.
>>
>>  This is my code (the relevant parts):
>>
>>  # on SConscript
>>  instexe = env.Installer(installer_name, "InstallEncVPG.nsi") # NSIS
>> builder from Contributed Builders page
>>  if must_sign:
>>      env.Sign(instexe, KEYFILE=keyfile, PASSWORD=password)
>>  env["installer"] = instexe
>>  Return("env")
>>
>>  #on SConstruct
>>  env = SConscript("Installer/SConscript", exports=["env"])
>>  Install("distrib", env["installer"])
>>
>>  Since the input and output are the same, scons apparently doesn't seem
>> to know when a file is 'ready'.
>>
>>
>>
>> The issue I am running into is that the actions are done in the wrong
>> order: The 'instexe' is built on SConscript, then Install copies it to the
>> 'distrib' directory on SConstruct, then Sign on SConscript signs it on the
>> original directory, so the installer on 'distrib' is unsigned.
>>
>>
>>
>> I cannot reproduce the issue on a smaller script. I tried to write an
>> illustrative, simpler example but then the issue doesn't happen. Only on
>> the big builds.
>>
>>  Is there any way I can force an order of execution?
>>
>>  TIA
>>
>>
>>
>> J
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20221123/c37865e4/attachment-0001.htm>


More information about the Scons-users mailing list