Fix git version detection #817

Merged
merged 1 commit into from Sep 12, 2015

Projects

None yet

5 participants

@micove
Contributor
micove commented Sep 11, 2015

It currently fails to detect a 64bit git.

More info: https://msdn.microsoft.com/en-us/library/windows/desktop/aa384274(v=vs.85).aspx

VS is a 32bit process and on a 64bit OS the variables get diverted:
ProgramFiles=%ProgramFiles(x86)%

There is no 64bit VS (yet) therefore check ProgramW6432.

I tried to make it work for all cases:

32bit VS and 32bit OS
  - N/A
  - 32bit git
  - N/A
32bit VS and 64bit OS
  - 32bit git
  - 32bit git
  - 64bit git
64bit VS and 64bit OS
  - 32bit git
  - 64bit git
  - 64bit git

The order of the checks is important to ensure that if we find a 32bit/64bit git we always pick the native 64bit git.

It currently breaks with a TZ left of the Greenwich meridian.

The delimiter in the for loop is "+" which assumes a positive UTC offset. My offset is the rare negative which breaks the intended format. To fix this use the default delimiter and picks the 1st two tokens since the third token is the time zone.

The output of git show -s can cause compilation errors pipe to NUL.

If a commit message contains a line like

error C2871: 'stdext' : a namespace with this name does not exist.

It will break all compilation until a new commit with a different message is done.

Pipe the two can't find the git command error messages to NUL too.

The custom message is enough to get the idea that git is not installed. Silence the other error messages.

@micove micove Fix git version detection
- It currently fails to detect a 64bit git.
- It currently breaks with a TZ left of the Greenwich meridian.
- The output of git show -s can cause compilation errors pipe to NUL.
- Pipe the two can't find the git command error messages to NUL too.
49072d6
@micove micove merged commit 53680d5 into PCSX2:master Sep 12, 2015
@micove
Contributor
micove commented Sep 12, 2015

Should not cause issues therefore merging.

@mirh
mirh commented Sep 12, 2015

Isn't the hardcoded %ProgramFiles(x86)%, %ProgramFiles%, %ProgramW6432% check be redundant when you already look for GITPATH ?

@micove
Contributor
micove commented Sep 12, 2015

GITPATH does not exist and is created by those check.

@micove micove deleted the micove:GIT_TZ branch Sep 12, 2015
@mirh
mirh commented Sep 12, 2015

Oh right, my bad.
Anyway, wouldn't be more elegant to use something like this?

@micove
Contributor
micove commented Sep 12, 2015

Maybe, i did not want to change too much to avoid breaking the bot but the finicky thing broke again! I looked at registries but the one I tried to check required admin access for reg query to work so I scrapped it.

Either the bot wants "SETLOCAL ENABLEEXTENSIONS" for "IF EXISTS" but that should be the default or the bot wants a "^" before the ">" in the FOR loop. I will have to check again in Windows since I don't want to throw random changes until something "sticks" but I don't see it. There are not many changes either so i should not hard to find.

@avih could you check why the bot broke? Also, sorry about that.

@turtleli
Member

I don't know if it's related to the bot not working, but I think you accidentally deleted the set mydir=%~dp0 line, mydir is used when copying the postbuild stuff.

@micove
Contributor
micove commented Sep 12, 2015

The postbuild stuff is useless so I had it removed in an unpushed commit. I was half asleep but I remember testing this on a clean master w/o that commit. I will look into it again. Thanks for the info.

@unknownbrackets
Contributor

My guess is @turtleli is right, the error is:

[Exec] '.\postBuild.cmd' is not recognized as an internal or external command,
[Exec] operable program or batch file.

-[Unknown]

@micove
Contributor
micove commented Sep 12, 2015

Well might as well remove the postBuild stuff now then. since I had it in the props cleanup branch.

@avih
Member
avih commented Sep 12, 2015

Yeah, the buildbot has this for all(most? plugins:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132, 5): error MSB3073: The command ".\postBuild.cmd "C:\BuildAgent\work\d867cb0ae7aa7219\bin\plugins\xpad.dll" "xpad" .dll plugins
:VCEnd" exited with code 9009. 
@mirh
mirh commented Sep 12, 2015

This should do the trick if I didn't miss something, regardless of 32 or 64 bit systems.

FOR /F "skip=2 tokens=2,*" %A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1" /v InstallLocation /reg:32') DO SET GITPATH="%%b"
@avih
Member
avih commented Sep 12, 2015

Remind me what was broken here to begin with? ;)
FWIW, I don't have git at program files, but it is at the path, and it did work for me (I use portable git and added its path).

