public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* DSC POSTBUILD problem/question
@ 2021-05-10 20:05 Kirkendall, Garrett
  2021-05-11  2:57 ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 2+ messages in thread
From: Kirkendall, Garrett @ 2021-05-10 20:05 UTC (permalink / raw)
  To: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 1980 bytes --]

I'm checking out the PREBUILD and POSTBUILD option in a DSC.  I can launch my scripts, etc.

When there is a POSTBUILD error,  build.py properly says the build failed, but build.py is still returning 0 (success).  MyBuild.LaunchPostBuild() execution does not look like it affects ReturnCode which is returned at the end of Main.  "Conclusion" is updated though to indicate a failure.  Any ideas?  I assume build.py should return non-zero if POSTBUILD fails.




>From end of edk-stable202011build.py:Main()

    if ReturnCode == 0:
        try:
            MyBuild.LaunchPostbuild()
            Conclusion = "Done"
        except:
            Conclusion = "Failed"
    elif ReturnCode == ABORT_ERROR:
        Conclusion = "Aborted"
    else:
        Conclusion = "Failed"
    FinishTime = time.time()
    BuildDuration = time.gmtime(int(round(FinishTime - StartTime)))
    BuildDurationStr = ""
    if BuildDuration.tm_yday > 1:
        BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration) + ", %d day(s)" % (BuildDuration.tm_yday - 1)
    else:
        BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration)
    if MyBuild is not None:
        if not BuildError:
            MyBuild.BuildReport.GenerateReport(BuildDurationStr, LogBuildTime(MyBuild.AutoGenTime), LogBuildTime(MyBuild.MakeTime), LogBuildTime(MyBuild.GenFdsTime))

    EdkLogger.SetLevel(EdkLogger.QUIET)
    EdkLogger.quiet("\n- %s -" % Conclusion)
    EdkLogger.quiet(time.strftime("Build end time: %H:%M:%S, %b.%d %Y", time.localtime()))
    EdkLogger.quiet("Build total time: %s\n" % BuildDurationStr)
    Log_Agent.kill()
    Log_Agent.join()
    return ReturnCode

master is the same code:
https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/build/build.py#L2738


Garrett Kirkendall
SMTS Firmware Engineer
7171 Southwest Parkway, Austin, TX 78735 USA
AMD   facebook<https://www.facebook.com/AMD>  |  amd.com<http://www.amd.com/>


[-- Attachment #2: Type: text/html, Size: 8169 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* 回复: [edk2-devel] DSC POSTBUILD problem/question
  2021-05-10 20:05 DSC POSTBUILD problem/question Kirkendall, Garrett
@ 2021-05-11  2:57 ` gaoliming
  0 siblings, 0 replies; 2+ messages in thread
From: gaoliming @ 2021-05-11  2:57 UTC (permalink / raw)
  To: devel, garrett.kirkendall, 'Feng, Bob C'

[-- Attachment #1: Type: text/plain, Size: 2464 bytes --]

Garrett:

 I agree build should return error code reported from post build fail.
Seemly, current logic doesn’t handle the failure case.

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Kirkendall, Garrett
发送时间: 2021年5月11日 4:05
收件人: devel@edk2.groups.io
主题: [edk2-devel] DSC POSTBUILD problem/question

 

I'm checking out the PREBUILD and POSTBUILD option in a DSC.  I can launch
my scripts, etc.

 

When there is a POSTBUILD error,  build.py properly says the build failed,
but build.py is still returning 0 (success).  MyBuild.LaunchPostBuild()
execution does not look like it affects ReturnCode which is returned at the
end of Main.  "Conclusion" is updated though to indicate a failure.  Any
ideas?  I assume build.py should return non-zero if POSTBUILD fails.

 

 

 

 

>From end of edk-stable202011build.py:Main()

 

    if ReturnCode == 0:

        try:

            MyBuild.LaunchPostbuild()

            Conclusion = "Done"

        except:

            Conclusion = "Failed"

    elif ReturnCode == ABORT_ERROR:

        Conclusion = "Aborted"

    else:

        Conclusion = "Failed"

    FinishTime = time.time()

    BuildDuration = time.gmtime(int(round(FinishTime - StartTime)))

    BuildDurationStr = ""

    if BuildDuration.tm_yday > 1:

        BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration) + ", %d
day(s)" % (BuildDuration.tm_yday - 1)

    else:

        BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration)

    if MyBuild is not None:

        if not BuildError:

            MyBuild.BuildReport.GenerateReport(BuildDurationStr,
LogBuildTime(MyBuild.AutoGenTime), LogBuildTime(MyBuild.MakeTime),
LogBuildTime(MyBuild.GenFdsTime))

 

    EdkLogger.SetLevel(EdkLogger.QUIET)

    EdkLogger.quiet("\n- %s -" % Conclusion)

    EdkLogger.quiet(time.strftime("Build end time: %H:%M:%S, %b.%d %Y",
time.localtime()))

    EdkLogger.quiet("Build total time: %s\n" % BuildDurationStr)

    Log_Agent.kill()

    Log_Agent.join()

    return ReturnCode

 

master is the same code:

https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/build/
build.py#L2738

 

 

Garrett Kirkendall
SMTS Firmware Engineer
7171 Southwest Parkway, Austin, TX 78735 USA 
AMD    <https://www.facebook.com/AMD> facebook  |   <http://www.amd.com/>
amd.com

 




[-- Attachment #2: Type: text/html, Size: 10451 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-11  2:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-10 20:05 DSC POSTBUILD problem/question Kirkendall, Garrett
2021-05-11  2:57 ` 回复: [edk2-devel] " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox