Subversion Repositories DevTools

Rev

Rev 4676 | Rev 4740 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4676 Rev 4714
Line 883... Line 883...
883
#
883
#
884
# Inputs          : $src_dir    - Local to the user
884
# Inputs          : $src_dir    - Local to the user
885
#                                 Symbolic Name
885
#                                 Symbolic Name
886
#                   $dst_dir    - Within the output workspace
886
#                   $dst_dir    - Within the output workspace
887
#                   Options
887
#                   Options
888
#                       --Merge             - Don't delete first
888
#                       --Merge                 - Don't delete first
889
#                       --Source=Name       - Source via Symbolic Name
889
#                       --Source=Name           - Source via Symbolic Name
890
#                       --FromPackage       - Source via package roots
890
#                       --FromPackage           - Source via package roots
891
#                       --NoIgnoreDbgFiles  - Do not ignore .dbg and .debug files in dir copy
891
#                       --NoIgnoreDbgFiles      - Do not ignore .dbg and .debug files in dir copy
892
#                       --IfPresent         - Not an error if the path cannot be found
892
#                       --IfPresent             - Not an error if the path cannot be found
-
 
893
#                       --ConfFile              - Mark transferred files as config files
-
 
894
#                       --Flatten               - Copy all to one directory
-
 
895
#                       --FilterOut=xxx         - Ignore files. DOS Wildcard
-
 
896
#                       --FilterOutRe=xxx       - Ignore files. Regular expression name
-
 
897
#                       --FilterOutDir=xxx      - Ignore directories. DOS Wilcard
-
 
898
#                       --FilterOutDirRe=xxx    - Ignore directories. Regular expression name
-
 
899
#                       --SkipTLF               - Ignore files in the Top Level Directory
-
 
900
#                       --NoRecurse             - Only process files in the Top Level Directory
-
 
901
#                       --FilterIn=xxx          - Include files. DOS Wildcard
-
 
902
#                       --FilterInRe=xxx        - Include files. Regular expression name
-
 
903
#                       --FilterInDir=xxx       - Include directories. DOS Wilcard
-
 
