Re: Problem with MSVC install script - Mailing list pgsql-hackers
| From | Andrew Dunstan |
|---|---|
| Subject | Re: Problem with MSVC install script |
| Date | |
| Msg-id | 46F7F7F8.50705@dunslane.net Whole thread Raw |
| In response to | Re: Problem with MSVC install script ("Chuck McDevitt" <cmcdevitt@greenplum.com>) |
| List | pgsql-hackers |
Please see if the attached patch works.
cheers
andrew
Chuck McDevitt wrote:
> Of course it is better not to remove the readonly on all files in the
> target dir. That's just a workaround I did because it didn't involve
> changing the perl scripts.
> I don't know the "right" perl way to change the readonly attribute on a
> file. If there isn't one, you could have the perl code issue "attrib"
> commands on the target location for each file it is moving. Better if
> there is some more "perl" way to do this.
>
>
>> -----Original Message-----
>> From: Magnus Hagander [mailto:magnus@hagander.net]
>> Sent: Monday, September 24, 2007 12:33 AM
>> To: Chuck McDevitt
>> Cc: Andrew Dunstan; pgsql-hackers@postgresql.org
>> Subject: Re: [HACKERS] Problem with MSVC install script
>>
>> Hrrm. I wonder how likely that is, but I can see it's a problem.
>>
>> That said, it's probably not a bad idea to fix it anyway - it would
>> correspond to setting the permissions on a unix install, which we do.
>>
>> For the xcopy commansd, it should be easier to just add a /R switch.
>> But
>> most files are copied using the internal perl stuff - anybody know if
>> those
>> can be made to overwrite readonly files easily?
>>
>> Also, do we really want to remove the readonly file on all the files
>>
> in
>
>> the
>> target dir including subdirs? That may hit a bunch of files that
>>
> aren't
>
>> actualliy "ours". Perhaps we need to process it on a file-by-file
>> basis?
>>
>> //Magnus
>>
>> On Mon, Sep 24, 2007 at 02:59:54AM -0400, Chuck McDevitt wrote:
>>
>>> Well, I was checking out from a different cvs server, and had things
>>>
>> set
>>
>>> to use CVS EDIT, where everything is read-only by default, until you
>>> issue a cvs edit command.
>>> So many files that aren't built by the build system, but just get
>>>
>> copied
>>
>>> as-is, end up read-only.
>>>
>>> But it would be true for any files set read-only.
>>>
>>>
>>>> -----Original Message-----
>>>> From: Andrew Dunstan [mailto:andrew@dunslane.net]
>>>> Sent: Sunday, September 23, 2007 7:45 PM
>>>> To: Chuck McDevitt
>>>> Cc: pgsql-hackers@postgresql.org
>>>> Subject: Re: [HACKERS] Problem with MSVC install script
>>>>
>>>>
>>>>
>>>> Chuck McDevitt wrote:
>>>>
>>>>> I was trying out the msvc support, and ran into a minor problem
>>>>>
>> in
>>
>>>> the
>>>>
>>>>> install.bat/install.pl
>>>>>
>>>>> If any files that are going to be installed are marked
>>>>>
> read-only,
>
>>>> they
>>>>
>>>>> carry the read-only attribute with them when they get copied to
>>>>>
>> the
>>
>>>>> install dir.
>>>>>
>>>>> Then, if you try to run install again, the new attempt will fail
>>>>> because it can't overwrite the read-only file.
>>>>>
>>>>> I added this like to install.bat (just before the call to
>>>>>
>>> install.pl)
>>>
>>>>> to fix this for me:
>>>>>
>>>>> attrib /S -r %1\*
>>>>>
>>>>>
>>>> Which files are read-only?
>>>>
>>>> cheers
>>>>
>>>> andrew
>>>>
>>> ---------------------------(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
>>>
>
>
>
Index: Install.pm
===================================================================
RCS file: /cvsroot/pgsql/src/tools/msvc/Install.pm,v
retrieving revision 1.21
diff -c -r1.21 Install.pm
*** Install.pm 23 Sep 2007 20:32:40 -0000 1.21
--- Install.pm 24 Sep 2007 17:43:37 -0000
***************
*** 17,22 ****
--- 17,32 ----
@ISA = qw(Exporter);
@EXPORT_OK = qw(Install);
+ sub lcopy
+ {
+ my $src = shift;
+ my $target = shift;
+
+ unlink $target if -f $target;
+
+ copy($src,$target);
+ }
+
sub Install
{
$| = 1;
***************
*** 43,49 ****
'doc/contrib', 'symbols', 'share/tsearch_data');
CopySolutionOutput($conf, $target);
! copy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
my $sample_files = [];
File::Find::find({wanted =>
sub { /^.*\.sample\z/s &&
--- 53,59 ----
'doc/contrib', 'symbols', 'share/tsearch_data');
CopySolutionOutput($conf, $target);
! lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
my $sample_files = [];
File::Find::find({wanted =>
sub { /^.*\.sample\z/s &&
***************
*** 113,119 ****
print ".";
$f = $basedir . $f;
die "No file $f\n" if (!-f $f);
! copy($f, $target . basename($f))
|| croak "Could not copy $f to $target". basename($f). " to $target". basename($f) . "\n";
}
print "\n";
--- 123,129 ----
print ".";
$f = $basedir . $f;
die "No file $f\n" if (!-f $f);
! lcopy($f, $target . basename($f))
|| croak "Could not copy $f to $target". basename($f). " to $target". basename($f) . "\n";
}
print "\n";
***************
*** 131,137 ****
next if /ecpg.test/; # Skip temporary install in regression subdir
my $tgt = $target . basename($_);
print ".";
! copy($_, $tgt) || croak "Could not copy $_: $!\n";
}
print "\n";
}
--- 141,147 ----
next if /ecpg.test/; # Skip temporary install in regression subdir
my $tgt = $target . basename($_);
print ".";
! lcopy($_, $tgt) || croak "Could not copy $_: $!\n";
}
print "\n";
}
***************
*** 173,180 ****
# Static lib, such as libpgport, only used internally during build, don't install
next;
}
! copy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could not copy $pf.$ext\n";
! copy("$conf\\$pf\\$pf.pdb","$target\\symbols\\$pf.pdb") || croak "Could not copy $pf.pdb\n";
print ".";
}
print "\n";
--- 183,190 ----
# Static lib, such as libpgport, only used internally during build, don't install
next;
}
! lcopy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could not copy $pf.$ext\n";
! lcopy("$conf\\$pf\\$pf.pdb","$target\\symbols\\$pf.pdb") || croak "Could not copy $pf.pdb\n";
print ".";
}
print "\n";
***************
*** 297,303 ****
if ($d eq 'spi');
foreach my $f (split /\s+/,$flist)
{
! copy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
--- 307,313 ----
if ($d eq 'spi');
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
***************
*** 315,321 ****
if ($d eq 'spi');
foreach my $f (split /\s+/,$flist)
{
! copy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f)
|| croak("Could not copy file $f in contrib $d");
print '.';
}
--- 325,331 ----
if ($d eq 'spi');
foreach my $f (split /\s+/,$flist)
{
! lcopy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f)
|| croak("Could not copy file $f in contrib $d");
print '.';
}
***************
*** 359,365 ****
$target . '/include/',
'src/include/', 'postgres_ext.h', 'pg_config.h', 'pg_config_os.h', 'pg_config_manual.h'
);
! copy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/')
|| croak 'Could not copy libpq-fs.h';
CopyFiles('Libpq headers', $target . '/include/', 'src/interfaces/libpq/', 'libpq-fe.h');
--- 369,375 ----
$target . '/include/',
'src/include/', 'postgres_ext.h', 'pg_config.h', 'pg_config_os.h', 'pg_config_manual.h'
);
! lcopy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/')
|| croak 'Could not copy libpq-fs.h';
CopyFiles('Libpq headers', $target . '/include/', 'src/interfaces/libpq/', 'libpq-fe.h');
***************
*** 374,380 ****
$target . '/include/internal/',
'src/include/', 'c.h', 'port.h', 'postgres_fe.h'
);
! copy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/')
|| croak 'Could not copy pqcomm.h';
CopyFiles(
--- 384,390 ----
$target . '/include/internal/',
'src/include/', 'c.h', 'port.h', 'postgres_fe.h'
);
! lcopy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/')
|| croak 'Could not copy pqcomm.h';
CopyFiles(
pgsql-hackers by date: