[tracker/rss-enclosures] Create AEGIS security file on build time
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] Create AEGIS security file on build time
- Date: Wed, 24 Nov 2010 01:57:13 +0000 (UTC)
commit f19015a80d8fb6f84f0342049b094600c4f75180
Author: Ivan Frade <ivan frade nokia com>
Date: Wed Oct 6 14:09:50 2010 +0300
Create AEGIS security file on build time
tests/functional-tests/Makefile.am | 20 ++++++++-
tests/functional-tests/create-tests-aegis.py | 62 ++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 4c9d371..666da7d 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -19,10 +19,16 @@ configdir = $(datadir)/tracker-tests
config_SCRIPTS = \
__init__.py \
- tests.xml \
$(slow_tests) \
$(standard_tests)
+if HAVE_MAEMO
+config_SCRIPTS += \
+ tests.xml \
+ tracker-tests.aegis
+endif
+
+
standard_tests = \
01-insertion.py
if HAVE_TRACKER_FTS
@@ -62,6 +68,12 @@ tests.xml:
fi;
./create-tests-xml.py $(standard_tests) > tests.xml
+tracker-tests.aegis:
+ @if test -h /targets/links/scratchbox.config ; then \
+ export SBOX_REDIRECT_IGNORE=/usr/bin/python ; \
+ fi;
+ ./create-tests-aegis.py $(standard_tests) > tracker-tests.aegis
+
10-sqlite-misused.py: ttl/gen-test-data.stamp
11-sqlite-misused-batch.py: ttl/gen-test-data.stamp
13-busy-store.py: ttl/gen-test-data.stamp
@@ -241,6 +253,12 @@ EXTRA_DIST = \
$(bus_query_test_VALASOURCES) \
$(bus_update_test_VALASOURCES)
+if HAVE_MAEMO
+CLEANFILES = \
+ tests.xml \
+ tracker-tests.aegis
+endif
+
MAINTAINERCLEANFILES = \
$(BUILT_SOURCES) \
$(busy_handling_test_VALASOURCES:.vala=.c) \
diff --git a/tests/functional-tests/create-tests-aegis.py b/tests/functional-tests/create-tests-aegis.py
new file mode 100755
index 0000000..91667f1
--- /dev/null
+++ b/tests/functional-tests/create-tests-aegis.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python2.6
+import os
+import sys
+import inspect
+import imp
+
+from common.utils import configuration as cfg
+
+### This function comes from pydoc. Cool!
+def importfile(path):
+ """Import a Python source file or compiled file given its path."""
+ magic = imp.get_magic()
+ file = open(path, 'r')
+ if file.read(len(magic)) == magic:
+ kind = imp.PY_COMPILED
+ else:
+ kind = imp.PY_SOURCE
+ file.close()
+ filename = os.path.basename(path)
+ name, ext = os.path.splitext(filename)
+ file = open(path, 'r')
+ module = None
+ try:
+ module = imp.load_module(name, file, path, (ext, 'r', kind))
+ except Exception, e:
+ print >> sys.stderr, "Ignoring %s (%s)" % (path, e)
+ #raise Exception ()
+ file.close()
+ return module
+
+
+HEADER = """
+<aegis>"""
+
+FOOTER = """
+</aegis>"""
+
+def print_aegis_perm_request (filename):
+ module = importfile (filename)
+ if not module:
+ return
+
+ install_path = os.path.join (cfg.DATADIR, "tracker-tests", filename)
+
+ print "\n <request>"
+ print ' <credential name="TrackerReadAccess" />'
+ print ' <credential name="TrackerWriteAccess" />'
+ print ' <credential name="tracker-extract-access" />'
+ print ' <credential name="tracker-miner-fs-access" />'
+ print ' <credential name="GRP::metadata-users" />'
+ print ' <for path="%s">' % (install_path)
+ print " </request>"
+
+
+if __name__ == "__main__":
+
+ if (len (sys.argv) < 2):
+ print >> sys.stderr, "pass .py tests as parameter"
+ sys.exit (-1)
+ print HEADER
+ map (print_aegis_perm_request, sys.argv[1:])
+ print FOOTER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]