Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 10:08 AM
Andrew Dunstan
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in the PATH



Hannes Eder wrote:
> - open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n";
> + open($D, "cmd /c dir /b $subdirs $spec |") || croak "Could not list $spec\n";
>
>


What the heck are we doing here anyway? We should be doing this a la
Perl - calling out to "dir /b" is surely not the best way to do this. If
we need to recurse we should use File::Find.

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 10:10 AM
Hannes Eder
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in the PATH

Andrew Dunstan schrieb:
> Hannes Eder wrote:
>> - open($D, "dir /b $subdirs $spec |") || croak "Could not list
>> $spec\n";
>> + open($D, "cmd /c dir /b $subdirs $spec |") || croak "Could not
>> list $spec\n";
>>

>
> What the heck are we doing here anyway? We should be doing this a la
> Perl - calling out to "dir /b" is surely not the best way to do this.
> If we need to recurse we should use File::Find.

I think since the code in src/tools/msvc is specific to MSVC and
therefor, at least currently, specific to Windows. Calling out to "dir
/b /s" or "cmd /c dir /b /s" works on WinNT and higher. On Win9x/ME
command.com should be called instead of cmd.exe. In order to be more
portable maybe we should use the environment variable COMSPEC, which
should always point to an appropriate command processor.

Is it worth doing this the "Perl-way" and using File::Find? If so, I can
work an a patch for that.

Hannes.


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 10:10 AM
Magnus Hagander
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in the PATH

On Wed, May 30, 2007 at 12:09:05PM +0200, Hannes Eder wrote:
> Andrew Dunstan schrieb:
> >Hannes Eder wrote:
> >>- open($D, "dir /b $subdirs $spec |") || croak "Could not list
> >>$spec\n";
> >>+ open($D, "cmd /c dir /b $subdirs $spec |") || croak "Could not
> >>list $spec\n";
> >>

> >
> >What the heck are we doing here anyway? We should be doing this a la
> >Perl - calling out to "dir /b" is surely not the best way to do this.
> >If we need to recurse we should use File::Find.

> I think since the code in src/tools/msvc is specific to MSVC and
> therefor, at least currently, specific to Windows. Calling out to "dir
> /b /s" or "cmd /c dir /b /s" works on WinNT and higher. On Win9x/ME
> command.com should be called instead of cmd.exe. In order to be more
> portable maybe we should use the environment variable COMSPEC, which
> should always point to an appropriate command processor.


We only support NT based OSes anyway, so I don't see COMSPEC as being a
problem. The reason it is the way it is is because that part was originally
just a .bat-file and I just copy/pasted the commands...

Are you actually *running* the script from inside cygwin? How else does it
pick up the wrong command processor?


> Is it worth doing this the "Perl-way" and using File::Find? If so, I can
> work an a patch for that.


It's certainly cleaner that way, but I don't find it a major issue. But I'd
rather see that fix than the other one.

//Magnus


---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 10:10 AM
Hannes Eder
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in the PATH

Magnus Hagander schrieb:
> Are you actually *running* the script from inside cygwin? How else does it
> pick up the wrong command processor?
>

I run the script within cmd.exe, but cygwin´s /usr/bin directory is in
my PATH, therefor cygwin dir executable is in the PATH (/usr/bin/dir).
Instead of running cmd.exe´s "dir" command, cygwin´s /usr/bin/dir is
invoked, when calling

open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n";

but they do not work in the same way.

So my original patch just solves the issue to run
src/tools/msvc/install.(bat¦pl¦pm) while leaving the cygwin´s /usr/bin
in the PATH.
>> Is it worth doing this the "Perl-way" and using File::Find? If so, I can
>> work an a patch for that.
>>

> It's certainly cleaner that way, but I don't find it a major issue. But I'd
> rather see that fix than the other one.
>

Time permitting I´ll provide a patch.

Hannes.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-18-2008, 10:10 AM
Magnus Hagander
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in the PATH

On Wed, May 30, 2007 at 01:56:24PM +0200, Hannes Eder wrote:
> Magnus Hagander schrieb:
> >Are you actually *running* the script from inside cygwin? How else does it
> >pick up the wrong command processor?
> >

> I run the script within cmd.exe, but cygwin´s /usr/bin directory is in
> my PATH, therefor cygwin dir executable is in the PATH (/usr/bin/dir).
> Instead of running cmd.exe´s "dir" command, cygwin´s /usr/bin/dir is
> invoked, when calling


They actually *put* that in there? Wow. That's yet another reason never to
let cygwni touch your global path :-)

> >>Is it worth doing this the "Perl-way" and using File::Find? If so, I can
> >>work an a patch for that.
> >>

> >It's certainly cleaner that way, but I don't find it a major issue. But I'd
> >rather see that fix than the other one.
> >

> Time permitting I´ll provide a patch.


Thanks.

//Magnus


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 10:12 AM
Hannes Eder
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in the PATH

Magnus Hagander wrote:
>Hannes Eder wrote:
>> Is it worth doing this the "Perl-way" and using File::Find? If so, I

can
>> work an a patch for that.
>>

> It's certainly cleaner that way, but I don't find it a major issue.

But I'd
> rather see that fix than the other one.


Here we go. See attached patch. Your comments are welcome.

Hannes.


*** ..\pgsql-cvshead\src\tools\msvc\Install.pm Mo Mai 14 16:36:10 2007
--- src\tools\msvc\Install.pm Mi Jun 6 20:39:47 2007
***************
*** 10,15 ****
--- 10,18 ----
use Carp;
use File::Basename;
use File::Copy;
+ use File::Find;
+ use File::Glob;
+ use File::Spec;

use Exporter;
our (@ISA,@EXPORT_OK);
***************
*** 99,104 ****
--- 102,142 ----
print "\n";
}

+ sub FindFiles
+ {
+ my $spec = shift;
+ my $nonrecursive = shift;
+ my $pat = basename($spec);
+ my $dir = dirname($spec);
+
+ if ($dir eq '') { $dir = '.'; }
+
+ -d $dir || croak "Could not list directory $dir: $!\n";
+
+ if ($nonrecursive)
+ {
+ return glob($spec);
+ }
+
+ # borrowed from File:osGlob
+ # escape regex metachars but not glob chars
+ $pat =~ s[].+^\-\${}[|]):\\$1:g;
+ # and convert DOS-style wildcards to regex
+ $pat =~ s/\*/.*/g;
+ $pat =~ s/\?/.?/g;
+
+ $pat = '^' . $pat . '\z';
+
+ my @res;
+ find(
+ {
+ wanted => sub { /$pat/s && push (@res, File::Spec->canonpath($File::Find::name)); }
+ },
+ $dir
+ );
+ return @res;
+ }
+
sub CopySetOfFiles
{
my $what = shift;
***************
*** 106,126 ****
my $target = shift;
my $silent = shift;
my $norecurse = shift;
- my $D;

- my $subdirs = $norecurse?'':'/s';
print "Copying $what" unless ($silent);
! open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n";
! while (<$D>)
{
- chomp;
next if /regress/; # Skip temporary install in regression subdir
! my $tgt = $target . basename($_);
print ".";
! my $src = $norecurse?(dirname($spec) . '/' . $_):$_;
! copy($src, $tgt) || croak "Could not copy $src: $!\n";
}
! close($D);
print "\n";
}

--- 144,161 ----
my $target = shift;
my $silent = shift;
my $norecurse = shift;

print "Copying $what" unless ($silent);
!
! foreach (FindFiles($spec, $norecurse))
{
next if /regress/; # Skip temporary install in regression subdir
! my $src = $_;
! my $tgt = $target . basename($src);
print ".";
! copy($src, $tgt) || croak "Could not copy $src to $tgt: $!\n";
}
!
print "\n";
}

