]> git.ipfire.org Git - pakfire.git/commitdiff
Fix expansion of scriptlets when using templates.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Oct 2011 19:02:21 +0000 (21:02 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Oct 2011 18:54:04 +0000 (20:54 +0200)
python/pakfire/packages/lexer.py
python/pakfire/packages/make.py

index fd7863270000386e6851e2f69023a4eb5b16088a..9ca0e420564e16333b1700aa4b3004e3b37cf36b 100644 (file)
@@ -650,9 +650,12 @@ class TemplateLexer(DefaultLexer):
 
                self.scriptlets[name] = {
                        "lang"      : "shell",
-                       "scriptlet" : self.expand_string("\n".join(lines)),
+                       "scriptlet" : "\n".join(lines),
                }
 
+       def get_scriptlet(self, name):
+               return self.scriptlets.get(name, None)
+
 
 class PackageLexer(TemplateLexer):
        def init(self, environ):
@@ -710,6 +713,18 @@ class PackageLexer(TemplateLexer):
                # Check if template exists.
                assert self.template
 
+       def get_scriptlet(self, name):
+               scriptlet = self.scriptlets.get(name, None)
+
+               if scriptlet is None and self.template:
+                       scriptlet = self.template.get_scriptlet(name)
+
+               if scriptlet and scriptlet["lang"] == "shell":
+                       scriptlet["scriptlet"] = \
+                               self.expand_string(scriptlet["scriptlet"])
+
+               return scriptlet
+
 
 class ExportLexer(DefaultLexer):
        @property
index b23e82854cf91f3ea548033ed19486c3dc48fd1f..308dcab57e163f368c8da94bd801cb2b355be6df 100644 (file)
@@ -465,12 +465,7 @@ class MakefilePackage(MakefileBase):
                return self.get_deps("conflicts")
 
        def get_scriptlet(self, type):
-               scriptlet = self.lexer.scriptlets.get(type, None)
-
-               if scriptlet is None and self.lexer.template:
-                       scriptlet = self.lexer.template.scriptlets.get(type, None)
-
-               return scriptlet
+               return self.lexer.get_scriptlet(type)
 
        @property
        def inst_size(self):