Subversion Repositories DevTools

Rev

Rev 6192 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6192 Rev 6198
Line 44... Line 44...
44
my @opt_addFilters;
44
my @opt_addFilters;
45
my @opt_delFilters;
45
my @opt_delFilters;
46
my $opt_showFiles;
46
my $opt_showFiles;
47
my @opt_addFiles;
47
my @opt_addFiles;
48
my @opt_delFiles;
48
my @opt_delFiles;
-
 
49
my $opt_symlinks;
49
 
50
 
50
 
51
 
51
#
52
#
52
#   Constants
53
#   Constants
53
#
54
#
Line 86... Line 87...
86
                "help:+"            => \$opt_help,              # flag, multiple use allowed
87
                "help:+"            => \$opt_help,              # flag, multiple use allowed
87
                "manual:3"          => \$opt_help,              # flag, multiple use allowed
88
                "manual:3"          => \$opt_help,              # flag, multiple use allowed
88
                "verbose:+"         => \$opt_verbose,           # flag
89
                "verbose:+"         => \$opt_verbose,           # flag
89
                "rtagid|rtag_id=s"  => \$opt_rtagid,            # Number
90
                "rtagid|rtag_id=s"  => \$opt_rtagid,            # Number
90
                "rootdir=s"         => \$opt_rootdir,           # string
91
                "rootdir=s"         => \$opt_rootdir,           # string
-
 
92
                "symlinks!"         => \$opt_symlinks,          # Boolean
91
 
93
 
92
                "addfilter=s"       => \@opt_addFilters,        # multiple strings
94
                "addfilter=s"       => \@opt_addFilters,        # multiple strings
93
                "delfilter=s"       => \@opt_delFilters,        # multiple strings
95
                "delfilter=s"       => \@opt_delFilters,        # multiple strings
94
                "showfilters"       => \$opt_showFilters,       # flag
96
                "showfilters"       => \$opt_showFilters,       # flag
95
 
97
 
Line 147... Line 149...
147
my $now = time;
149
my $now = time;
148
$bomInfo->{version} = "2.0.0";
150
$bomInfo->{version} = "2.0.0";
149
$bomInfo->{timestamp}{epoch} = $now;
151
$bomInfo->{timestamp}{epoch} = $now;
150
$bomInfo->{timestamp}{utc} = gmtime($now);
152
$bomInfo->{timestamp}{utc} = gmtime($now);
151
 
153
 
152
Message("Copying packages from $ENV{GBE_DPKG} to $opt_rootdir");
154
Message("Copying packages from $ENV{GBE_DPKG} to $opt_rootdir") unless $opt_symlinks;
-
 
155
Message("Symlink packages from $opt_rootdir to $ENV{GBE_DPKG}") if $opt_symlinks;
153
 
156
 
154
#
157
#
155
#   Processing
158
#   Processing
156
#
159
#
157
connectRM(\$DM_DB);
160
connectRM(\$DM_DB);
Line 290... Line 293...
290
#-------------------------------------------------------------------------------
293
#-------------------------------------------------------------------------------
291
# Function        : CopyInNew 
294
# Function        : CopyInNew 
292
#
295
#
293
# Description     : Copy in new files
296
# Description     : Copy in new files
294
#                   Don't copy in files that already exist - assume that the
297
#                   Don't copy in files that already exist - assume that the
295
#                   files don't chnage without a chnage to the file name
298
#                   files don't change without a chnage to the file name
296
#
299
#
297
# Inputs          : 
300
# Inputs          : 
298
#
301
#
299
# Returns         : 
302
# Returns         : 
300
#
303
#
Line 346... Line 349...
346
        {
349
        {
347
            eval { mkpath($opt_rootdir) };
350
            eval { mkpath($opt_rootdir) };
348
            Error("Failed to make destination directory") if ( $@ || ! -d $opt_rootdir );
351
            Error("Failed to make destination directory") if ( $@ || ! -d $opt_rootdir );
349
            foreach my $file ( @filelist )
352
            foreach my $file ( @filelist )
350
            {
353
            {
351
                Verbose("Copy: $file...");
-
 
352
 
-
 
353
                my $srcFile = $bomList{$file}{path};
354
                my $srcFile = $bomList{$file}{path};
354
                if ( ! copy($srcFile, $opt_rootdir) )
355
                if ($opt_symlinks)
355
                {
356
                {
-
 
357
                   Verbose("Symlink: $file");
-
 
358
                   my $fname = catdir( $opt_rootdir, StripDir($srcFile));
-
 
359
                    if ( ! symlink ($srcFile, $fname) )
-
 
360
                    {
-
 
361
                        Warning("Failed to symlink $file ($!)");
-
 
362
                    }
-
 
363
 
-
 
364
                }
-
 
365
                else
-
 
366
                {
-
 
367
                    Verbose("Copy: $file");
-
 
368
                    if ( ! copy($srcFile, $opt_rootdir) )
-
 
369
                    {
356
                    Warning("Failed to copy $file ($!)");
370
                        Warning("Failed to copy $file ($!)");
-
 
371
                    }
357
                }
372
                }
358
            }
373
            }
359
        }
374
        }