***************
*** 371,395 ****
{
my $target = shift;
my $nlspath = shift;
- my $D;

print "Installing NLS files...";
EnsureDirectories($target, "share/locale");
! open($D,"dir /b /s nls.mk|") || croak "Could not list nls.mk\n";
! while (<$D>)
{
- chomp;
s/nls.mk/po/;
my $dir = $_;
next unless ($dir =~ /([^\\]+)\\po$/);
my $prgm = $1;
$prgm = 'postgres' if ($prgm eq 'backend');
- my $E;
- open($E,"dir /b $dir\\*.po|") || croak "Could not list contents of $_\n";

! while (<$E>)
{
- chomp;
my $lang;
next unless /^(.*)\.po/;
$lang = $1;
--- 406,425 ----
{
my $target = shift;
my $nlspath = shift;

print "Installing NLS files...";
EnsureDirectories($target, "share/locale");
!
! foreach (FindFiles("nls.mk"))
{
s/nls.mk/po/;
my $dir = $_;
next unless ($dir =~ /([^\\]+)\\po$/);
my $prgm = $1;
$prgm = 'postgres' if ($prgm eq 'backend');

! foreach (FindFiles("$dir\\*.po", 1))
{
my $lang;
next unless /^(.*)\.po/;
$lang = $1;
***************
*** 401,409 ****
&& croak("Could not run msgfmt on $dir\\$_");
print ".";
}
- close($E);
}
! close($D);
print "\n";
}

--- 431,438 ----
&& croak("Could not run msgfmt on $dir\\$_");
print ".";
}
}
!
print "\n";
}



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-18-2008, 10:23 AM
Bruce Momjian
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwinin the PATH


Magnus, what is your reaction to this patch?

---------------------------------------------------------------------------

Hannes Eder wrote:
> Magnus Hagander wrote:
> >Hannes Eder wrote:
> >> Is it worth doing this the "Perl-way" and using File::Find? If so, I

> can
> >> work an a patch for that.
> >>

> > It's certainly cleaner that way, but I don't find it a major issue.

> But I'd
> > rather see that fix than the other one.

>
> Here we go. See attached patch. Your comments are welcome.
>
> Hannes.
>


