Re: pg_upgrade test mods for Windows/Mingw

Lists: pgsql-hackers
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_upgrade test mods for Windows/Mingw
Date: 2012-09-03 03:29:48
Message-ID: 5044242C.3040501@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The attached patch is what I had to do to get pg_upgrade's "make check"
to run on Windows under Mingw. Mostly the changes have to do with
getting paths right between Windows and MSys, or calling generated .bat
files instead of shell scripts.

cheers

andrew

Attachment Content-Type Size
pg_upgrade_test.patch text/x-patch 1.8 KB

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade test mods for Windows/Mingw
Date: 2012-09-03 03:53:03
Message-ID: CABwTF4WmybGqq3c3H3y9NDuuXHKSN9hYWuAUNAHBpiptNCCMSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 2, 2012 at 11:29 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> The attached patch is what I had to do to get pg_upgrade's "make check" to
> run on Windows under Mingw. Mostly the changes have to do with getting
> paths right between Windows and MSys, or calling generated .bat files
> instead of shell scripts.
>

When reading shell script code like this

`uname -a | sed 's/.* //'` = Msys

and

sed -i -e 's,/,\\,g' -e 's,\\s\\q ,/s/q ,' delete_old_cluster.bat
2>/dev/null

I find it easier to understand and maintain if the comments also describe
what is the original string format that this pattern-matching expects,
like:

# We expect `uname -a` output like:
# Windows_NT4.0 Msys

and

# We expect lines of the format:
# abc/xyz/def/
# and we convert them to
# abc\xyz\def

BTW, would `uname -o` eliminate the need of pattern matching in the first
snippet? The Wikipedia [1] article suggests so.

[1] http://en.wikipedia.org/wiki/Uname

Best regards,
--
Gurjeet Singh


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade test mods for Windows/Mingw
Date: 2012-09-03 04:19:51
Message-ID: 17592.1346645991@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com> writes:
> [ this needs a comment: ]
> `uname -a | sed 's/.* //'` = Msys

Also, how about doing that just once and setting a variable to test
as needed later? Multiple copied-and-pasted instances of line noise
like that are risky.

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade test mods for Windows/Mingw
Date: 2012-09-03 13:16:45
Message-ID: 5044ADBD.4040509@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 09/02/2012 11:53 PM, Gurjeet Singh wrote:
> On Sun, Sep 2, 2012 at 11:29 PM, Andrew Dunstan <andrew(at)dunslane(dot)net
> <mailto:andrew(at)dunslane(dot)net>> wrote:
>
> The attached patch is what I had to do to get pg_upgrade's "make
> check" to run on Windows under Mingw. Mostly the changes have to
> do with getting paths right between Windows and MSys, or calling
> generated .bat files instead of shell scripts.
>
>
> When reading shell script code like this
>
> `uname -a | sed 's/.* //'` = Msys
>
> and
>
> sed -i -e 's,/,\\,g' -e 's,\\s\\q ,/s/q ,' delete_old_cluster.bat
> 2>/dev/null
>
> I find it easier to understand and maintain if the comments also
> describe what is the original string format that this
> pattern-matching expects, like:
>
> # We expect `uname -a` output like:
> # Windows_NT4.0 Msys
>
> and
>
> # We expect lines of the format:
> # abc/xyz/def/
> # and we convert them to
> # abc\xyz\def
>
>
> BTW, would `uname -o` eliminate the need of pattern matching in the
> first snippet? The Wikipedia [1] article suggests so.
>
> [1] http://en.wikipedia.org/wiki/Uname
>
>

Yeah it would. This wasn't intended as a final patch anyway, just as
notice of what I actually had working in case anyone else wanted to try.

cheers

andrew


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade test mods for Windows/Mingw
Date: 2012-09-03 13:57:57
Message-ID: 5044B765.3000401@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 09/03/2012 09:16 AM, Andrew Dunstan wrote:
>
> On 09/02/2012 11:53 PM, Gurjeet Singh wrote:
>> On Sun, Sep 2, 2012 at 11:29 PM, Andrew Dunstan <andrew(at)dunslane(dot)net
>> <mailto:andrew(at)dunslane(dot)net>> wrote:
>>
>> The attached patch is what I had to do to get pg_upgrade's "make
>> check" to run on Windows under Mingw. Mostly the changes have to
>> do with getting paths right between Windows and MSys, or calling
>> generated .bat files instead of shell scripts.
>>
>>
>> When reading shell script code like this
>>
>> `uname -a | sed 's/.* //'` = Msys
>>
>> and
>>
>> sed -i -e 's,/,\\,g' -e 's,\\s\\q ,/s/q ,' delete_old_cluster.bat
>> 2>/dev/null

BTW, this last one is a hack. pg_upgrade should make sure that it
outputs backslashed paths for rmdir. (In general, the Windows runtime is
quite happy to accept forward-slashed paths, but certain builtin
commands, such as rmdir are not).

cheers

andrew