[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force X.Org X11 SVN commit: r187 - in trunk/debian: . scripts



Author: branden
Date: 2005-06-10 18:51:41 -0500 (Fri, 10 Jun 2005)
New Revision: 187

Added:
   trunk/debian/scripts/missing-keyword-sniffer
Modified:
   trunk/debian/changelog
Log:
Add debian/scripts/missing-keyword-sniffer, which identifies plain text
files in the source package that are missing Subversion Id keywords or the
corresponsing property.


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-06-10 23:19:16 UTC (rev 186)
+++ trunk/debian/changelog	2005-06-10 23:51:41 UTC (rev 187)
@@ -133,6 +133,10 @@
     actually reflect package release history as a Debian user would see it).
     Ship this changelog in /usr/share/doc/xorg-common.
 
+  * Add debian/scripts/missing-keyword-sniffer, which identifies plain text
+    files in the source package that are missing Subversion Id keywords or the
+    corresponsing property.
+
  -- Branden Robinson <branden@debian.org>  Sun,  5 Jun 2005 19:21:53 -0500
 
 xfree86 (4.3.0.dfsg.1-14) unstable; urgency=high

Added: trunk/debian/scripts/missing-keyword-sniffer
===================================================================
--- trunk/debian/scripts/missing-keyword-sniffer	2005-06-10 23:19:16 UTC (rev 186)
+++ trunk/debian/scripts/missing-keyword-sniffer	2005-06-10 23:51:41 UTC (rev 187)
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+
+# $Id$
+
+# Find plain text files that are missing a Subversion Id keyword and/or
+# property.  Not all plain text files can syntactically accomodate one (e.g.,
+# many files used by debhelper cannot), so only report files that do not match
+# an excusion list.
+
+# I ought to learn how to configure SVN auto-properties someday...
+
+import os
+import re
+import sys
+
+progname = os.path.basename(sys.argv[0])
+
+def bomb(exitcode, message):
+    sys.stderr.write("%s: fatal error: %s\n" % (progname, message))
+    sys.exit(exitcode)
+
+# Ensure we're at the top of an upacked source tree to avoid false positives or
+# negatives.
+if not os.path.isdir("debian"):
+    bomb(os.EX_NOINPUT, "no debian directory found; run %s" % (progname,) \
+         + " from the top of an unpacked source tree")
+
+# Compile a regex to build the exclusion list.
+# We ignore:
+#   MANIFEST
+#   POTFILES.in (generated by po-debconf)
+#   compat (debhelper)
+#   templates.pot (generated by po-debconf)
+#   xterm.faq.html (not locally maintained; snarfed from Thomas Dickey's
+#       website)
+#   presubj (don't clutter bug submitters' minds with keywords)
+#   dirs (debhelper)
+#   doc-base (debhelper)
+#   docs (debhelper)
+#   examples (debhelper)
+#   install (debhelper)
+#   links (debhelper)
+#   shlibs (no support for comment characters in file format)
+#   templates (no support for comment characters in file format)
+#   theme (no support for comment characters in file format)
+exclusions = re.compile('^(MANIFEST\..*|POTFILES\.in|compat|templates\.pot|xterm\.faq\.html|.*\.presubj|.*\.theme|.*\.(dirs|doc-base|docs|examples|install|links|shlibs|templates).*)$')
+
+# Find all normal files that aren't in a directory used by Subversion checkouts.
+find_pipe = os.popen(
+    "find debian -type f -and -not -path '*/.svn/*' | LC_COLLATE=c sort")
+
+for file in find_pipe:
+    filename = file.rstrip()
+    basename = os.path.basename(filename)
+    if not exclusions.search(basename):
+        # Search for SVN Id keyword.
+        grep_status = os.system("grep -q '\$Id.*\$' %s" % (filename,))
+        if grep_status != 0:
+            sys.stdout.write("missing-keyword: %s\n" % (filename,))
+        # See if SVN keyword property set to correct value.
+        svn_grep_status = os.system(
+           "svn propget svn:keywords %s" % (filename,) \
+           + "| grep -qw 'Id'")
+        if svn_grep_status != 0:
+            sys.stdout.write("missing-property: %s\n" % (filename,))
+
+find_pipe.close()
+
+sys.exit(0)
+
+# vim:set ai et sts=4 sw=4 tw=80:


Property changes on: trunk/debian/scripts/missing-keyword-sniffer
___________________________________________________________________
Name: svn:keywords
   + Id



Reply to: