[PATCH] allow src/tools/msvc/clean.bat script to be called from the root of the source tree

Started by Juan José Santamaría Flechaalmost 4 years ago4 messages
#1Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
1 attachment(s)

In [1]/messages/by-id/2b7a674b-5fb0-d264-75ef-ecc7a31e54f8@postgrespro.ru capacity for $SUBJECT was added to most of the batch scripts, but
clean.bat was not included. I propose to do so with the attached patch.

By the way, are pgbison.bat and pgflex.bat directly called anywhere?

[1]: /messages/by-id/2b7a674b-5fb0-d264-75ef-ecc7a31e54f8@postgrespro.ru
/messages/by-id/2b7a674b-5fb0-d264-75ef-ecc7a31e54f8@postgrespro.ru

Regards,

Juan José Santamaría Flecha

Attachments:

0001-msvc-clean-bat-path-fix.patchapplication/octet-stream; name=0001-msvc-clean-bat-path-fix.patchDownload
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index 0cc91e7..d52997e 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -4,7 +4,9 @@ REM src/tools/msvc/clean.bat
 set DIST=0
 if "%1"=="dist" set DIST=1
 
-set D=%CD%
+set CURR="%CD%"
+set D="%~dp0"
+cd %D%
 if exist ..\msvc if exist ..\..\..\src cd ..\..\..
 
 if exist debug rd /s /q debug
@@ -138,4 +140,5 @@ cd %D%
 REM Clean up ecpg regression test files
 msbuild ecpg_regression.proj /NoLogo /v:q %MSBFLAGS% /t:clean
 
+cd %CURR%
 goto :eof
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Juan José Santamaría Flecha (#1)
1 attachment(s)
Re: [PATCH] allow src/tools/msvc/clean.bat script to be called from the root of the source tree

On 1/18/22 04:41, Juan José Santamaría Flecha wrote:

In [1] capacity for $SUBJECT was added to most of the batch scripts,
but clean.bat was not included. I propose to do so with the attached
patch.

That looks a bit ugly. How about this (untested) instead?

By the way, are pgbison.bat and pgflex.bat directly called anywhere?

Not to my knowledge. One of the things that's annoying about them is
that the processor names are hardcoded, so if you install winflexbison
as I usually do you have to rename the executables (or rename the
chocolatey shims) or the scripts won't work.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachments:

clean-from-anywhere.patchtext/x-patch; charset=UTF-8; name=clean-from-anywhere.patchDownload
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index 0cc91e7d6c..42b3d1b87f 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -4,8 +4,9 @@ REM src/tools/msvc/clean.bat
 set DIST=0
 if "%1"=="dist" set DIST=1
 
-set D=%CD%
-if exist ..\msvc if exist ..\..\..\src cd ..\..\..
+setlocal
+
+cd "%~dp0\..\..\.."
 
 if exist debug rd /s /q debug
 if exist release rd /s /q release
@@ -133,7 +134,7 @@ REM Clean up datafiles built with contrib
 REM cd contrib
 REM for /r %%f in (*.sql) do if exist %%f.in del %%f
 
-cd %D%
+cd "%~dp0"
 
 REM Clean up ecpg regression test files
 msbuild ecpg_regression.proj /NoLogo /v:q %MSBFLAGS% /t:clean
#3Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andrew Dunstan (#2)
Re: [PATCH] allow src/tools/msvc/clean.bat script to be called from the root of the source tree

On Tue, Jan 18, 2022 at 5:49 PM Andrew Dunstan <andrew@dunslane.net> wrote:

On 1/18/22 04:41, Juan José Santamaría Flecha wrote:

In [1] capacity for $SUBJECT was added to most of the batch scripts,
but clean.bat was not included. I propose to do so with the attached
patch.

That looks a bit ugly. How about this (untested) instead?

It is WFM, so I am fine with it.

By the way, are pgbison.bat and pgflex.bat directly called anywhere?

Not to my knowledge. One of the things that's annoying about them is
that the processor names are hardcoded, so if you install winflexbison
as I usually do you have to rename the executables (or rename the
chocolatey shims) or the scripts won't work.

We could use those batches to get to the hardcoded name, but that would

probably be as annoying as renaming. If those batches serve no purpose
right now, it should be fine to remove them from the tree. I use the
executables from a MinGW installation, and they keep their actual name.

Regards,

Juan José Santamaría Flecha

#4Andrew Dunstan
andrew@dunslane.net
In reply to: Juan José Santamaría Flecha (#3)
Re: [PATCH] allow src/tools/msvc/clean.bat script to be called from the root of the source tree

On 1/18/22 15:08, Juan José Santamaría Flecha wrote:

By the way, are pgbison.bat and pgflex.bat directly called anywhere?

Not to my knowledge. One of the things that's annoying about them is
that the processor names are hardcoded, so if you install winflexbison
as I usually do you have to rename the executables (or rename the
chocolatey shims) or the scripts won't work.

We could use those batches to get to the hardcoded name, but that
would probably be as annoying as renaming. If those batches serve no
purpose right now, it should be fine to remove them from the tree. I
use the executables from a MinGW installation, and they keep their
actual name.

OK, but I don't think we should require installation of MinGW for an
MSVC build.

cheers

andrew

--

Andrew Dunstan

EDB: https://www.enterprisedb.com