904
#                       --FilterInDirRe=xxx     - Include directories. Regular expression name
893
#
905
#
894
# Returns         :
906
# Returns         :
895
#
907
#
896
sub CopyDir
908
sub CopyDir
897
{
909
{
898
    my ($src_dir, $dst_dir, @opts) = @_;
910
    my ($src_dir, $dst_dir, @opts) = @_;
899
    my $opt_merge;
-
 
900
    my $opt_base;
911
    my $opt_base;
901
    my $from_interface = 0;
912
    my $from_interface = 0;
902
    my $ignoreDbg = 1;
913
    my $ignoreDbg = 1;
903
    my $ignoreNoDir;
914
    my $ignoreNoDir;
904
    my $user_src_dir = $src_dir;
915
    my $user_src_dir = $src_dir;
905
    my $opt_source;
916
    my $opt_source;
906
    my $opt_package;
917
    my $opt_package;
-
 
918
    my @fileList;
-
 
919
    my $isFiltered;
-
 
920
 
-
 
921
    #
-
 
922
    #   Setup the basic copy options
-
 
923
    #       May be altered as we parse user options
-
 
924
    #
-
 
925
    my %copyOpts;
-
 
926
    $copyOpts{'IgnoreDirs'} = ['.svn', '.git', '.cvs', '.hg'];
-
 
927
    $copyOpts{'Ignore'} = ['.gbedir', '_gbedir'];
-
 
928
    $copyOpts{'Log'} = 1 if ( $opt_verbose > 1 );
907
 
929
 
908
    $dst_dir = $DebianWorkDir . '/' . $dst_dir;
930
    $dst_dir = $DebianWorkDir . '/' . $dst_dir;
909
    $dst_dir =~ s~//~/~;
931
    $dst_dir =~ s~//~/~;
910
 
932
 
911
    #
933
    #
Line 913... Line 935...
913
    #
935
    #
914
    foreach  ( @opts )
936
    foreach  ( @opts )
915
    {
937
    {
916
        Verbose2 ("CopyDir: $_");
938
        Verbose2 ("CopyDir: $_");
917
        if ( m/^--Merge/ ) {
939
        if ( m/^--Merge/ ) {
918
            $opt_merge = 1;
940
            $copyOpts{'DeleteFirst'} = 1;
919
 
941
 
920
        } elsif ( m/^--Source=(.+)/ ) {
942
        } elsif ( m/^--Source=(.+)/ ) {
921
            Error ("Source directory can only be specified once")
943
            Error ("Source directory can only be specified once")
922
                if ( defined $opt_source );
944
                if ( defined $opt_source );
923
            $opt_source = $1;
945
            $opt_source = $1;
Line 931... Line 953...
931
            $ignoreDbg = 0;
953
            $ignoreDbg = 0;
932
 
954
 
933
        } elsif ( m/^--IfPresent/ ) {
955
        } elsif ( m/^--IfPresent/ ) {
934
            $ignoreNoDir = 1;
956
            $ignoreNoDir = 1;
935
            
957
            
-
 
958
        } elsif ( m/^--ConfFile/i ) {
-
 
959
            $copyOpts{'FileList'} = \@fileList;
-
 
960
           
-
 
961
        } elsif ( m/^--Flatten/i ) {
-
 
962
            $copyOpts{'Flatten'} = 1;
-
 
963
 
-
 
964
        } elsif ( m/^--FilterOut=(.+)/i ) {
-
 
965
            push (@{$copyOpts{'Ignore'}}, $1);
-
 
966
            $isFiltered = 1;
-
 
967
 
-
 
968
        } elsif ( m/^--FilterOutRe=(.+)/i ) {
-
 
969
            push (@{$copyOpts{'IgnoreRE'}}, $1);
-
 
970
            $isFiltered = 1;
-
 
971
 
-
 
972
        } elsif ( m/^--FilterOutDir=(.+)/i ) {
-
 
973
            push (@{$copyOpts{'IgnoreDirs'}}, $1);
-
 
974
            $isFiltered = 1;
-
 
975
 
-
 
976
        } elsif ( m/^--FilterOutDirRe=(.+)/i ) {
-
 
977
            push (@{$copyOpts{'IgnoreDirsRE'}}, $1);
-
 
978
            $isFiltered = 1;
-
 
979
 
-
 
980
        } elsif ( m/^--FilterIn=(.+)/i ) {
-
 
981
            push (@{$copyOpts{'Match'}}, $1);
-
 
982
            $isFiltered = 1;
-
 
983
 
-
 
984
        } elsif ( m/^--FilterInRe=(.+)/i ) {
-
 
985
            push (@{$copyOpts{'MatchRE'}}, $1);
-
 
986
            $isFiltered = 1;
-
 
987
 
-
 
988
        } elsif ( m/^--FilterInDir=(.+)/i ) {
-
 
989
            push (@{$copyOpts{'MatchDirs'}}, $1);
-
 
990
            $isFiltered = 1;
-
 
991
 
-
 
992
        } elsif ( m/^--FilterInDirRe=(.+)/i ) {
-
 
993
            push (@{$copyOpts{'MatchDirsRE'}}, $1);
-
 
994
            $isFiltered = 1;
-
 
995
 
-
 
996
        } elsif ( m/^--SkipTLF$/i ) {
-
 
997
            $copyOpts{'SkipTLF'} = 1;
-
 
998
 
-
 
999
        } elsif ( m/^--NoRecurse$/i ) {
-
 
1000
            $copyOpts{'NoSubDirs'} = 1;
-
 
1001
 
936
        } else {
1002
        } else {
937
            Error ("CopyDir: Unknown option: $_" );
1003
            Error ("CopyDir: Unknown option: $_" );
938
        }
1004
        }
939
    }
1005
    }
940
 
1006
 
Line 1026... Line 1092...
1026
 
1092
 
1027
    }
1093
    }
1028
 
1094
 
1029
    #
1095
    #
1030
    #   Create the full source path
1096
    #   Create the full source path
1031
    #   May be: from a package, from a known directoru, from a local directory
1097
    #   May be: from a package, from a known directory, from a local directory
1032
    #
1098
    #
1033
 
1099
 
1034
    $src_dir = $opt_base . '/' . $src_dir if ( $opt_base );
1100
    $src_dir = $opt_base . '/' . $src_dir if ( $opt_base );
1035
    $src_dir =~ s~//~/~g;
1101
    $src_dir =~ s~//~/~g;
