Subversion Repositories DevTools

Rev

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

Rev 6177 Rev 6192
Line 209... Line 209...
209
            $data->{version} = $2;
209
            $data->{version} = $2;
210
            $data->{prj} = $3;
210
            $data->{prj} = $3;
211
            $data->{arch} = $4;
211
            $data->{arch} = $4;
212
            $data->{type} = $5;
212
            $data->{type} = $5;
213
            $data->{arch} =~ s~_[PD]~~;
213
            $data->{arch} =~ s~_[PD]~~;
-
 
214
            $alias = join('.', $data->{name}, $data->{prj}, $data->{arch}, $data->{type} );
-
 
215
        }
-
 
216
        elsif ( $file =~ m~^(.*)-(.*)-(.*)\.(.*)\.(rpm)$~i)
-
 
217
        {
-
 
218
            $data->{name} = $1;
-
 
219
            $data->{version} = $2;
-
 
220
            $data->{release} = $3;
-
 
221
            $data->{arch} = $4;
-
 
222
            $data->{type} = $5;
-
 
223
            $alias = join('.', $data->{name}, $data->{arch}, $data->{type} );
214
        }
224
        }
215
        elsif ( $file =~ m~^(.*)-($pv)\.(.*)\.(rpm)$~i)
225
        elsif ( $file =~ m~^(.*)-($pv)\.(.*)\.(rpm)$~i)
216
        {
226
        {
217
            # COTS package
227
            # COTS package
218
            $data->{name} = $1;
228
            $data->{name} = $1;
Line 247... Line 257...
247
 
257
 
248
            $data->{version} = $pvfull;
258
            $data->{version} = $pvfull;
249
            $data->{prj} = $proj;
259
            $data->{prj} = $proj;
250
        }
260
        }
251
 
261
 
252
        unless ($data && $data->{name} && $data->{prj} && $data->{type}) {
262
        unless (($data && $data->{name} && $data->{prj} && $data->{type}) || $alias) {
253
            push @elist, $file;
263
            push @elist, $file;
254
            next;
264
            next;
255
        }
265
        }
256
        $data->{fullname} = $file;
266
        $data->{fullname} = $file;
257
 
267
 
258
        #
268
        #
259
        #   Create a nice alias
269
        #   Create a nice alias
260
        #       ERG -> VIX  (not done)
270
        #       ERG -> VIX  (not done)
261
        #       All lowercase
271
        #       All lowercase
262
        #
272
        #
263
        $alias = join ('.', $data->{name}, $data->{prj}, $data->{type});
273
        $alias = join ('.', $data->{name}, $data->{prj}, $data->{type} ) unless defined $alias;
264
        $alias = lc ($alias);
274
        $alias = lc ($alias);
265
        #$alias =~ s~^erg~vix~;
275
        #$alias =~ s~^erg~vix~;
266
        #$alias =~ s~^vix~vix-~;
276
        #$alias =~ s~^vix~vix-~;
267
        #$alias =~ s~^vix--~vix-~;
277
        #$alias =~ s~^vix--~vix-~;
268
        push (@edup, join( ' : ', $alias, $file ,$bomInfo->{files}{$alias}{fullname})  ) if exists $bomInfo->{files}{$alias};
278
        push (@edup, join( ' : ', $alias, $file ,$bomInfo->{files}{$alias}{fullname})  ) if exists $bomInfo->{files}{$alias};
269
 
279
 
270
        delete $data->{type};
280
        delete $data->{type};
271
        $bomInfo->{files}{$alias} = $data;
281
        $bomInfo->{files}{$alias} = $data;
-
 
282
#Debug0("Alias: $file-> $alias");
272
    }
283
    }
273
 
284
 
274
    ReportError ("Cannot extract file metadata from:", @elist)  if (@elist);
285
    ReportError ("Cannot extract file metadata from:", @elist)  if (@elist);
275
    ReportError ("Duplicate aliases for:", @edup)  if (@edup);
286
    ReportError ("Duplicate aliases for:", @edup)  if (@edup);
276
    ErrorDoExit();
287
    ErrorDoExit();
Line 377... Line 388...
377
        push (@filelist, $dstFile) unless (exists $bomList{$dstFile} );
388
        push (@filelist, $dstFile) unless (exists $bomList{$dstFile} );
378
    }
389
    }
379
 
390
 
380
    if ( @filelist)
391
    if ( @filelist)
381
    {
392
    {
382
        #Message ("Delete execess files", @filelist );
393
        Verbose ("Delete execess files", @filelist );
383
        unless ( defined($opt_test) )
394
        unless ( defined($opt_test) )
384
        {
395
        {
385
            foreach my $file ( @filelist )
396
            foreach my $file ( @filelist )
386
            {
397
            {
387
                Verbose("Delete: $file...");
398
                Verbose2("Delete: $file...");
388
                if ( unlink("$opt_rootdir/$file") ne 1 )
399
                if ( unlink("$opt_rootdir/$file") ne 1 )
389
                {
400
                {
390
                    Warning("Failed to delete: $file. ($!)");
401
                    Warning("Failed to delete: $file. ($!)");
391
                }
402
                }
392
            }
403
            }
Line 785... Line 796...
785
                                next unless ( -f $srcPath );
796
                                next unless ( -f $srcPath );
786
                                $foundFiltered = 1;
797
                                $foundFiltered = 1;
787
                                $filtersUsed{$filter} = 1;
798
                                $filtersUsed{$filter} = 1;
788
                                my $dstFile = basename($srcPath);
799
                                my $dstFile = basename($srcPath);
789
                                my $srcFile = $srcPath;
800
                                my $srcFile = $srcPath;
790
                                $srcFile =~ s~^$srcDir/~~;
801
                                ReportError("File provided by multiple packages: $dstFile") if exists ($bomList{$dstFile});
791
                                $bomList{$srcFile}{path} = $srcPath;
802
                                $bomList{$dstFile}{path} = $srcPath;
792
                                $bomList{$srcFile}{package} = $PKG_NAME;
803
                                $bomList{$dstFile}{package} = $PKG_NAME;
793
                                $bomList{$srcFile}{version} = $PKG_VERSION;
804
                                $bomList{$dstFile}{version} = $PKG_VERSION;
794
                                $bomList{$srcFile}{license} = $LICENSE || '';
805
                                $bomList{$dstFile}{license} = $LICENSE || '';
795
                            }
806
                            }
796
                        }
807
                        }
797
 
808
 
798
                        # if no files found using filters then issue warning
809
                        # if no files found using filters then issue warning
799
                        Warning("No Files found for Package Version $PKG_NAME/$PKG_VERSION using supplied filters") 
810
                        Warning("No Files found for Package Version $PKG_NAME/$PKG_VERSION using supplied filters") 
Line 858... Line 869...
858
    }
869
    }
859
    Message ("Commercial software packages:", @Commercial);
870
    Message ("Commercial software packages:", @Commercial);
860
    my $data;
871
    my $data;
861
    $data->{COTS} = \@Commercial;
872
    $data->{COTS} = \@Commercial;
862
    WriteJsonFile ("$opt_rootdir/$BOMFILE", $data);
873
    WriteJsonFile ("$opt_rootdir/$BOMFILE", $data);
-
 
874
 
-
 
875
    ErrorDoExit();
863
}
876
}
864
 
877
 
865
#-------------------------------------------------------------------------------
878
#-------------------------------------------------------------------------------
866
#   Documentation
879
#   Documentation
867
#
880
#