diff options
author | Kyle Keen <keenerd@gmail.com> | 2016-04-27 23:59:35 -0400 |
---|---|---|
committer | Kyle Keen <keenerd@gmail.com> | 2016-04-28 00:02:31 -0400 |
commit | 6cf4feea3624839455e0d4a492db101ede71ef0a (patch) | |
tree | 115354924a486adbd80bc42462515477e3440037 | |
parent | 8a4c1ef0b7af35ed533766baba7c275a31af0f60 (diff) | |
download | namcap-6cf4feea3624839455e0d4a492db101ede71ef0a.tar.gz namcap-6cf4feea3624839455e0d4a492db101ede71ef0a.zip |
Remove old .INSTALL tests
Signed-off-by: Kyle Keen <keenerd@gmail.com>
-rw-r--r-- | Namcap/rules/__init__.py | 1 | ||||
-rw-r--r-- | Namcap/rules/glibfiles.py | 37 | ||||
-rw-r--r-- | Namcap/rules/hicoloricons.py | 10 | ||||
-rw-r--r-- | Namcap/rules/infodirectory.py | 20 | ||||
-rw-r--r-- | Namcap/rules/mimefiles.py | 66 | ||||
-rw-r--r-- | Namcap/tests/package/test_glibfiles.py | 18 | ||||
-rw-r--r-- | Namcap/tests/package/test_hicoloricons.py | 2 | ||||
-rw-r--r-- | Namcap/tests/package/test_infodirectory.py | 15 | ||||
-rw-r--r-- | Namcap/tests/package/test_mimefiles.py | 83 | ||||
-rw-r--r-- | namcap-tags | 7 | ||||
-rw-r--r-- | namcap.1 | 4 |
11 files changed, 6 insertions, 257 deletions
diff --git a/Namcap/rules/__init__.py b/Namcap/rules/__init__.py index 6e303f7..f64b641 100644 --- a/Namcap/rules/__init__.py +++ b/Namcap/rules/__init__.py @@ -39,7 +39,6 @@ from . import ( libtool, licensepkg, lotsofdocs, - mimefiles, missingbackups, perllocal, permissions, diff --git a/Namcap/rules/glibfiles.py b/Namcap/rules/glibfiles.py index 10ed2ed..16261db 100644 --- a/Namcap/rules/glibfiles.py +++ b/Namcap/rules/glibfiles.py @@ -23,44 +23,13 @@ from Namcap.ruleclass import * class GlibSchemasRule(TarballRule): name = "glibschemas" - description = "Check that dconf schemas are compiled" + description = "Check for dconf schemas dependency" def analyze(self, pkginfo, tar): - flag = False - ok = False for entry in tar: if ('usr/share/glib-2.0/schemas' in entry.name - and os.path.basename(entry.name).endswith(".gschema.xml") - and not flag): - flag = True + and os.path.basename(entry.name).endswith(".gschema.xml")): reasons = pkginfo.detected_deps.setdefault("dconf", []) reasons.append( ('dconf-needed-for-glib-schemas',()) ) - if ".INSTALL" in entry.name: - f = tar.extractfile(".INSTALL") - if b"glib-compile-schemas" in f.read(): - ok = True - f.close() - if flag and not ok: - self.warnings.append(("dconf-schemas-not-compiled", ())) - -class GioModulesRule(TarballRule): - name = "giomodules" - description = "Check that GIO modules are registered" - def analyze(self, pkginfo, tar): - flag = False - ok = False - for entry in tar: - if ('usr/lib/gio/modules' in entry.name - and os.path.basename(entry.name) not in ('', 'modules') - and not flag): - flag = True - reasons = pkginfo.detected_deps.setdefault("glib2", []) - reasons.append( ('glib2-needed-for-gio-modules',()) ) - if ".INSTALL" in entry.name: - f = tar.extractfile(".INSTALL") - if b"gio-querymodules" in f.read(): - ok = True - f.close() - if flag and not ok: - self.warnings.append(("gio-modules-not-registered", ())) + break # vim: set ts=4 sw=4 noet: diff --git a/Namcap/rules/hicoloricons.py b/Namcap/rules/hicoloricons.py index d4e35d9..653f52b 100644 --- a/Namcap/rules/hicoloricons.py +++ b/Namcap/rules/hicoloricons.py @@ -21,18 +21,10 @@ from Namcap.ruleclass import * class package(TarballRule): name = "hicoloricons" - description = "Checks whether the hicolor icon cache is updated." + description = "Checks for hicolor path dependency" def analyze(self, pkginfo, tar): if "usr/share/icons/hicolor" in tar.getnames(): reasons = pkginfo.detected_deps.setdefault("hicolor-icon-theme", []) reasons.append( ('hicolor-icon-theme-needed-for-hicolor-dir',()) ) - if ".INSTALL" not in tar.getnames(): - self.errors.append(("hicolor-icon-cache-not-updated", ())) - else: - f = tar.extractfile(".INSTALL") - install_script = f.read().decode("utf-8", "ignore") - if ("gtk-update-icon-cache" not in install_script) and ("xdg-icon-resource" not in install_script): - self.errors.append(("hicolor-icon-cache-not-updated", ())) - # vim: set ts=4 sw=4 noet: diff --git a/Namcap/rules/infodirectory.py b/Namcap/rules/infodirectory.py index e4c9607..24faba6 100644 --- a/Namcap/rules/infodirectory.py +++ b/Namcap/rules/infodirectory.py @@ -27,24 +27,4 @@ class InfodirRule(TarballRule): if i == "usr/share/info/dir": self.errors.append(("info-dir-file-present %s", i)) -class InfoInstallRule(TarballRule): - name = "infoinstall" - description = "Checks that info files are correctly installed." - def analyze(self, pkginfo, tar): - info_installed = False - info_present = False - - for i in tar: - if i.name == ".INSTALL": - install = tar.extractfile(i) - if b"install-info" in install.read(): - info_installed = True - install.close() - - if i.name.startswith("usr/share/info/"): - info_present = True - - if info_present and not info_installed: - self.errors.append(("info-dir-not-updated", ())) - # vim: set ts=4 sw=4 noet: diff --git a/Namcap/rules/mimefiles.py b/Namcap/rules/mimefiles.py deleted file mode 100644 index cf60bc5..0000000 --- a/Namcap/rules/mimefiles.py +++ /dev/null @@ -1,66 +0,0 @@ -# -# namcap rules - mimefiles -# Copyright (C) 2009 Hugo Doria <hugo@archlinux.org> -# Copyright (C) 2011 Rémy Oudompheng <remy@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 -# - -from Namcap.ruleclass import * - -class MimeInfoRule(TarballRule): - name = "mimefiles" - description = "Check for files in /usr/share/mime" - def analyze(self, pkginfo, tar): - if 'usr/share/mime' in tar.getnames(): - reasons = pkginfo.detected_deps.setdefault("shared-mime-info", []) - reasons.append( ('shared-mime-info-needed',()) ) - if ".INSTALL" not in tar.getnames(): - self.errors.append(("mime-cache-not-updated", ())) - else: - f = tar.extractfile(".INSTALL") - if b"update-mime-database" not in f.read(): - self.errors.append(("mime-cache-not-updated", ())) - -class MimeDesktopRule(TarballRule): - name = "mimedesktop" - description = "Check that MIME associations are updated" - def analyze(self, pkginfo, tar): - desktop_db_updated = False - has_mime_desktop = False - for entry in tar: - if entry.issym(): - continue - if (entry.name.startswith("usr/share/applications") - and entry.name.endswith(".desktop")): - f = tar.extractfile(entry) - for l in f: - if l.startswith(b"MimeType="): - has_mime_desktop = True - break - f.close() - if entry.name == ".INSTALL": - f = tar.extractfile(entry) - if b"update-desktop-database" in f.read(): - desktop_db_updated = True - f.close() - - if has_mime_desktop: - reasons = pkginfo.detected_deps.setdefault("desktop-file-utils", []) - reasons.append( ('desktop-file-utils-needed',()) ) - if not desktop_db_updated: - self.errors.append(("desktop-database-not-updated", ())) - -# vim: set ts=4 sw=4 noet: diff --git a/Namcap/tests/package/test_glibfiles.py b/Namcap/tests/package/test_glibfiles.py index 8e151b3..b9f58b5 100644 --- a/Namcap/tests/package/test_glibfiles.py +++ b/Namcap/tests/package/test_glibfiles.py @@ -59,23 +59,7 @@ package() { {'dconf': [('dconf-needed-for-glib-schemas', ())] } ) self.assertEqual(r.errors, []) - self.assertEqual(r.warnings, [("dconf-schemas-not-compiled", ())]) - self.assertEqual(r.infos, []) - - def test_gio_modules_exists(self): - pkgfile = "__namcap_test_glibfiles-1.0-1-%(arch)s.pkg.tar" % { "arch": self.arch } - with open(os.path.join(self.tmpdir, "PKGBUILD"), "w") as f: - f.write(self.pkgbuild) - self.run_makepkg() - pkg, r = self.run_rule_on_tarball( - os.path.join(self.tmpdir, pkgfile), - Namcap.rules.glibfiles.GioModulesRule - ) - self.assertEqual(pkg.detected_deps, - {'glib2': [('glib2-needed-for-gio-modules', ())] } - ) - self.assertEqual(r.errors, []) - self.assertEqual(r.warnings, [("gio-modules-not-registered", ())]) + self.assertEqual(r.warnings, []) self.assertEqual(r.infos, []) # vim: set ts=4 sw=4 noet: diff --git a/Namcap/tests/package/test_hicoloricons.py b/Namcap/tests/package/test_hicoloricons.py index f47798a..cc3d9e3 100644 --- a/Namcap/tests/package/test_hicoloricons.py +++ b/Namcap/tests/package/test_hicoloricons.py @@ -60,7 +60,6 @@ package() { ('dependency-detected-not-included %s (%s)', ('hicolor-icon-theme', 'needed for hicolor theme hierarchy') ), - ("hicolor-icon-cache-not-updated", ()) ])) self.assertEqual(r.warnings + w, []) self.assertEqual(r.infos + i, [ @@ -100,7 +99,6 @@ package() { "hicolor-icon-theme": [('hicolor-icon-theme-needed-for-hicolor-dir',())] }) self.assertEqual(r.errors + e, [ - ("hicolor-icon-cache-not-updated", ()) ]) self.assertEqual(r.warnings + w, []) self.assertEqual(r.infos + i, [ diff --git a/Namcap/tests/package/test_infodirectory.py b/Namcap/tests/package/test_infodirectory.py index 9579606..ae16f03 100644 --- a/Namcap/tests/package/test_infodirectory.py +++ b/Namcap/tests/package/test_infodirectory.py @@ -59,20 +59,5 @@ package() { self.assertEqual(r.warnings, []) self.assertEqual(r.infos, []) - def test_info_dir_updated(self): - pkgfile = "__namcap_test_infodirectory-1.0-1-%(arch)s.pkg.tar" % { "arch": self.arch } - with open(os.path.join(self.tmpdir, "PKGBUILD"), "w") as f: - f.write(self.pkgbuild) - self.run_makepkg() - pkg, r = self.run_rule_on_tarball( - os.path.join(self.tmpdir, pkgfile), - Namcap.rules.infodirectory.InfoInstallRule - ) - self.assertEqual(r.errors, [ - ("info-dir-not-updated", ()) - ]) - self.assertEqual(r.warnings, []) - self.assertEqual(r.infos, []) - # vim: set ts=4 sw=4 noet: diff --git a/Namcap/tests/package/test_mimefiles.py b/Namcap/tests/package/test_mimefiles.py deleted file mode 100644 index a4a7d2f..0000000 --- a/Namcap/tests/package/test_mimefiles.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- -# -# namcap tests - mimefiles -# Copyright (C) 2011 Rémy Oudompheng <remy@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 -from Namcap.tests.makepkg import MakepkgTest -import Namcap.rules.mimefiles - -class MimeFilesTest(MakepkgTest): - pkgbuild = """ -pkgname=__namcap_test_mimefiles -pkgver=1.0 -pkgrel=1 -pkgdesc="A package" -arch=('i686' 'x86_64') -url="http://www.example.com/" -license=('GPL') -depends=('glibc') -source=() -options=(!purge !zipman) -build() { - true -} -package() { - mkdir -p "${pkgdir}/usr/share/mime/applications" - - mkdir -p "${pkgdir}/usr/share/applications" - echo "MimeType=applcation/pdf" > "${pkgdir}/usr/share/applications/foobar.desktop" -} -""" - def test_mimefiles_file_exists(self): - "Packge with mimefiles but cache is not updated" - pkgfile = "__namcap_test_mimefiles-1.0-1-%(arch)s.pkg.tar" % { "arch": self.arch } - with open(os.path.join(self.tmpdir, "PKGBUILD"), "w") as f: - f.write(self.pkgbuild) - self.run_makepkg() - pkg, r = self.run_rule_on_tarball( - os.path.join(self.tmpdir, pkgfile), - Namcap.rules.mimefiles.MimeInfoRule - ) - self.assertEqual(pkg.detected_deps, - {"shared-mime-info": [('shared-mime-info-needed', ())] } - ) - self.assertEqual(r.errors, [("mime-cache-not-updated", ())]) - self.assertEqual(r.warnings, []) - self.assertEqual(r.infos, []) - - def test_mimetype_in_desktop(self): - "Package with desktop files and MIME associations not updated" - pkgfile = "__namcap_test_mimefiles-1.0-1-%(arch)s.pkg.tar" % { "arch": self.arch } - with open(os.path.join(self.tmpdir, "PKGBUILD"), "w") as f: - f.write(self.pkgbuild) - self.run_makepkg() - pkg, r = self.run_rule_on_tarball( - os.path.join(self.tmpdir, pkgfile), - Namcap.rules.mimefiles.MimeDesktopRule - ) - self.assertEqual(pkg.detected_deps, - {"desktop-file-utils": [('desktop-file-utils-needed', ())] } - ) - self.assertEqual(r.errors, [("desktop-database-not-updated", ())]) - self.assertEqual(r.warnings, []) - self.assertEqual(r.infos, []) - -# vim: set ts=4 sw=4 noet: - diff --git a/namcap-tags b/namcap-tags index 58139fb..bc6c90f 100644 --- a/namcap-tags +++ b/namcap-tags @@ -13,7 +13,6 @@ backups-preceding-slashes :: Backup entries should not have preceding slashes cross-dir-hardlink %s %s :: Cross-directory hardlink in package (%s, %s) dangling-hardlink %s points to %s :: Hard link (%s) points to non-existing %s dangling-symlink %s points to %s :: Symlink (%s) points to non-existing %s -dconf-schemas-not-compiled :: Files in /usr/share/glib-2.0/schemas but no call for glib-compile-schemas in install file desktop-database-not-updated :: Mime type handler found. Add "update-desktop-database -q" to the install file directory-not-world-executable %s :: Directory (%s) does not have the world executable bit set. elffile-in-any-package %s :: ELF file ('%s') found in an 'any' package. @@ -31,23 +30,19 @@ file-not-world-readable %s :: File (%s) does not have the world readable bit set file-referred-in-startdir :: File referenced in $startdir file-setugid %s :: File (%s) is setuid or setgid. file-world-writable %s :: File (%s) has the world writable bit set. -gio-modules-not-registered :: Package installs GIO modules but does not register them with gio-querymodules in install script. gnome-mime-file %s :: File (%s) is an auto-generated GNOME mime file hardlink-found %s points to %s :: Hard link (%s) found that points to %s -hicolor-icon-cache-not-updated :: Files in /usr/share/icons/hicolor but no call to gtk-update-icon-cache or xdg-icon-resource to update the icon cache kdebase-runtime-needed-dep %s :: KDE programs %s probably need kdebase-runtime to run correctly improper-checksum %s %s :: Improper %s: '%s' incorrect-library-permissions %s :: Library (%s) does not have permission set to 644 or 444 incorrect-owner %s (%s:%s) :: File (%s) is owned by %s:%s invalid-filename :: File name %s contains non standard characters info-dir-file-present %s :: Info directory file (%s) should not be present -info-dir-not-updated :: Info files detected but not updated with "install-info" in install file insecure-rpath %s %s :: Insecure RPATH '%s' in file ('%s') libtool-file-present %s :: File (%s) is a libtool file library-no-package-associated %s :: Referenced library '%s' is an uninstalled dependency 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-backup-file %s :: File in backup array (%s) not found in package missing-description :: Missing description in PKGBUILD missing-contributor :: Missing Contributor tag @@ -99,8 +94,6 @@ depends-by-namcap-sight depends=(%s) :: Depends as namcap sees them: depends=(%s dconf-needed-for-glib-schemas :: needed for glib schemas glib2-needed-for-gio-modules :: needed for GIO modules hicolor-icon-theme-needed-for-hicolor-dir :: needed for hicolor theme hierarchy -shared-mime-info-needed :: needed for update-mime-database -desktop-file-utils-needed :: needed for update-desktop-database kdebase-runtime-needed %s :: needed for programs %s java-environment-needed %s :: found class files %s libraries-needed %s %s :: libraries %s needed in files %s @@ -99,9 +99,6 @@ Verifies that the licenses variable has been filled in in a package. For package checks whether the license file has been installed in /usr/share/licenses/$pkgname/ .TP -.B mimefiles -Checks whether update-mime-database is called when the package installs files in /usr/share/mime -.TP .B perllocal Searches for perllocal.pod. perllocal.pod is a nasty file that's included during most perl module installations .TP @@ -155,4 +152,5 @@ Dan McGee <dan@archlinux.org> Allan McRae <allan@archlinux.org> Jesse Young <jesseyoung@gmail.com> JJDaNiMoTh <jjdanimoth@gmail.com> +Kyle Keen <keenerd@gmail.com> .fi |