1036
    $src_dir =~ s~/$~~;
1102
    $src_dir =~ s~/$~~;
Line 1042... Line 1108...
1042
        Message ("CopyDir: Optional path not found: $user_src_dir");
1108
        Message ("CopyDir: Optional path not found: $user_src_dir");
1043
        return;
1109
        return;
1044
    }
1110
    }
1045
 
1111
 
1046
    #
1112
    #
1047
    #   Setup the copy options
1113
    #   Continue to configure the copy options
1048
    #
1114
    #
1049
    my %copyOpts;
-
 
1050
    $copyOpts{'IgnoreDirs'} = ['.svn', '.git', '.cvs', '.hg'];
-
 
1051
    $copyOpts{'Ignore'} = ['.gbedir', '_gbedir'];
-
 
1052
    push (@{$copyOpts{'Ignore'}}, '*.debug', '*.dbg') if $ignoreDbg;
1115
    push (@{$copyOpts{'Ignore'}}, '*.debug', '*.dbg') if $ignoreDbg;
1053
    $copyOpts{'EmptyDirs'} = 1;
-
 
1054
    $copyOpts{'DeleteFirst'} = 1 unless $opt_merge;
-
 
1055
    $copyOpts{'Log'} = 1 if ( $opt_verbose > 1 );
-
 
1056
    $copyOpts{'DuplicateLinks'} = 1 unless ( $from_interface );
1116
    $copyOpts{'DuplicateLinks'} = 1 unless ( $from_interface );
-
 
1117
    $copyOpts{'EmptyDirs'} = 1 unless ($isFiltered);
1057
 
1118
 
1058
    #
1119
    #
1059
    #   Transfer the directory
1120
    #   Transfer the directory
1060
    #
1121
    #
1061
    JatsCopy::CopyDir ( $src_dir, $dst_dir, \%copyOpts );
1122
    JatsCopy::CopyDir ( $src_dir, $dst_dir, \%copyOpts );
1062
 
1123
 
1063
    #
1124
    #
-
 
1125
    #   If requested, mark files as config files
-
 
1126
    #   Must remove the DebianWorkDir prefix
-
 
1127
    #
-
 
1128
    if(@fileList)
-
 
1129
    {
-
 
1130
        Verbose ("Mark all transfered files as ConfFiles");
-
 
1131
        my $removePrefix = length ($DebianWorkDir);
-
 
1132
        foreach my $file (@fileList)
-
 
1133
        {
-
 
1134
            push @ConfigList, substr($file, $removePrefix);
-
 
1135
        }
-
 
1136
    }
-
 
1137
 
-
 
1138
    #
1064
    #   Expand link files that may have been copied in
1139
    #   Expand link files that may have been copied in
1065
    #
1140
    #
1066
    Verbose ("Locate LINKFILES in $DebianWorkDir");
1141
    Verbose ("Locate LINKFILES in $DebianWorkDir");
1067
    ExpandLinkFiles();
1142
    ExpandLinkFiles();
1068
}
1143
}
Line 1452... Line 1527...
1452
    #   Convert Tags into pairs for latter use
1527
    #   Convert Tags into pairs for latter use
1453
    #
1528
    #
1454
    my $sep = quotemeta ($tagSep );
1529
    my $sep = quotemeta ($tagSep );
1455
    foreach my $tag ( @tagsList )
1530
    foreach my $tag ( @tagsList )
1456
    {
1531
    {
1457
        my ($tname,$tvalue) = split ( $sep, $tag );
1532
        my ($tname,$tvalue) = split ( $sep, $tag, 2 );
1458
        Error ("No tag value in: $tag" ) unless ( defined $tvalue );
1533
        Error ("No tag value in: $tag" ) unless ( defined $tvalue );
1459
        Error ("Duplicate Tag: $tname" ) if ( exists $tagData{$tname} );
1534
        Error ("Duplicate Tag: $tname" ) if ( exists $tagData{$tname} );
1460
        Verbose ("Tag: $tname :: $tvalue");
1535
        Verbose ("Tag: $tname :: $tvalue");
1461
        push @tagOrder, $tname;
1536
        push @tagOrder, $tname;
1462
        $tagData{$tname} = $tvalue;
1537
        $tagData{$tname} = $tvalue;