> *** ..\pgsql-cvshead\src\tools\msvc\Install.pm Mo Mai 14 16:36:10 2007
> --- src\tools\msvc\Install.pm Mi Jun 6 20:39:47 2007
> ***************
> *** 10,15 ****
> --- 10,18 ----
> use Carp;
> use File::Basename;
> use File::Copy;
> + use File::Find;
> + use File::Glob;
> + use File::Spec;
>
> use Exporter;
> our (@ISA,@EXPORT_OK);
> ***************
> *** 99,104 ****
> --- 102,142 ----
> print "\n";
> }
>
> + sub FindFiles
> + {
> + my $spec = shift;
> + my $nonrecursive = shift;
> + my $pat = basename($spec);
> + my $dir = dirname($spec);
> +
> + if ($dir eq '') { $dir = '.'; }
> +
> + -d $dir || croak "Could not list directory $dir: $!\n";
> +
> + if ($nonrecursive)
> + {
> + return glob($spec);
> + }
> +
> + # borrowed from File:osGlob
> + # escape regex metachars but not glob chars
> + $pat =~ s[].+^\-\${}[|]):\\$1:g;
> + # and convert DOS-style wildcards to regex
> + $pat =~ s/\*/.*/g;
> + $pat =~ s/\?/.?/g;
> +
> + $pat = '^' . $pat . '\z';
> +
> + my @res;
> + find(
> + {
> + wanted => sub { /$pat/s && push (@res, File::Spec->canonpath($File::Find::name)); }
> + },
> + $dir
> + );
> + return @res;
> + }
> +
> sub CopySetOfFiles
> {
> my $what = shift;
> ***************
> *** 106,126 ****
> my $target = shift;
> my $silent = shift;
> my $norecurse = shift;
> - my $D;
>
> - my $subdirs = $norecurse?'':'/s';
> print "Copying $what" unless ($silent);
> ! open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n";
> ! while (<$D>)
> {
> - chomp;
> next if /regress/; # Skip temporary install in regression subdir
> ! my $tgt = $target . basename($_);
> print ".";
> ! my $src = $norecurse?(dirname($spec) . '/' . $_):$_;
> ! copy($src, $tgt) || croak "Could not copy $src: $!\n";
> }
> ! close($D);
> print "\n";
> }
>
> --- 144,161 ----
> my $target = shift;
> my $silent = shift;
> my $norecurse = shift;
>
> print "Copying $what" unless ($silent);
> !
> ! foreach (FindFiles($spec, $norecurse))
> {
> next if /regress/; # Skip temporary install in regression subdir
> ! my $src = $_;
> ! my $tgt = $target . basename($src);
> print ".";
> ! copy($src, $tgt) || croak "Could not copy $src to $tgt: $!\n";
> }
> !
> print "\n";
> }
>
> ***************
> *** 371,395 ****
> {
> my $target = shift;
> my $nlspath = shift;
> - my $D;
>
> print "Installing NLS files...";
> EnsureDirectories($target, "share/locale");
> ! open($D,"dir /b /s nls.mk|") || croak "Could not list nls.mk\n";
> ! while (<$D>)
> {
> - chomp;
> s/nls.mk/po/;
> my $dir = $_;
> next unless ($dir =~ /([^\\]+)\\po$/);
> my $prgm = $1;
> $prgm = 'postgres' if ($prgm eq 'backend');
> - my $E;
> - open($E,"dir /b $dir\\*.po|") || croak "Could not list contents of $_\n";
>
> ! while (<$E>)
> {
> - chomp;
> my $lang;
> next unless /^(.*)\.po/;
> $lang = $1;
> --- 406,425 ----
> {
> my $target = shift;
> my $nlspath = shift;
>
> print "Installing NLS files...";
> EnsureDirectories($target, "share/locale");
> !
> ! foreach (FindFiles("nls.mk"))
> {
> s/nls.mk/po/;
> my $dir = $_;
> next unless ($dir =~ /([^\\]+)\\po$/);
> my $prgm = $1;
> $prgm = 'postgres' if ($prgm eq 'backend');
>
> ! foreach (FindFiles("$dir\\*.po", 1))
> {
> my $lang;
> next unless /^(.*)\.po/;
> $lang = $1;
> ***************
> *** 401,409 ****
> && croak("Could not run msgfmt on $dir\\$_");
> print ".";
> }
> - close($E);
> }
> ! close($D);
> print "\n";
> }
>
> --- 431,438 ----
> && croak("Could not run msgfmt on $dir\\$_");
> print ".";
> }
> }
> !
> print "\n";
> }
>


>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend


--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-18-2008, 10:24 AM
Magnus Hagander
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in thePATH

I used to have a different patch from Andrew that did part of this, and
more, and conflicted rather badly with it. However, I never got around
to applying that one, and I can't seem to find it anymore.

Andrew -do you recall if you had all this in yours, and is it still
something you want in, or should we just go with this one?

//Magnus

Bruce Momjian wrote:
> Magnus, what is your reaction to this patch?
>
> ---------------------------------------------------------------------------
>
> Hannes Eder wrote:
>> Magnus Hagander wrote:
>> >Hannes Eder wrote:
>> >> Is it worth doing this the "Perl-way" and using File::Find? If so, I

>> can
>> >> work an a patch for that.
>> >>
>> > It's certainly cleaner that way, but I don't find it a major issue.

>> But I'd
>> > rather see that fix than the other one.

>>
>> Here we go. See attached patch. Your comments are welcome.
>>
>> Hannes.
>>