@micove
Contributor
micove commented Sep 12, 2015

If you add it to the PATH it always work. The exe installer has the option of adding the git location to the $PATH variable but it's not the default. The old code tried to handle the case where git was not in the $PATH and it failed when using 64bit git. It also had other issues unrelated to the path.

@micove
Contributor
micove commented Sep 13, 2015

Does the bot need manual poking if it fails a bunch of times in a row? It should build now.

@unknownbrackets
Contributor

Now it's timing out...

The build Pcsx2::Windows (github) #903 {buildId=42026} has been running for more than 60 minutes. Terminating...

It seems like it finished these parts:

[12:00:27][MSBuild output]        FinalizeBuildStatus:
[12:00:27][MSBuild output]          Deleting file "Win32\Release AVX2\GSdx.tlog\unsuccessfulbuild".
[12:00:27][MSBuild output]          Touching "Win32\Release AVX2\GSdx.tlog\GSdx.lastbuildstate".
[12:00:27][MSBuild output]      7>Done Building Project "C:\BuildAgent\work\d867cb0ae7aa7219\plugins\GSdx\GSdx.vcxproj" (default targets).

Hmm.

-[Unknown]

@unknownbrackets
Contributor

Worked when I queued it for a retry, yay.

-[Unknown]

@micove
Contributor
micove commented Sep 13, 2015

Oh, thanks!

I was going to say it was odd that it timed out since doing an unoptimized simulation of the build bot.

@echo off
msbuild PCSX2_suite.sln /m /t:clean /p:Configuration="Release"
msbuild PCSX2_suite.sln /m /t:clean /p:Configuration="Release SSSE3"
msbuild PCSX2_suite.sln /m /t:clean /p:Configuration="Release SSE4"
msbuild PCSX2_suite.sln /m /t:clean /p:Configuration="Release AVX"
msbuild PCSX2_suite.sln /m /t:clean /p:Configuration="Release AVX2"
msbuild PCSX2_suite.sln /m /p:Configuration="Release"
msbuild PCSX2_suite.sln /m /t:plugins\GSdx /p:BuildProjectReferences=false /p:Configuration="Release SSSE3"
msbuild PCSX2_suite.sln /m /t:plugins\GSdx /p:BuildProjectReferences=false /p:Configuration="Release SSE4"
msbuild PCSX2_suite.sln /m /t:plugins\GSdx /p:BuildProjectReferences=false /p:Configuration="Release AVX"
msbuild PCSX2_suite.sln /m /t:plugins\GSdx /p:BuildProjectReferences=false /p:Configuration="Release AVX2"

FOR /R "%~dp0\bin" %%F in (*.exe, *.dll) DO (
IF EXIST "%%~dpnF.bsc" del "%%~dpnF.bsc"
IF EXIST "%%~dpnF.exp" del "%%~dpnF.exp"
IF EXIST "%%~dpnF.ilk" del "%%~dpnF.ilk"
IF EXIST "%%~dpnF.iobj" del "%%~dpnF.iobj"
IF EXIST "%%~dpnF.ipdb" del "%%~dpnF.ipdb"
IF EXIST "%%~dpnF.lib" del "%%~dpnF.lib"
IF EXIST "%%~dpnF.pdb" del "%%~dpnF.pdb"
)

It takes:
Time Elapsed 00:10:33.99
Time Elapsed 00:01:43.66
Time Elapsed 00:01:43.06
Time Elapsed 00:01:48.36
Time Elapsed 00:01:58.08

using my old laptop.

@turtleli
Member

Apparently the bot used the postbuild stuff. pcsx2 and the plugins are missing from the latest buildbot builds.

See http://forums.pcsx2.net/Thread-PCSX2-Executable-not-included-with-new-github-builds .

@micove
Contributor
micove commented Sep 15, 2015

Unless it's a VS2013 issue then the bot should be fixed. I'm not on Windows right now.

The script I posted above is what the buildbot should do after all the initial environment preparation.

A msbuild task file could be added that simplifies all that into a single msbuild call and would lessen the black box effect of not knowing what the bot is doing.

@micove
Contributor
micove commented Sep 15, 2015

Actually, is there a way to get at least read-only access to the bot? It would help being able to read what it does and the logs.

@avih
Member
avih commented Sep 15, 2015

Actually, is there a way to get at least read-only access to the bot? It would help being able to read what it does and the logs.

Sounds like a good idea to me, but the bot is owned by orphis and I'll need to ask him first. Stay tuned.

@micove
Contributor
micove commented Sep 15, 2015

Oh, okay. I could drop by the irc channel if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment