]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
Add quality-agent clause.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 23 Sep 2011 22:49:49 +0000 (00:49 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 23 Sep 2011 22:49:49 +0000 (00:49 +0200)
macros/constants.macro
macros/quality-agent.macro
pakfire/packages/lexer.py
pakfire/packages/make.py
po/pakfire.pot

index d7af330067ac1b1cdb023acf174b6c8799d14842..f7bcfd74ee73df10ae85d9bad39dc56345348149 100644 (file)
@@ -27,14 +27,10 @@ sources = %{thisapp}.tar.gz
 # Guesses the compression type automatically.
 MACRO_EXTRACT = tar xaf
 
-# Macro to define and start the quality agent.
-# Long term goal is to improve the commited code.
-MACRO_QUALITY_AGENT = /usr/lib/pakfire/quality-agent
-
 # Macro to strip debugging symbols.
 MACRO_STRIP = /usr/lib/buildsystem-tools/stripper %{BUILDROOT}
 
-def MACRO_PATCHES
+MACRO_PATCHES
        patches="%{patches}"
 
        if [ -n "${patches}" ]; then
@@ -67,7 +63,7 @@ def MACRO_PATCHES
 end
 
 # Remove rpath from libtool.
-def MACRO_FIX_LIBTOOL
+MACRO_FIX_LIBTOOL
        if [ -e "%{DIR_APP}/libtool" ]; then
                sed -e %{DIR_APP}/libtool \
                        -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g'
index 066169ed4deee2cc9badb55480e41218a8b18c6c..b82cba96b3afda1a5285bea1555c581126a804d7 100644 (file)
@@ -4,14 +4,11 @@
 # Quality agent
 #
 ###############################################################################
-# Export variables for the quality agent
 
-export QUALITY_AGENT_PERMIT_NOT_FULL_RELRO
-export QUALITY_AGENT_RPATH_ALLOW_ORIGIN
-export QUALITY_AGENT_WHITELIST_EXECSTACK
-export QUALITY_AGENT_WHITELIST_NX
-export QUALITY_AGENT_WHITELIST_RPATH
-export QUALITY_AGENT_WHITELIST_SONAME
-export QUALITY_AGENT_WHITELIST_SYMLINK
-export QUALITY_AGENT_NO_DIRECTORY_CHECK
-export QUALITY_AGENT_NO_DIRECTORY_PRUNE
+# Macro to define and start the quality agent.
+# Long term goal is to improve the commited code.
+MACRO_QUALITY_AGENT = /usr/lib/pakfire/quality-agent
+
+# XXX to be moved to some place else
+#export QUALITY_AGENT_NO_DIRECTORY_CHECK
+#export QUALITY_AGENT_NO_DIRECTORY_PRUNE
index 1560493e13e542eb071bcce5a19596dca3d17085..b9faeb3b80de39e4d1839ca54dadba5144f4ab28 100644 (file)
@@ -75,6 +75,10 @@ LEXER_PACKAGE2_BEGIN  = re.compile(r"^package$")
 LEXER_PACKAGE2_LINE   = LEXER_BLOCK_LINE
 LEXER_PACKAGE2_END    = LEXER_BLOCK_END
 
+LEXER_QUALITY_AGENT_BEGIN = re.compile(r"^quality-agent$")
+LEXER_QUALITY_AGENT_LINE  = LEXER_BLOCK_LINE
+LEXER_QUALITY_AGENT_END   = LEXER_BLOCK_END
+
 # Statements:
 LEXER_EXPORT          = re.compile(r"^export\s+([A-Za-z0-9_\-]+)\s*(\+)?=\s*(.+)?$")
 LEXER_EXPORT2         = re.compile(r"^export\s+([A-Za-z0-9_\-]+)$")
@@ -518,6 +522,47 @@ class DefaultLexer(Lexer):
        pass
 
 
+class QualityAgentLexer(DefaultLexer):
+       """
+               A lexer to read quality agent exceptions.
+       """
+       @property
+       def exports(self):
+               exports = {}
+
+               # Check if we permit full relro.
+               if self.get_var("permit_not_full_relro"):
+                       exports["QUALITY_AGENT_PERMIT_NOT_FULL_RELRO"] = \
+                               self.get_var("permit_not_full_relro")
+
+               # Check if we permit $ORIGIN in rpath.
+               if self.get_var("rpath_allow_origin"):
+                       exports["QUALITY_AGENT_RPATH_ALLOW_ORIGIN"] = \
+                               self.get_var("rpath_allow_origin")
+
+               # Load execstack whitelist.
+               if self.get_var("whitelist_execstack"):
+                       exports["QUALITY_AGENT_WHITELIST_EXECSTACK"] = \
+                               self.get_var("whitelist_execstack")
+
+               # Load nx whitelist.
+               if self.get_var("whitelist_nx"):
+                       exports["QUALITY_AGENT_WHITELIST_NX"] = \
+                               self.get_var("whitelist_nx")
+
+               # Load rpath whitelist.
+               if self.get_var("whitelist_rpath"):
+                       exports["QUALITY_AGENT_WHITELIST_RPATH"] = \
+                               self.get_var("whitelist_rpath")
+
+               # Load symlink whitelist
+               if self.get_var("whitelist_symlink"):
+                       exports["QUALITY_AGENT_WHITELIST_SYMLINK"] = \
+                               self.get_var("whitelist_symlink")
+
+               return exports
+
+
 class TemplateLexer(DefaultLexer):
        def init(self, environ):
                # A place to store the scriptlets.
@@ -733,6 +778,9 @@ class RootLexer(ExportLexer):
                # Place for build instructions
                self.build = BuildLexer([], parent=self)
 
+               # Place for quality-agent exceptions
+               self.quality_agent = QualityAgentLexer([], parent=self)
+
                # Include all macros.
                if not self.parent:
                        for macro in MACRO_FILES:
@@ -755,6 +803,7 @@ class RootLexer(ExportLexer):
 
                self.build.inherit(other.build)
                self.packages.inherit(other.packages)
+               self.quality_agent.inherit(other.quality_agent)
 
        @property
        def templates(self):
@@ -766,6 +815,7 @@ class RootLexer(ExportLexer):
                        (LEXER_INCLUDE,                 self.parse_include),
                        (LEXER_PACKAGES_BEGIN,  self.parse_packages),
                        (LEXER_BUILD_BEGIN,             self.parse_build),
+                       (LEXER_QUALITY_AGENT_BEGIN, self.parse_quality_agent),
                ]
 
                return parsers
@@ -832,6 +882,17 @@ class RootLexer(ExportLexer):
                pkgs = PackagesLexer(lines, parent=self)
                self.packages.inherit(pkgs)
 
+       def parse_quality_agent(self):
+               keys, lines = self.read_block(
+                       pattern_start=LEXER_QUALITY_AGENT_BEGIN,
+                       pattern_line=LEXER_QUALITY_AGENT_LINE,
+                       pattern_end=LEXER_QUALITY_AGENT_END,
+                       raw = True,
+               )
+
+               qa = QualityAgentLexer(lines, parent=self)
+               self.quality_agent.inherit(qa)
+
 
 class PackagesLexer(DefaultLexer):
        def init(self, environ):
index 1fdb6a78f476cd49a52bf9c302b87197cee10baa..b73aa5a93ae7e5e4a938b29e32006190a703c7b8 100644 (file)
@@ -321,6 +321,9 @@ class Makefile(MakefileBase):
        def exports(self):
                exports = {}
 
+               # Include quality agent exports.
+               exports.update(self.lexer.quality_agent.exports)
+
                for export in self.lexer.build.exports:
                        exports[export] = self.lexer.build.get_var(export)
 
index 3465efc592e199ef85cbfe92ba340ef7795b873f..1184c27613f528b2d6a019ba0b005f1dc4ad4cef 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-09-24 00:02+0200\n"
+"POT-Creation-Date: 2011-09-24 00:42+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"