Index: Namcap/sfurl.py =================================================================== --- Namcap/sfurl.py (revision 136) +++ Namcap/sfurl.py (working copy) @@ -31,7 +31,7 @@ if pkginfo.url != None and pkginfo.source != None: for source in pkginfo.source: if re.match('(http://|ftp://)\w+.dl.sourceforge.net',source) != None: - ret[1].append('Attempting to use specific sf.net mirror, use dl.sourceforge.net instead') + ret[1].append('Attempting to use specific sf.net mirror, use dl.sourceforge.net or downloads.sourceforge.net instead') return ret def type(self): return "pkgbuild" Index: Namcap/__init__.py =================================================================== --- Namcap/__init__.py (revision 136) +++ Namcap/__init__.py (working copy) @@ -17,8 +17,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -__tarball__ = ['depends', 'directoryname', 'fileownership', 'gnomemenu', 'perllocal', 'permissions', 'symlink', 'urlpkg', 'capsnamespkg', 'emptydir', 'scrollkeeper', 'libtool', 'gnomemime'] +__tarball__ = ['depends', 'directoryname', 'fileownership', 'gnomemenu', 'perllocal', 'permissions', 'symlink', 'urlpkg', 'licensepkg', 'capsnamespkg', 'emptydir', 'scrollkeeper', 'libtool', 'gnomemime'] -__pkgbuild__ = ['md5sums', 'tags', 'url', 'invalidstartdir', 'capsnames', 'carch', 'sfurl', 'badbackups'] +__pkgbuild__ = ['md5sums', 'tags', 'url', 'license', 'invalidstartdir', 'capsnames', 'carch', 'sfurl', 'badbackups'] __all__ = __tarball__ + __pkgbuild__ Index: Namcap/license.py =================================================================== --- Namcap/license.py (revision 0) +++ Namcap/license.py (revision 0) @@ -0,0 +1,35 @@ +# +# namcap rules - license +# Copyright (C) 2003-2007 Jason Chu +# +# 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 pacman + +class package: + def short_name(self): + return "license" + def long_name(self): + return "Verifies license is included in a PKGBUILD" + def prereq(self): + return "" + def analyze(self, pkginfo, tar): + ret = [[],[],[]] + if pkginfo.license == None: + ret[0].append('Missing license') + return ret + def type(self): + return "pkgbuild" Index: Namcap/licensepkg.py =================================================================== --- Namcap/licensepkg.py (revision 0) +++ Namcap/licensepkg.py (revision 0) @@ -0,0 +1,35 @@ +# +# namcap rules - licensepkg +# Copyright (C) 2003-2007 Jason Chu +# +# 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 pacman + +class package: + def short_name(self): + return "licensepkg" + def long_name(self): + return "Verifies license is included in a package file" + def prereq(self): + return "pkg" + def analyze(self, pkginfo, tar): + ret = [[],[],[]] + if pkginfo.license == None: + ret[0].append('Missing license') + return ret + def type(self): + return "tarball" Index: pacman.py =================================================================== --- pacman.py (revision 136) +++ pacman.py (working copy) @@ -28,6 +28,7 @@ self.release = None self.desc = None self.url = None + self.license = None self.size = None self.csize = None self.builddate = None @@ -60,6 +61,8 @@ st = st + "Description: " + str(self.desc) + "\n" if self.url != None: st = st + "URL: " + str(self.url) + "\n" + if self.license != None: + st = st + "License: " + str(self.license) + "\n" if self.size != None: st = st + "Size: " + str(self.size) + "\n" if self.csize != None: @@ -133,6 +136,9 @@ m = re.match('url = (.*)\n', i) if m != None: ret.url = m.group(1) + m = re.match('license = (.*)\n', i) + if m != None: + ret.license = m.group(1) m = re.match('size = (.*)\n', i) if m != None: ret.size = int(m.group(1)) @@ -184,6 +190,9 @@ m = re.match('\s*url\s*=[ ]*(.*)\n', i) if m != None: ret.url = m.group(1).strip() + m = re.match('\s*license\s*=[ ]*(.*)\n', i) + if m != None: + ret.license = m.group(1).strip() m = re.match('\s*install\s*=\s*(.*)\n', i) if m != None: ret.install = m.group(1).strip() @@ -288,6 +297,9 @@ if j == '%URL%\n': section = 'url' continue + if j == '%LICENSE%\n': + section = 'license' + continue if j == '%BUILDDATE%\n': section = 'builddate' continue @@ -319,6 +331,8 @@ ret.groups.append(j[:-1]) if section == 'url': ret.url = j[:-1] + if section == 'license': + ret.license = j[:-1] if section == 'builddate': ret.builddate = j[:-1] if section == 'installdate': Index: README =================================================================== --- README (revision 136) +++ README (working copy) @@ -1,11 +1,24 @@ This is where I'm going to put notes. -The idea is that namcap.py takes the package name as an arguement and can also take the list of rules to run on it... later. It then runs through all the modules in Namcap.__all__ variable and tests them against the package looking for flaws. +The idea is that namcap.py takes the package name as an argument and can also +take the list of rules to run on it... later. It then runs through all the +modules in Namcap.__all__ variable and tests them against the package looking +for flaws. -The modules in Namcap.__all__ will contain a class (called package) containing certain functions: +The modules in Namcap.__all__ will contain a class (called package) containing +certain functions: short_name -- returns a string of the identifying name + long_name -- returns a string of the description + prereq -- return either "tarfile" or "extract" to signify -analyze(pkginfo, data) -- does its analysis (if type is "tarball" then data is a TarFile if prereq returns "tar", from the tarfile module, if it's pkg, no data is sent, and if it's extract then the sandbox directory else if type is "pkgbuild" then data is filename). Returns a list containing three lists. First list is the list of errors, second list is the list of warnings, third list is information/notices (not warnings, but more like "did you know"s). + +analyze(pkginfo, data) -- does its analysis (if type is "tarball" then data is +a TarFile if prereq returns "tar", from the tarfile module, if it's pkg, no +data is sent, and if it's extract then the sandbox directory else if type is +"pkgbuild" then data is filename). Returns a list containing three lists. +First list is the list of errors, second list is the list of warnings, third +list is information/notices (not warnings, but more like "did you know"s). + type -- return either "pkgbuild" or "tarball"