Changeset 802 for dasscm/trunk


Ignore:
Timestamp:
Nov 11, 2009, 1:30:06 PM (15 years ago)
Author:
joergs
Message:

replaced File::Copy by system("cp -a") to keep permissions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dasscm/trunk/dasscm

    r801 r802  
    1111use File::Basename;
    1212use File::Compare;
    13 use File::Copy;
     13# used system("cp -a"), because File::Copy does not keep permissions
     14#use File::Copy;
    1415use File::Find;
    1516use File::stat;
     
    373374    ) = get_filenames($filename);
    374375
    375     # TODO: are permissions also copied?
    376     copy( $filename_prod, $filename_repo )
    377       or error "failed to copy $filename_prod to repository: $!";
    378 }
     376    #copy( $filename_prod, $filename_repo )
     377    ( my $rc, my @result ) = run_command( "cp -a $filename_prod $filename_repo" );
     378    if( $rc != 0 ) {
     379        error( "failed to copy $filename_prod to repository: ", @result );
     380    }
     381
     382    # return success
     383    return $rc == 0;
     384}
     385
     386
     387
     388sub copy_file_from_repository_to_system( $ )
     389{
     390    my $filename = shift;
     391
     392    (
     393        my $basename,
     394        my $dirname_prod,
     395        my $dirname_repo,
     396        my $filename_prod,
     397        my $filename_repo
     398    ) = get_filenames($filename);
     399
     400    ( my $rc, my @result ) = run_command( "cp -a $filename_repo $filename_prod" );
     401    if( $rc != 0 ) {
     402        error( "failed to copy $filename_repo to $filename_prod: ", @result );
     403    }
     404
     405    # return success
     406    return $rc == 0;
     407}
     408
     409
    379410
    380411#
     
    869900
    870901    mkpath($dirname_repo);
    871 
    872     # TODO: are permissions also copied?
    873     copy( $filename_prod, $filename_repo )
    874       or error "failed to copy $filename_prod to repository: $!";
     902    copy_file_to_repository( $filename_prod );
    875903
    876904    # already checked in?
     
    10681096                    mkpath("$real_path");
    10691097                } else {
    1070                     copy( $removedfiles{"$real_path"}, $real_path )
    1071                       or error( "failed to copy "
    1072                           . $removedfiles{"$real_path"} . " to "
    1073                           . $real_path . ": "
    1074                           . $! );
     1098                    copy_file_from_repository_to_system( $real_path );
    10751099                }
    10761100            }
     
    10831107            # copy files one by one from local repository to system
    10841108            for my $real_file ( keys(%changedfiles) ) {
    1085                 copy( $changedfiles{"$real_file"}, $real_file );
     1109                copy_file_from_repository_to_system( $real_file );
    10861110            }
    10871111
Note: See TracChangeset for help on using the changeset viewer.