[arch-projects] [PATCH namcap 1/2] Remove PkgdirRule
It is now unused, and caused confusion regarding the sandbox directory stuff. Ideally it should never need to be used again, as all rules should operate directly on the tarball. Signed-off-by: Dan McGee <dan@archlinux.org> --- Namcap/ruleclass.py | 5 ----- README | 1 - namcap.py | 14 -------------- 3 files changed, 0 insertions(+), 20 deletions(-) diff --git a/Namcap/ruleclass.py b/Namcap/ruleclass.py index f34c657..15250ad 100644 --- a/Namcap/ruleclass.py +++ b/Namcap/ruleclass.py @@ -44,9 +44,4 @@ class TarballRule(AbstractRule): "The parent class of rules that process tarballs" pass -class PkgdirRule(AbstractRule): - """The parent class of rules that process pkgdirs - (extracted tarballs)""" - pass - # vim: set ts=4 sw=4 noet: diff --git a/README b/README index b52ea42..89f6fb5 100644 --- a/README +++ b/README @@ -84,7 +84,6 @@ defined in Namcap.rules.all_rules : * PkgInfoRule classes process any pkginfo object * PkgbuildRule classes process only PKGBUILDs * TarballRule classes process binary packages - * PkgdirRule classes (unused) process uncompressed binary packages Put the new rule in a module and make sure it is imported in Namcap/rules/__init__.py diff --git a/namcap.py b/namcap.py index dcebc55..cca5dd6 100755 --- a/namcap.py +++ b/namcap.py @@ -32,8 +32,6 @@ import types import Namcap.depends import Namcap.tags -sandbox_directory = '/tmp/namcap.' + str(os.getpid()) - # Functions def get_modules(): """Return all possible modules (rules)""" @@ -97,14 +95,6 @@ def process_realpackage(package, modules): if isinstance(rule, Namcap.ruleclass.PkgInfoRule): rule.analyze(pkginfo, None) - elif isinstance(rule, Namcap.ruleclass.PkgdirRule): - # If it's not extracted, extract it and then analyze the package - if not extracted: - os.mkdir(sandbox_directory) - for j in pkgtar.getmembers(): - pkgtar.extract(j, sandbox_directory) - extracted = 1 - rule = pkg.analyze(pkginfo, sandbox_directory) elif isinstance(rule, Namcap.ruleclass.PkgbuildRule): pass elif isinstance(rule, Namcap.ruleclass.TarballRule): @@ -126,10 +116,6 @@ def process_realpackage(package, modules): if info_reporting: show_messages(pkginfo["name"], 'I', infos) - # Clean up if we extracted anything - if extracted: - shutil.rmtree(sandbox_directory) - def process_pkginfo(pkginfo, modules): """Runs namcap checks of a single, non-split PacmanPackage object""" for i in modules: -- 1.7.6.1
If we use the `mktemp --tmpdir` option, we are able to honor TMPDIR without much difficulty. Change the template to not hardcode '/tmp'. Signed-off-by: Dan McGee <dan@archlinux.org> --- namcap | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/namcap b/namcap index edb9de8..47d7f16 100755 --- a/namcap +++ b/namcap @@ -1,7 +1,7 @@ #!/bin/bash args='' -tmp=$(mktemp -d /tmp/namcap.XXXXXXXXXX) +tmp=$(mktemp -d --tmpdir namcap.XXXXXXXXXX) cleanup() { rm -rf "${tmp}" } -- 1.7.6.1
On 2011/9/9 Dan McGee <dan@archlinux.org> wrote:
If we use the `mktemp --tmpdir` option, we are able to honor TMPDIR without much difficulty. Change the template to not hardcode '/tmp'.
Applied both, thanks. Rémy.
participants (2)
-
Dan McGee
-
Rémy Oudompheng