FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Development

 
 
LinkBack Thread Tools
 
Old 11-09-2009, 02:13 AM
Dan McGee
 
Default Add a warning for packages that are over 50% docs

Look at the sizes of things in usr/share/docs, and flag the package if it is
over 50% documentation.

Signed-off-by: Dan McGee <dan@archlinux.org>
---

Finally got around to doing this. I tested it on the package in question (81%
docs, by the way) and also ran it on the gtk-doc package to make sure the name
check was working and excluding packages that are meant to contain docs.

Namcap guys, let me know if you have any questions/problems/concerns. This was
in response to this email:
http://mailman.archlinux.org/pipermail/arch-dev-public/2009-October/014112.htm:

-Dan

Namcap/__init__.py | 1 +
Namcap/lotsofdocs.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
namcap-tags | 1 +
3 files changed, 53 insertions(+), 0 deletions(-)
create mode 100644 Namcap/lotsofdocs.py

diff --git a/Namcap/__init__.py b/Namcap/__init__.py
index 5d8d911..8b39e7a 100644
--- a/Namcap/__init__.py
+++ b/Namcap/__init__.py
@@ -31,6 +31,7 @@ __tarball__ = """
infodirectory
libtool
licensepkg
+ lotsofdocs
mimefiles
perllocal
permissions
diff --git a/Namcap/lotsofdocs.py b/Namcap/lotsofdocs.py
new file mode 100644
index 0000000..2acb350
--- /dev/null
+++ b/Namcap/lotsofdocs.py
@@ -0,0 +1,51 @@
+#
+# namcap rules - lotsofdocs
+# Copyright (C) 2009 Dan McGee <dan@archlinux.org>
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+import os
+import tarfile
+
+class package:
+ def short_name(self):
+ return "lots-of-docs"
+ def long_name(self):
+ return "See if a package is carrying more documentation than it should"
+ def prereq(self):
+ return "tar"
+ def analyze(self, pkginfo, tar):
+ ret = [[],[],[]]
+ if hasattr(pkginfo, 'name'):
+ if pkginfo.name.endswith('-doc'):
+ return ret
+ docdir = 'usr/share/doc'
+ size = 0
+ docsize = 0
+
+ for i in tar.getmembers():
+ if i.name.startswith(docdir):
+ docsize += i.size
+ size += i.size
+
+ ratio = docsize / float(size)
+ if size > 0 and ratio > 0.50:
+ ret[1].append(("lots-of-docs %f", ratio * 100))
+
+ return ret
+ def type(self):
+ return "tarball"
+# vim: set ts=4 sw=4 noet:
diff --git a/namcap-tags b/namcap-tags
index 710077c..3245760 100644
--- a/namcap-tags
+++ b/namcap-tags
@@ -36,6 +36,7 @@ info-dir-file-present %s :: Info directory file (%s) needs removed.
insecure-rpath %s :: Insecure RPATH (%s). If present, RPATH should be only /usr/lib.
libtool-file-present %s :: File (%s) is a libtool file.
link-level-dependence %s in %s :: Link-level dependence (%s) in file %s
+lots-of-docs %f :: Package was %.0f%% docs by size; maybe you should split out a docs package
mime-cache-not-updated :: Mime-file found. Add "update-mime-database usr/share/mime" to the install file
missing-contributor :: Missing Contributor tag
missing-custom-license-dir usr/share/licenses/%s :: Missing custom license directory (usr/share/licenses/%s)
--
1.6.5.2
 

Thread Tools




All times are GMT. The time now is 10:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org