360
    }
375
    }
361
}
376
}
Line 789... Line 804...
789
                        # for each of the filter rules we glob the rule in the src pkg/version dir
804
                        # for each of the filter rules we glob the rule in the src pkg/version dir
790
                        # and if any of the globbed files dont exist in the dst dir add it to the 
805
                        # and if any of the globbed files dont exist in the dst dir add it to the 
791
                        # the filelist array of files to copy
806
                        # the filelist array of files to copy
792
                        foreach my $filter ( @confFilters )
807
                        foreach my $filter ( @confFilters )
793
                        {
808
                        {
-
 
809
                            next if ( $filter =~ m~^--~ );
794
                            foreach my $srcPath ( glob("$srcDir/$filter") )
810
                            foreach my $srcPath ( glob("$srcDir/$filter") )
795
                            {
811
                            {
796
                                next unless ( -f $srcPath );
812
                                next unless ( -f $srcPath );
-
 
813
                                next unless testExcluded ($srcPath);
797
                                $foundFiltered = 1;
814
                                $foundFiltered = 1;
798
                                $filtersUsed{$filter} = 1;
815
                                $filtersUsed{$filter} = 1;
799
                                my $dstFile = basename($srcPath);
816
                                my $dstFile = basename($srcPath);
800
                                my $srcFile = $srcPath;
817
                                my $srcFile = $srcPath;
801
                                ReportError("File provided by multiple packages: $dstFile") if exists ($bomList{$dstFile});
818
                                ReportError("File provided by multiple packages: $dstFile") if exists ($bomList{$dstFile});
Line 874... Line 891...
874
 
891
 
875
    ErrorDoExit();
892
    ErrorDoExit();
876
}
893
}
877
 
894
 
878
#-------------------------------------------------------------------------------
895
#-------------------------------------------------------------------------------
-
 
896
# Function        : testExcluded 
-
 
897
#
-
 
898
# Description     : Test a filename against the list of exclusion list 
-
 
899
#
-
 
900
# Inputs          : filename 
-
 
901
#
-
 
902
# Returns         : true - not excluded
-
 
903
#
-
 
904
sub testExcluded
-
 
905
{
-
 
906
    my ($filename) = @_;
-
 
907
    foreach my $ufilter ( @confFilters )
-
 
908
    {
-
 
909
        next unless ( $ufilter =~ m~^--(.*)~ );
-
 
910
        my $filter = glob2pat($1);
-
 
911
        if ( $filename =~ m~$filter~)
-
 
912
        {
-
 
913
            $filtersUsed{$ufilter} = 1;
-
 
914
            return 0;
-
 
915
        }
-
 
916
    }
-
 
917
 
-
 
918
    return 1;
-
 
919
}
-
 
920
 
-
 
921
#-------------------------------------------------------------------------------
-
 
922
# Function        : glob2pat
-
 
923
#
-
 
924
# Description     : Convert four shell wildcard characters into their equivalent
-
 
925
#                   regular expression; all other characters are quoted to
-
 
926
#                   render them literals.
-
 
927
#
-
 
928
# Inputs          : Shell style wildcard pattern
-
 
929
#
-
 
930
# Returns         : Perl RE
-
 
931
#
-
 
932
 
-
 
933
sub glob2pat
-
 
934
{
-
 
935
    my $globstr = shift;
-
 
936
    $globstr =~ s~^/~~;
-
 
937
    my %patmap = (
-
 
938
        '*' => '[^/]*',
-
 
939
        '?' => '[^/]',
-
 
940
        '[' => '[',
-
 
941
        ']' => ']',
-
 
942
        '-' => '-',
-
 
943
    );
-
 
944
    $globstr =~ s{(.)} { $patmap{$1} || "\Q$1" }ge;
-
 
945
    return '/' . $globstr . '$';
-
 
946
}
-
 
947
 
-
 
948
 
-
 
949
#-------------------------------------------------------------------------------
879
#   Documentation
950
#   Documentation
880
#
951
#
881
 
952
 
882
=pod
953
=pod
883
 
954
 
Line 896... Line 967...
896
    -help                   - Brief help message
967
    -help                   - Brief help message
897
    -help -help             - Detailed help message
968
    -help -help             - Detailed help message
898
    -man                    - Full documentation
969
    -man                    - Full documentation
899
    -rtagid=xxx             - Specify the Release Manager RtagId to process
970
    -rtagid=xxx             - Specify the Release Manager RtagId to process
900
    -rootdir=xxx            - Specifies the root of the releases directory
971
    -rootdir=xxx            - Specifies the root of the releases directory
-
 
972
    -[no]symlinks           - Use symlinks to dpkg_archive
901
 
973
 
902
    -showfilters            - Display current filter set and exit
974
    -showfilters            - Display current filter set and exit
903
    -addfilter=xxx[,yyy]    - Add a new filter to the existing filter set
975
    -addfilter=xxx[,yyy]    - Add a new filter to the existing filter set
904
    -delfilter=xxx[,yyy]    - Delete a filter from the existing filter set
976
    -delfilter=xxx[,yyy]    - Delete a filter from the existing filter set
905
 
977
 
Line 939... Line 1011...
939
 
1011
 
940
The specified directory must exist.
1012
The specified directory must exist.
941
 
1013
 
942
The default value is the current directory.
1014
The default value is the current directory.
943
 
1015
 
-
 
1016
=item B<[no]symlinks>
-
 
1017
 
-
 
1018
This option will cause symlinks to packages to be used in place of actual packages
-
 
1019
 
944
=item B<-showfilters>
1020
=item B<-showfilters>
945
 
1021
 
946
This option will display the current filter set. If it is combined with another filter operation 
1022
This option will display the current filter set. If it is combined with another filter operation 
947
then the other operations will be performed before the display.
1023
then the other operations will be performed before the display.
948
 
1024
 
Line 960... Line 1036...
960
and packages are copied to the project/release directory.  These values are then written to a 
1036
and packages are copied to the project/release directory.  These values are then written to a 
961
config file in the release directory so the same values can be used on subsequent runs.  
1037
config file in the release directory so the same values can be used on subsequent runs.  
962
In these subsequent runs this option need not be specified as the config items will be used, however
1038
In these subsequent runs this option need not be specified as the config items will be used, however
963
they can be changed by specifying them again on the command line and the config will be re-written.
1039
they can be changed by specifying them again on the command line and the config will be re-written.
964
 
1040
 
-
 
1041
A filter that begins with a '--' will exclude files. The filter may contain shell wildcards. It is not a reguar expression.
-
 
1042
 
965
The values of these will depend on what builds are required for each project.  Some examples are
1043
The values of these will depend on what builds are required for each project.  Some examples are
966
    --filter='*-WIN32.exe,*.deb'
1044
    --filter='*-WIN32.exe,*.deb,--*COBRA.deb'
967
 
1045
 
968
=item B<-delFilter=xxx[,yyy]>
1046
=item B<-delFilter=xxx[,yyy]>
969
 
1047
 
970
This option deletes one or more filter rules from an existing set of filters. This
1048
This option deletes one or more filter rules from an existing set of filters. This
971
option can be specified multiple times.
1049
option can be specified multiple times.