Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1477626 Details for
Bug 1619740
Many missing component references across multiple .wxi files
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Script for detecting missing component / group references
check-deps.pl (text/plain), 4.62 KB, created by
Daniel Berrangé
on 2018-08-21 15:38:53 UTC
(
hide
)
Description:
Script for detecting missing component / group references
Filename:
MIME Type:
Creator:
Daniel Berrangé
Created:
2018-08-21 15:38:53 UTC
Size:
4.62 KB
patch
obsolete
>#!/usr/bin/perl > >use strict; >use warnings; > >use XML::XPath; >use XML::XPath::XMLParser; > ># WXI Filename -> group name >my %filegroups; > ># Group name -> dict ( array of component groups, array of component hashes ) >my %groups; > ># Component hash -> file path >my %components; > ># DLL file name -> component hash >my %dllcomponents; ># DLL file name -> group name >my %dllgroups; > >my @includes; > >my %dllbuiltin = ( > "advapi32.dll" => 1, > "comctl32.dll" => 1, > "comdlg32.dll" => 1, > "crypt32.dll" => 1, > "d3d9.dll" => 1, > "dnsapi.dll" => 1, > "dsound.dll" => 1, > "dwmapi.dll" => 1, > "gdi32.dll" => 1, > "gdiplus.dll" => 1, > "imm32.dll" => 1, > "iphlpapi.dll" => 1, > "kernel32.dll" => 1, > "msimg32.dll" => 1, > "msvcrt.dll" => 1, > "mswsock.dll" => 1, > "ole32.dll" => 1, > "oleaut32.dll" => 1, > "opengl32.dll" => 1, > "setupapi.dll" => 1, > "shell32.dll" => 1, > "user32.dll" => 1, > "usp10.dll" => 1, > "winmm.dll" => 1, > "winspool.drv" => 1, > "wldap32.dll" => 1, > "ws2_32.dll" => 1, >); > >my @checkgroups; >foreach my $file (@ARGV) { > push @checkgroups, &load($file); >} > >foreach my $group (@checkgroups) { > my %allowedcomps; > &expand($group, \%allowedcomps); > &check($group, \%allowedcomps); >} > >sub load { > my $file = shift; > > if (exists $filegroups{$file}) { > return $filegroups{$file}; > } > > open XML, "$file" or die "cannot read $file: $!"; > > foreach (<XML>) { > if (/<\?require (\S+)\?>/) { > my $incname = $1; > my $path = $file; > $path =~ s,/[^/]+$,/,; > my $incfile = $path . $incname; > &load($incfile); > } > } > > close XML; > > my $xp = XML::XPath->new(filename => $file); > my $nodeset; > > $nodeset = eval { $xp->find("//ComponentGroup"); }; > if ($@) { > print STDERR "Parsing failed on $file: $@\n"; > return; > } > > my $cg = $nodeset->[0]; > > my $cgid = $cg->getAttribute("Id"); > $groups{$cgid} = { > "file" => $file, > "groups" => [], > "components" => [], > }; > foreach my $child ($cg->getChildNodes()) { > > next unless defined $child->getName(); > > if ($child->getName() eq "ComponentRef") { > push @{$groups{$cgid}->{components}}, $child->getAttribute("Id"); > } else { > push @{$groups{$cgid}->{groups}}, $child->getAttribute("Id"); > } > } > > $nodeset = eval { $xp->find("//Component"); }; > if ($@) { > print STDERR "Parsing failed on $file: $@\n"; > return; > } > > my $errors = 0; > foreach my $node ($nodeset->get_nodelist) { > my $id = $node->getAttribute("Id"); > > foreach my $child ($node->getChildNodes()) { > next unless defined $child->getName() && $child->getName() eq "File"; > > my $fname = $child->getAttribute("Source"); > > my $msifile32 = $fname; > my $msifile64 = $fname; > $msifile32 =~ s,\$\(var.SourceDir\),/usr/i686-w64-mingw32/sys-root/mingw,; > $msifile64 =~ s,\$\(var.SourceDir\),/usr/x86_64-w64-mingw32/sys-root/mingw,; > > $msifile32 =~ s,\$\(var\.GLIB_ARCH\),win32,; > $msifile64 =~ s,\$\(var\.GLIB_ARCH\),win64,; > > $components{$id} = [] unless exists $components{$id}; > push @{$components{$id}}, $msifile32 unless $fname =~ /libgcc_s_seh-1\.dll/; > push @{$components{$id}}, $msifile64 unless $fname =~ /libgcc_s_sjlj-1\.dll/; > > if ($fname =~ m,.*/([^/]+.dll)$,) { > my $dllname = lc $1; > $dllcomponents{$dllname} = $id; > $dllgroups{$dllname} = $cgid; > } > } > } > > $filegroups{$file} = $cgid; > > return $cgid; >} > >sub expand { > my $name = shift; > my $allowed = shift; > > foreach (@{$groups{$name}->{components}}) { > $allowed->{$_} = 1; > } > foreach my $ref (@{$groups{$name}->{groups}}) { > &expand($ref, $allowed); > } >} > >sub check { > my $name = shift; > my $allowed = shift; > > print $name, " (", $groups{$name}->{file}, ")\n"; > > foreach my $comp (@{$groups{$name}->{components}}) { > #print "$comp\n"; > my @files = @{$components{$comp}}; > > foreach my $file (@files) { > next unless $file =~ /\.(exe|dll)$/; > > my $problems = 0; > > unless (-f $file) { > print " > $file\n" if ++$problems == 1; > print " - Cannot analyse missing file $file\n"; > next; > } > > open OBJ, "x86_64-w64-mingw32-objdump -p $file |"; > foreach my $info (<OBJ>) { > next unless $info =~ /DLL Name: (\S+)/; > my $dllname = lc $1; > next if exists $dllbuiltin{$dllname}; > > unless (exists $dllcomponents{$dllname}) { > print " > $file\n" if ++$problems == 1; > print " - Unknown component for $dllname\n"; > next; > } > > my $dllcomp = $dllcomponents{$dllname}; > > next if exists $allowed->{$dllcomp}; > > my $dllgroup = $dllgroups{$dllname}; > > print " > $file\n" if ++$problems == 1; > print " - Missing group ref $dllgroup for $dllname\n"; > } > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1619740
: 1477626 |
1477627