From: Daniel P. Berrange <"Daniel P. Berrange "> Date: Fri, 19 Sep 2008 10:38:18 +0000 (-0400) Subject: Add spec checking tool X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;ds=sidebyside;h=0c016de04848575eef55be3b48ca5446e995e25d;p=fedora-mingw.git Add spec checking tool --- diff --git a/compare/README b/compare/README new file mode 100644 index 0000000..ea923db --- /dev/null +++ b/compare/README @@ -0,0 +1,17 @@ + + +A tool to compare mingw specfiles against the native specfiles +and report on meaningful details that we should fix to keep +mingw in sync with native builds. + +It expects that $HOME/src/fedora/ contains a checkout of all +matching Fedora modules + +There are some bogus warnings due to mingw specific things +but need to be filtered / surpressed on a case by case basis +cf valgrind's --suppression arg + +NB, this requires a patched rpm-python + +https://bugzilla.redhat.com/show_bug.cgi?id=462726 + diff --git a/compare/compare.py b/compare/compare.py new file mode 100644 index 0000000..adb2ccb --- /dev/null +++ b/compare/compare.py @@ -0,0 +1,116 @@ +#!/usr/bin/python + +import sys +from tempfile import mkdtemp +from os import mkdir, system +import rpm + + +def compare_header(refspec, altspec): + refhdr = refspec.packages()[0].header() + althdr = altspec.packages()[0].header() + + refname = refhdr[rpm.RPMTAG_NAME] + altname = althdr[rpm.RPMTAG_NAME] + + refver = refhdr[rpm.RPMTAG_VERSION] + altver = althdr[rpm.RPMTAG_VERSION] + + reflic = refhdr[rpm.RPMTAG_LICENSE] + altlic = althdr[rpm.RPMTAG_LICENSE] + + refurl = refhdr[rpm.RPMTAG_URL] + alturl = althdr[rpm.RPMTAG_URL] + + if refver != altver: + print "WARNING: different version: '%s': '%s' != '%s': '%s'" % (refname, refver, altname, altver) + + if refver != altver: + print "WARNING: different license: '%s': '%s' != '%s': '%s'" % (refname, reflic, altname, altlic) + + if refver != altver: + print "WARNING: different URL: '%s': '%s' != '%s': '%s'" % (refname, refurl, altname, alturl) + +def compare_sources(refspec, altspec): + refsrc = [] + altsrc = [] + refsrcname = [] + altsrcname = [] + for src in refspec.sources(): + if src[2] == rpm.RPMBUILD_ISSOURCE: + uri = src[0] + offset = uri.rfind("/") + if offset != -1: + baseuri = uri[0:offset] + srcname = uri[offset+1:] + else: + baseuri = "" + srcname = uri + refsrc.append([baseuri, srcname]) + refsrcname.append(srcname) + + for src in altspec.sources(): + if src[2] == rpm.RPMBUILD_ISSOURCE: + uri = src[0] + offset = uri.rfind("/") + if offset != -1: + baseuri = uri[0:offset] + srcname = uri[offset+1:] + else: + baseuri = "" + srcname = uri + altsrc.append([baseuri, srcname]) + altsrcname.append(srcname) + + + for s in refsrc: + if not s[1] in altsrcname: + print "WARNING: missing source: '%s'" % s[1] + for s in altsrc: + if not s[1] in refsrcname: + print "WARNING: extra source: '%s'" % s[1] + + for s1 in refsrc: + for s2 in altsrc: + if s1[1] != s2[1]: + continue + if s1[0] != s2[0]: + print "WARNING: different base URI for source '%s': '%s' != '%s'" % (s1[1], s1[0], s2[0]) + + +def compare_patches(refspec, altspec): + refpatch = [] + altpatch = [] + for src in refspec.sources(): + if src[2] == rpm.RPMBUILD_ISPATCH: + refpatch.append(src[0]) + for src in altspec.sources(): + if src[2] == rpm.RPMBUILD_ISPATCH: + altpatch.append(src[0]) + + for p in refpatch: + if not p in altpatch: + print "WARNING missing patch '%s'" % p + + for p in altpatch: + if not p in refpatch: + print "WARNING extra patch '%s'" % p + +scratchdir = mkdtemp("rpm-source-compare") + +if len(sys.argv) != 3: + print "syntax: %s REFERENCE-SPEC ALTERNATE-SPEC" % sys.argv[0] + sys.exit(1) + +refspecfile = sys.argv[1] +altspecfile = sys.argv[2] + +ts = rpm.ts() + +refspec = ts.parseSpec(refspecfile) +altspec = ts.parseSpec(altspecfile) + +compare_header(refspec, altspec) +compare_sources(refspec, altspec) +compare_patches(refspec, altspec) + diff --git a/compare/compare.sh b/compare/compare.sh new file mode 100644 index 0000000..08102a9 --- /dev/null +++ b/compare/compare.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +for i in */*.spec +do + module=`dirname $i` + + echo "------------------------------------------------------" + echo "Compare $module" + + reference=$HOME/src/fedora/$module/devel/$module.spec + if [ ! -f $reference ] + then + echo "Missing reference module $reference" + else + python compare.py $reference $i + fi + echo +done diff --git a/gdb/mingw-gdb.spec b/gdb/mingw-gdb.spec index beeef3a..f84ecee 100644 --- a/gdb/mingw-gdb.spec +++ b/gdb/mingw-gdb.spec @@ -6,7 +6,7 @@ Summary: MinGW port of the GNU debugger (gdb) License: GPLv2+ Group: Development/Libraries URL: http://www.mingw.org/MinGWiki/index.php/gdb -Source0: http://dl.sourceforge.net/sourceforge/mingw/gdb-%{version}-mingw-src.tar.gz +Source0: http://dl.sourceforge.net/sourceforge/mingw/gdb-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Patch0: mingw-gdb-6.8-no-getcwd-error.patch