[mingw-crossreport: 3/15] Include the update script.
epienbro
epienbro at fedoraproject.org
Wed Mar 7 16:18:41 UTC 2012
commit f24ad4fdf05577c9b24b096657320376acaa2eb1
Author: Richard W.M. Jones <rjones at fedoraproject.org>
Date: Fri Feb 13 09:24:47 2009 +0000
Include the update script.
mingw32-crossreport.spec | 6 +++-
update-crossreport-db.pl | 88 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 1 deletions(-)
---
diff --git a/mingw32-crossreport.spec b/mingw32-crossreport.spec
index 3e04931..422835c 100644
--- a/mingw32-crossreport.spec
+++ b/mingw32-crossreport.spec
@@ -1,5 +1,5 @@
Name: mingw32-crossreport
-Version: 3
+Version: 4
Release: 1%{?dist}
Summary: Analysis tool to help cross-compilation to Windows
@@ -10,6 +10,7 @@ Source0: crossreport.pl
Source1: README
Source2: COPYING
Source3: crossreport.db
+Source4: update-crossreport-db.pl
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -78,5 +79,8 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Fri Feb 13 2009 Richard W.M. Jones <rjones at redhat.com> - 4-1
+- Include the update script.
+
* Wed Feb 11 2009 Richard W.M. Jones <rjones at redhat.com> - 3-1
- Initial RPM release.
diff --git a/update-crossreport-db.pl b/update-crossreport-db.pl
new file mode 100755
index 0000000..628510c
--- /dev/null
+++ b/update-crossreport-db.pl
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+#
+# Update CrossReport database.
+# Copyright (C) 2009 Red Hat Inc.
+# Written by Richard W.M. Jones <rjones at redhat.com>,
+# http://fedoraproject.org/wiki/MinGW
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+use strict;
+
+use GDBM_File;
+
+# Map of symbol name -> RPM owner.
+my %symbols;
+my $symdbm =
+ tie %symbols, "GDBM_File", "crossreport.db", &GDBM_NEWDB, 0666;
+main ();
+$symbols{__crossreport_time} = time ();
+$symdbm->sync ();
+
+sub add_symbol {
+ my $symbol = shift;
+ my $rpm_name = shift;
+
+ if (exists $symbols{$symbol} &&
+ $symbols{$symbol} ne $rpm_name) {
+ # Suppress this warning - it is quite common and probably
+ # doesn't matter.
+ #warn "duplicate symbol: $symbol: $rpm_name and $symbols{$symbol}\n"
+ }
+
+ $symbols{$symbol} = $rpm_name;
+}
+
+sub main {
+ print <<EOT;
+Just a note: You should have ALL mingw32-* libraries installed
+when you run this, otherwise you will get an incomplete database.
+I do not have a way to test this, so I print this note.
+
+EOT
+
+ my @implibs = </usr/i686-pc-mingw32/sys-root/mingw/lib/*.dll.a>;
+
+ print "Analyzing ", 0+ at implibs, " libraries ...\n";
+
+ foreach my $implib (@implibs) {
+ # What MinGW library provides this file?
+ my $cmd = "rpm -qf $implib";
+ open CMD, "$cmd |" or die "$cmd: $!";
+ my $r = <CMD>;
+ close CMD;
+ my $rpm_name;
+ if ($r =~ /^(mingw32-[-+\w]+)-\d/) {
+ $rpm_name = $1;
+ } else {
+ die "$implib: Cannot find RPM owning this file.\n"
+ }
+
+ $cmd = "i686-pc-mingw32-nm $implib | grep ' [A-HJ-TV-Z] ' | i686-pc-mingw32-c++filt -_";
+ open CMD, "$cmd |" or die "$cmd: $!";
+ foreach (<CMD>) {
+ chomp;
+ if (m/^[[:xdigit:]]+ T _(\w+)(@\d+)?$/) {
+ add_symbol ($1, $rpm_name);
+ } elsif (m/^[[:xdigit:]]+ T (.*)(@\d+)?$/) {
+ add_symbol ($1, $rpm_name);
+ } else {
+ die "$_: ?\n";
+ }
+ }
+ }
+
+ print "Found ", 0+(keys %symbols), " symbols.\n";
+}
More information about the scm-commits
mailing list