Hi.
This may not the right moment to discuss about this, but I think we
should set up a naming policy for the rpm.
To give a simple exemple, the python module.
Some of them are named
foo-python, and the others are named python-bar.
example adns-python, libxslt-python
vs python-xoltar, python-fam
i suggest to stick to python-bar form, in the same way that perl modules
are named.
this can be applied to xmms modules, apache2 modules, ruby extensions
and a lot of software.
Most of them are maintened by the same person ( abiword => mpol , xine
=> goetz ), so, there is consistency, but, for the other, there is no
standard
In order to enforce the policy, i have coded a rpmlint extension, and i
have send it to Frederic Lepied 2 month ago, but i was busy and forget
to talk about the subject on the list. He said it would be present for
the next release of rpmlint.
So, i propose the policy as implemented in the rpmlint test.
mainly, xmms plugin in /usr/lib/xmms/ must begin with xmms-, and the
same for python, ruby, perm, php, fortune.
I didn't add all the pssible test, they can be quite easily added in the
future.
I know that there is a lot of exception to be added to rpmlint, in order
to support this test, but we will see this later.
Wdyt ?
--
Micka�l Scherer
from Filter import *
import AbstractCheck
import rpm
import re
import Config
# could be added.
#
# zope
# abiword2
# alsaplayer-plugin-input
# emacs
# gstreamer
# nautilus
# vlc-plugin
# XFree
# xine
simple_naming_policy_re=re.compile('\^[a-zA-Z1-9-]*$');
class NamingPolicyCheck(AbstractCheck.AbstractCheck):
checks_=[]
def __init__(self):
AbstractCheck.AbstractCheck.__init__(self, "NamingPolicyCheck")
def add_check(self,pkg_name,name_re,file_re):
c={}
c['pkg_name']=pkg_name
c['name_re']=re.compile(name_re)
c['file_re']=re.compile(file_re)
self.checks_.append(c)
if Config.info:
if simple_naming_policy_re.search(c['name_re']):
details="The name sould begin with " + c['name_re'][1:]
else:
details="The name should match this regular expression"
addDetails( pkg_name + '-naming-policy-not-applied',
"""This package doesn't respect the naming policy.
""" + details )
def check(self, pkg):
if pkg.isSource():
return
list=pkg[rpm.RPMTAG_FILENAMES]
try:
for c in self.checks_:
for f in list:
if c['file_re'].search(f) and not c['name_re'].search(pkg[rpm.RPMTAG_NAME]):
raise 'naming-policy-not-applied'
except 'naming-policy-not-applied':
printWarning(pkg, c['pkg_name'] + '-naming-policy-not-applied',c['pkg_name'] + " " + f)
check=NamingPolicyCheck()
#
# these are the check currently impleted.
#
# first argument is the name of the check, printed by the warning.
# ex : xmms.
#
# secund argument is the regular expression of the naming policy.
# ex: xmms plugin should be named xmms-name_of_plugin.
#
# third is the path of the file that should contains a package to be related to the naming scheme.
# ex: xmms plugin are put under /usr/lib/xmms/
#
# the module is far from being perfect since you need to check this file for the naming file.
# if somone as a elegant solution, I will be happy to implement and test it.
check.add_check('xmms','^xmms-','^/usr/lib/xmms/')
check.add_check('python','^python-','^/usr/lib/python[1-9](-[1-9])?')
check.add_check('perl5','^perl-','^/usr/lib/perl5/vendor_perl')
check.add_check('apache2','^apache2-mod_','^/usr/lib/apache2-')
check.add_check('fortune','^fortune-','^/usr/share/games/fortunes/')
check.add_check('php','^php-','/usr/lib/php/extensions/')
check.add_check('ruby','^ruby-','/usr/lib/ruby/[1-9](-[1-9])?/')
# these exception should be added
# apache2 => apache2-devel
# apache2-modules
# ruby => apache2-mod_ruby
# ruby
#NamingPolicyCheck.py ends here