>
>> *** ..\pgsql-cvshead\src\tools\msvc\Install.pm Mo Mai 14 16:36:10 2007
>> --- src\tools\msvc\Install.pm Mi Jun 6 20:39:47 2007
>> ***************
>> *** 10,15 ****
>> --- 10,18 ----
>> use Carp;
>> use File::Basename;
>> use File::Copy;
>> + use File::Find;
>> + use File::Glob;
>> + use File::Spec;
>>
>> use Exporter;
>> our (@ISA,@EXPORT_OK);
>> ***************
>> *** 99,104 ****
>> --- 102,142 ----
>> print "\n";
>> }
>>
>> + sub FindFiles
>> + {
>> + my $spec = shift;
>> + my $nonrecursive = shift;
>> + my $pat = basename($spec);
>> + my $dir = dirname($spec);
>> +
>> + if ($dir eq '') { $dir = '.'; }
>> +
>> + -d $dir || croak "Could not list directory $dir: $!\n";
>> +
>> + if ($nonrecursive)
>> + {
>> + return glob($spec);
>> + }
>> +
>> + # borrowed from File:osGlob
>> + # escape regex metachars but not glob chars
>> + $pat =~ s[].+^\-\${}[|]):\\$1:g;
>> + # and convert DOS-style wildcards to regex
>> + $pat =~ s/\*/.*/g;
>> + $pat =~ s/\?/.?/g;
>> +
>> + $pat = '^' . $pat . '\z';
>> +
>> + my @res;
>> + find(
>> + {
>> + wanted => sub { /$pat/s && push (@res, File::Spec->canonpath($File::Find::name)); }
>> + },
>> + $dir
>> + );
>> + return @res;
>> + }
>> +
>> sub CopySetOfFiles
>> {
>> my $what = shift;
>> ***************
>> *** 106,126 ****
>> my $target = shift;
>> my $silent = shift;
>> my $norecurse = shift;
>> - my $D;
>>
>> - my $subdirs = $norecurse?'':'/s';
>> print "Copying $what" unless ($silent);
>> ! open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n";
>> ! while (<$D>)
>> {
>> - chomp;
>> next if /regress/; # Skip temporary install in regression subdir
>> ! my $tgt = $target . basename($_);
>> print ".";
>> ! my $src = $norecurse?(dirname($spec) . '/' . $_):$_;
>> ! copy($src, $tgt) || croak "Could not copy $src: $!\n";
>> }
>> ! close($D);
>> print "\n";
>> }
>>
>> --- 144,161 ----
>> my $target = shift;
>> my $silent = shift;
>> my $norecurse = shift;
>>
>> print "Copying $what" unless ($silent);
>> !
>> ! foreach (FindFiles($spec, $norecurse))
>> {
>> next if /regress/; # Skip temporary install in regression subdir
>> ! my $src = $_;
>> ! my $tgt = $target . basename($src);
>> print ".";
>> ! copy($src, $tgt) || croak "Could not copy $src to $tgt: $!\n";
>> }
>> !
>> print "\n";
>> }
>>
>> ***************
>> *** 371,395 ****
>> {
>> my $target = shift;
>> my $nlspath = shift;
>> - my $D;
>>
>> print "Installing NLS files...";
>> EnsureDirectories($target, "share/locale");
>> ! open($D,"dir /b /s nls.mk|") || croak "Could not list nls.mk\n";
>> ! while (<$D>)
>> {
>> - chomp;
>> s/nls.mk/po/;
>> my $dir = $_;
>> next unless ($dir =~ /([^\\]+)\\po$/);
>> my $prgm = $1;
>> $prgm = 'postgres' if ($prgm eq 'backend');
>> - my $E;
>> - open($E,"dir /b $dir\\*.po|") || croak "Could not list contents of $_\n";
>>
>> ! while (<$E>)
>> {
>> - chomp;
>> my $lang;
>> next unless /^(.*)\.po/;
>> $lang = $1;
>> --- 406,425 ----
>> {
>> my $target = shift;
>> my $nlspath = shift;
>>
>> print "Installing NLS files...";
>> EnsureDirectories($target, "share/locale");
>> !
>> ! foreach (FindFiles("nls.mk"))
>> {
>> s/nls.mk/po/;
>> my $dir = $_;
>> next unless ($dir =~ /([^\\]+)\\po$/);
>> my $prgm = $1;
>> $prgm = 'postgres' if ($prgm eq 'backend');
>>
>> ! foreach (FindFiles("$dir\\*.po", 1))
>> {
>> my $lang;
>> next unless /^(.*)\.po/;
>> $lang = $1;
>> ***************
>> *** 401,409 ****
>> && croak("Could not run msgfmt on $dir\\$_");
>> print ".";
>> }
>> - close($E);
>> }
>> ! close($D);
>> print "\n";
>> }
>>
>> --- 431,438 ----
>> && croak("Could not run msgfmt on $dir\\$_");
>> print ".";
>> }
>> }
>> !
>> print "\n";
>> }
>>

