New script to yum-utils: debugrepo-check

Ville Skyttä <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
Hello,

I'd like to see a script I've used every now and then to find out problems in 
debuginfo package repos available somewhere, making it easier for people to 
spot such issues.  Attached is a patch that adds it to yum-utils, along with a 
sample output of current rawhide-debuginfo.

_______________________________________________
Yum mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum
0001-Add-debugrepo-check-a-basic-debuginfo-repo-checker.patch (text/x-patch, 4.9 KB)
From bfebf9d952881fea0b7a6349abeddb64ca81d54f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Skytt=C3=A4?= <[email protected]>
Date: Wed, 8 Apr 2009 22:26:10 +0300
Subject: [PATCH] Add debugrepo-check, a basic debuginfo repo checker.

---
 Makefile           |    2 +-
 debugrepo-check.py |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 yum-utils.spec     |    1 +
 3 files changed, 113 insertions(+), 1 deletions(-)
 create mode 100755 debugrepo-check.py

diff --git a/Makefile b/Makefile
index bb65bf6..6ca6f80 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 SUBDIRS = docs
 PKGNAME = yum-utils
-UTILS = package-cleanup debuginfo-install repoclosure repomanage repoquery repo-graph repo-rss yumdownloader yum-builddep repotrack reposync repodiff yum-debug-dump yum-debug-restore verifytree yum-groups-manager find-repos-of-install
+UTILS = package-cleanup debuginfo-install repoclosure repomanage repoquery repo-graph repo-rss yumdownloader yum-builddep repotrack reposync repodiff yum-debug-dump yum-debug-restore verifytree yum-groups-manager find-repos-of-install debugrepo-check
 UTILSROOT = yum-complete-transaction yumdb
 VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec)
 RELEASE=$(shell awk -F%: '/Release:/ { print $$2 }' ${PKGNAME}.spec ')
diff --git a/debugrepo-check.py b/debugrepo-check.py
new file mode 100755
index 0000000..6daa7db
--- /dev/null
+++ b/debugrepo-check.py
@@ -0,0 +1,111 @@
+#!/usr/bin/python -tt
+# -*- coding: utf-8 -*-
+
+# debugrepo-check.py -- basic checks for -debuginfo rpms in repositories
+# Copyright (C) 2007-2009 Ville Skyttä <[email protected]>
+#
+# 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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys
+
+from yum import YumBase
+from yum.misc import getCacheDir
+
+def usage(exit):
+    usage = "Usage: %s <repoid>..." % sys.argv[0]
+    if exit != 0:
+        sys.stderr.write(usage + "\n")
+    else:
+        print usage
+    sys.exit(exit)
+
+if "-h" in sys.argv or "--help" in sys.argv:
+    usage(0)
+elif len(sys.argv) < 2:
+    usage(1)
+
+do_repos = sys.argv[1:]
+
+print
+print "Checking debug packages in repos %s" % ", ".join(do_repos)
+
+yum = YumBase()
+yum.doConfigSetup(init_plugins = False)
+
+for repo in yum.repos.repos.values():
+    if repo.id in do_repos:
+        repo.enable()
+    else:
+        repo.disable()
+
+yum.repos.setCacheDir(getCacheDir())
+yum.doRepoSetup()
+yum.doSackSetup()
+yum.doSackFilelistPopulate()
+
+empties = []
+nodbgs = []
+nosrcs = []
+oks = []
+
+for po in yum.pkgSack.returnNewestByNameArch(patterns=("*-debuginfo",)):
+
+    filenames = po.returnFileEntries()
+    if filenames:
+        src = False
+        dbg = False
+        for fname in filenames:
+            # Ignore stuff below .../.build-id, they're typically just symlinks
+            # to other actual files in the package (metadata doesn't contain
+            # information whether a file entry is a symlink)
+            if fname.find("/.build-id/") != -1:
+                continue
+
+            if fname.endswith(".debug"):
+                dbg = True
+            else:
+                src = True
+            if dbg and src:
+                oks.append(po)
+                break
+        if dbg and not src:
+            nosrcs.append(po)
+        elif not dbg:
+            nodbgs.append(po)
+    else:
+        empties.append(po)
+
+print
+if empties:
+    empties.sort()
+    print "Empty debuginfo packages:"
+    print "    " + "\n    ".join(map(str, empties))
+    print
+if nodbgs:
+    nodbgs.sort()
+    print "Debuginfo packages without .debug files:"
+    print "    " + "\n    ".join(map(str, nodbgs))
+    print
+if nosrcs:
+    nosrcs.sort()
+    print "Debuginfo packages without sources:"
+    print "    " + "\n    ".join(map(str, nosrcs))
+    print
+
+total = len(empties) + len(oks) + len(nosrcs) + len(nodbgs)
+print "Results:"
+print "    %d debuginfo packages, %d empty, %d with no sources." % \
+      (total, len(empties), len(nosrcs))
+print
diff --git a/yum-utils.spec b/yum-utils.spec
index 9212013..1ab6680 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -407,6 +407,7 @@ fi
 %doc COPYING
 %doc plugins/README
 %{_bindir}/debuginfo-install
+%{_bindir}/debugrepo-check
 %{_bindir}/find-repos-of-install
 %{_bindir}/package-cleanup
 %{_bindir}/repoclosure
-- 
1.6.0.6
rawhide-debugrepo-check.txt (text/plain, 5.1 KB)
Checking debug packages in repos rawhide-debuginfo
Importing additional filelist information

Empty debuginfo packages:
    bibus-debuginfo-1.4.3.1-3.fc11.x86_64
    boo-debuginfo-0.8.1.2865-4.fc9.x86_64
    calendar-debuginfo-1.25-5.fc11.x86_64
    cowbell-debuginfo-0.3-0.svn34.4.fc10.x86_64
    dbus-sharp-debuginfo-0.63-11.fc11.x86_64
    eclipse-linuxprofilingframework-debuginfo-0.1.0-3.fc11.x86_64
    eclipse-valgrind-debuginfo-0.1.0-5.fc11.x86_64
    fedora-idm-console-debuginfo-1.1.3-1.fc11.x86_64
    fpc-debuginfo-2.2.2-3.fc10.x86_64
    g2clib-debuginfo-1.1.7-2.fc11.x86_64
    gecko-sharp2-debuginfo-0.13-2.fc11.x86_64
    gnu-efi-debuginfo-3.0e-7.fc11.x86_64
    gupnp-vala-debuginfo-0.5.3-3.fc11.x86_64
    iml-debuginfo-1.0.2-6.fc11.x86_64
    incollector-debuginfo-1.0-6.fc9.1.x86_64
    ipod-sharp-debuginfo-0.8.1-2.fc11.x86_64
    libmimedir-debuginfo-0.4-5.fc11.x86_64
    libnet-debuginfo-1.1.2.1-13.fc11.x86_64
    libnet10-debuginfo-1.0.2a-16.fc11.x86_64
    mingw32-qt-qmake-debuginfo-4.5.0-2.fc11.x86_64
    mpfi-debuginfo-1.3.4-0.5.RC3.fc11.x86_64
    muine-scrobbler-debuginfo-0.1.8-9.fc11.x86_64
    scheme2js-debuginfo-20081219-2.fc11.x86_64
    sublib-debuginfo-0.9-3.fc11.x86_64
    sugar-debuginfo-0.84.4-1.fc11.x86_64

Debuginfo packages without sources:
    GMT-debuginfo-4.4.0-1.fc11.x86_64
    GtkAda-debuginfo-2.10.2-2.fc11.x86_64
    OpenIPMI-debuginfo-2.0.16-1.fc11.x86_64
    antlr-debuginfo-2.7.7-5.fc11.x86_64
    astromenace-debuginfo-1.2-10.fc11.x86_64
    atlas-debuginfo-3.8.3-3.fc11.x86_64
    avalon-logkit-debuginfo-1.2-7.fc11.x86_64
    b43-fwcutter-debuginfo-011-4.fc11.x86_64
    balance-debuginfo-3.42-5.fc11.x86_64
    blitz-debuginfo-0.9-9.fc11.x86_64
    bouncycastle-debuginfo-1.42-1.fc11.x86_64
    brazil-debuginfo-2.3-4.fc11.x86_64
    byaccj-debuginfo-1.14-3.fc11.x86_64
    colrdx-debuginfo-1.02-3.fc11.x86_64
    concurrent-debuginfo-1.3.4-10.fc11.x86_64
    csound-debuginfo-5.03.0-21.fc11.x86_64
    csstidy-debuginfo-1.4-2.fc11.x86_64
    1:cups-debuginfo-1.4-0.b2.13.fc11.x86_64
    curl-debuginfo-7.19.4-5.fc11.x86_64
    curry-debuginfo-0.9.11-6.fc11.x86_64
    ddrescue-debuginfo-1.8-4.fc11.x86_64
    denemo-debuginfo-0.8.2-3.fc11.x86_64
    elftoaout-debuginfo-2.3-12.fc11.x86_64
    elice-debuginfo-0.323-3.fc11.x86_64
    email2trac-debuginfo-0.13-4.fc11.x86_64
    emelfm2-debuginfo-0.5.1-1.fc11.x86_64
    erlang-debuginfo-R12B-5.6.fc11.x86_64
    esc-debuginfo-1.0.1-12.fc11.x86_64
    freeipmi-debuginfo-0.7.6-2.fc11.x86_64
    gammu-debuginfo-1.22.94-2.fc11.x86_64
    gentoo-debuginfo-0.15.2-1.x86_64
    genus2reduction-debuginfo-0.3-3.fc11.x86_64
    gnomint-debuginfo-0.9.1-2.fc11.x86_64
    gnu-getopt-debuginfo-1.0.12-6.fc11.x86_64
    gperiodic-debuginfo-2.0.10-5.fc11.x86_64
    hamcrest-debuginfo-1.1-8.1.fc11.x86_64
    hevea-debuginfo-1.10-3.fc11.x86_64
    1:jakarta-commons-httpclient-debuginfo-3.1-0.4.fc11.x86_64
    jakarta-commons-logging-debuginfo-1.0.4-8.8.fc11.x86_64
    jython-debuginfo-2.2.1-3.2.fc11.x86_64
    2:lam-debuginfo-7.1.4-3.fc11.x86_64
    ldm-debuginfo-2.0.33-2.fc11.x86_64
    libchewing-debuginfo-0.3.2-7.fc11.x86_64
    libflaim-debuginfo-4.9.1052-2.fc11.x86_64
    libtrash-debuginfo-3.2-6.fc11.x86_64
    lostlabyrinth-debuginfo-3.5.1-2.fc11.x86_64
    mediawiki-debuginfo-1.14.0-45.fc11.x86_64
    moe-debuginfo-1.0-4.fc11.x86_64
    mono-debugger-debuginfo-2.4-4.20090116svn123514.fc11.x86_64
    multisync-debuginfo-0.91.1-0.1.svn384.fc11.x86_64
    1:mysql-connector-java-debuginfo-3.1.12-7.fc11.x86_64
    nightfall-debuginfo-1.62-6.fc11.x86_64
    ninvaders-debuginfo-0.1.1-2.fc11.x86_64
    nled-debuginfo-2.52-4.fc11.x86_64
    olpc-utils-debuginfo-0.89-10.fc11.x86_64
    osmo-debuginfo-0.2.4-5.fc11.x86_64
    perl-DBI-Dumper-debuginfo-2.01-7.fc11.x86_64
    pfstools-debuginfo-1.7.0-5.fc11.x86_64
    phasex-debuginfo-0.11.1-6.fc11.x86_64
    planets-debuginfo-0.1.13-3.fc11.x86_64
    postgresql-odbcng-debuginfo-0.99.101-0.1.test1.fc11.x86_64
    pvm-debuginfo-3.4.5-12.fc11.x86_64
    pyparted-debuginfo-2.0.10-1.fc11.x86_64
    qps-debuginfo-1.10.2-3.fc11.x86_64
    quassel-debuginfo-0.4.0-2.fc11.x86_64
    regexp-debuginfo-1.5-3.2.fc11.x86_64
    rfdump-debuginfo-1.6-3.fc11.x86_64
    rhm-debuginfo-0.5.3153-2.fc11.x86_64
    sac-debuginfo-1.3-4.3.fc11.x86_64
    sectool-debuginfo-0.9.1-9.x86_64
    shed-debuginfo-1.14-2.fc11.x86_64
    simdock-debuginfo-1.2-4.fc11.x86_64
    simplyhtml-debuginfo-0.12.5-9.fc11.x86_64
    sinjdoc-debuginfo-0.5-8.fc11.x86_64
    slv2-debuginfo-0.6.2-2.fc11.x86_64
    splat-debuginfo-1.2.3-4.fc11.x86_64
    star-debuginfo-1.5-3.fc11.x86_64
    taginfo-debuginfo-1.2-2.fc11.x86_64
    timespan-debuginfo-2.1-2.fc11.x86_64
    tomoe-gtk-debuginfo-0.6.0-5.fc11.x86_64
    1:transfig-debuginfo-3.2.5-6.fc11.x86_64
    vodovod-debuginfo-1.10r19-4.fc11.x86_64
    wesnoth-debuginfo-1.6-1.fc11.x86_64
    wgrib2-debuginfo-1.7.7.i-2.fc11.x86_64
    why-debuginfo-2.17-2.fc11.x86_64
    wings-debuginfo-0.99.05-3.fc11.x86_64
    wormux-debuginfo-0.8.2-5.fc11.x86_64
    xdotool-debuginfo-20090126-1.fc11.x86_64
    xerces-j2-debuginfo-2.7.1-11.3.fc11.x86_64
    zenon-debuginfo-0.5.0-4.fc11.x86_64

Results:
    4411 debuginfo packages, 25 empty, 90 with no sources.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.