>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 6: explain analyze is your friend

>



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-18-2008, 10:24 AM
Andrew Dunstan
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in thePATH


I am fighting some fires in my day job.

My pesonal TODO list for pg up to beta is:

.. fix chunking muddle (see recent emails)
.. complete CSV logs patch
.. harden MSVC builds

I'll get to this when I can. I can dig up the patch I did if you want
it again.

cheers

andrew


Magnus Hagander wrote:
> I used to have a different patch from Andrew that did part of this, and
> more, and conflicted rather badly with it. However, I never got around
> to applying that one, and I can't seem to find it anymore.
>
> Andrew -do you recall if you had all this in yours, and is it still
> something you want in, or should we just go with this one?
>
> //Magnus
>
> Bruce Momjian wrote:
>
>> Magnus, what is your reaction to this patch?
>>
>> ---------------------------------------------------------------------------
>>
>> Hannes Eder wrote:
>>
>>> Magnus Hagander wrote:
>>> >Hannes Eder wrote:
>>> >> Is it worth doing this the "Perl-way" and using File::Find? If so, I
>>> can
>>> >> work an a patch for that.
>>> >>
>>> > It's certainly cleaner that way, but I don't find it a major issue.
>>> But I'd
>>> > rather see that fix than the other one.
>>>
>>> Here we go. See attached patch. Your comments are welcome.
>>>
>>> Hannes.
>>>
>>>
>>> *** ..\pgsql-cvshead\src\tools\msvc\Install.pm Mo Mai 14 16:36:10 2007
>>> --- src\tools\msvc\Install.pm Mi Jun 6 20:39:47 2007
>>> ***************
>>> *** 10,15 ****
>>> --- 10,18 ----
>>> use Carp;
>>> use File::Basename;
>>> use File::Copy;
>>> + use File::Find;
>>> + use File::Glob;
>>> + use File::Spec;
>>>
>>> use Exporter;
>>> our (@ISA,@EXPORT_OK);
>>> ***************
>>> *** 99,104 ****
>>> --- 102,142 ----
>>> print "\n";
>>> }
>>>
>>> + sub FindFiles
>>> + {
>>> + my $spec = shift;
>>> + my $nonrecursive = shift;
>>> + my $pat = basename($spec);
>>> + my $dir = dirname($spec);
>>> +
>>> + if ($dir eq '') { $dir = '.'; }
>>> +
>>> + -d $dir || croak "Could not list directory $dir: $!\n";
>>> +
>>> + if ($nonrecursive)
>>> + {
>>> + return glob($spec);
>>> + }
>>> +
>>> + # borrowed from File:osGlob
>>> + # escape regex metachars but not glob chars
>>> + $pat =~ s[].+^\-\${}[|]):\\$1:g;
>>> + # and convert DOS-style wildcards to regex
>>> + $pat =~ s/\*/.*/g;
>>> + $pat =~ s/\?/.?/g;
>>> +
>>> + $pat = '^' . $pat . '\z';
>>> +
>>> + my @res;
>>> + find(
>>> + {
>>> + wanted => sub { /$pat/s && push (@res, File::Spec->canonpath($File::Find::name)); }
>>> + },
>>> + $dir
>>> + );
>>> + return @res;
>>> + }
>>> +
>>> sub CopySetOfFiles
>>> {
>>> my $what = shift;
>>> ***************
>>> *** 106,126 ****
>>> my $target = shift;
>>> my $silent = shift;
>>> my $norecurse = shift;
>>> - my $D;
>>>
>>> - my $subdirs = $norecurse?'':'/s';
>>> print "Copying $what" unless ($silent);
>>> ! open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n";
>>> ! while (<$D>)
>>> {
>>> - chomp;
>>> next if /regress/; # Skip temporary install in regression subdir
>>> ! my $tgt = $target . basename($_);
>>> print ".";
>>> ! my $src = $norecurse?(dirname($spec) . '/' . $_):$_;
>>> ! copy($src, $tgt) || croak "Could not copy $src: $!\n";
>>> }
>>> ! close($D);
>>> print "\n";
>>> }
>>>
>>> --- 144,161 ----
>>> my $target = shift;
>>> my $silent = shift;
>>> my $norecurse = shift;
>>>
>>> print "Copying $what" unless ($silent);
>>> !
>>> ! foreach (FindFiles($spec, $norecurse))
>>> {
>>> next if /regress/; # Skip temporary install in regression subdir
>>> ! my $src = $_;
>>> ! my $tgt = $target . basename($src);
>>> print ".";
>>> ! copy($src, $tgt) || croak "Could not copy $src to $tgt: $!\n";
>>> }
>>> !
>>> print "\n";
>>> }
>>>
>>> ***************
>>> *** 371,395 ****
>>> {
>>> my $target = shift;
>>> my $nlspath = shift;
>>> - my $D;
>>>
>>> print "Installing NLS files...";
>>> EnsureDirectories($target, "share/locale");
>>> ! open($D,"dir /b /s nls.mk|") || croak "Could not list nls.mk\n";
>>> ! while (<$D>)
>>> {
>>> - chomp;
>>> s/nls.mk/po/;
>>> my $dir = $_;
>>> next unless ($dir =~ /([^\\]+)\\po$/);
>>> my $prgm = $1;
>>> $prgm = 'postgres' if ($prgm eq 'backend');
>>> - my $E;
>>> - open($E,"dir /b $dir\\*.po|") || croak "Could not list contents of $_\n";
>>>
>>> ! while (<$E>)
>>> {
>>> - chomp;
>>> my $lang;
>>> next unless /^(.*)\.po/;
>>> $lang = $1;
>>> --- 406,425 ----
>>> {
>>> my $target = shift;
>>> my $nlspath = shift;
>>>
>>> print "Installing NLS files...";
>>> EnsureDirectories($target, "share/locale");
>>> !
>>> ! foreach (FindFiles("nls.mk"))
>>> {
>>> s/nls.mk/po/;
>>> my $dir = $_;
>>> next unless ($dir =~ /([^\\]+)\\po$/);
>>> my $prgm = $1;
>>> $prgm = 'postgres' if ($prgm eq 'backend');
>>>
>>> ! foreach (FindFiles("$dir\\*.po", 1))
>>> {
>>> my $lang;
>>> next unless /^(.*)\.po/;
>>> $lang = $1;
>>> ***************
>>> *** 401,409 ****
>>> && croak("Could not run msgfmt on $dir\\$_");
>>> print ".";
>>> }
>>> - close($E);
>>> }
>>> ! close($D);
>>> print "\n";
>>> }
>>>
>>> --- 431,438 ----
>>> && croak("Could not run msgfmt on $dir\\$_");
>>> print ".";
>>> }
>>> }
>>> !
>>> print "\n";
>>> }
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 6: explain analyze is your friend
>>>

>
>


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-18-2008, 10:27 AM
Hannes Eder
 
Posts: n/a
Default Re: [HACKERS] msvc, build and install with cygwin in thePATH

Magnus Hagander schrieb:
> I used to have a different patch from Andrew that did part of this, and
> more, and conflicted rather badly with it. However, I never got around
> to applying that one, and I can't seem to find it anymore.
>
> Andrew -do you recall if you had all this in yours, and is it still
> something you want in, or should we just go with this one?
>

Do you want my to submit a patch against HEAD again?

-Hannes



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:30 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203