diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-02-05 12:09:57 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-02-07 14:25:26 +0200 |
commit | f3df7a17c2b0dfad2f1c5e95d7d299efa1daa639 (patch) | |
tree | a69fe26a504faafb7df2e43393806a55cebc4ce4 | |
parent | 413c893cad95ce115b510099402e9256820cfc13 (diff) | |
download | git-buildpackage-f3df7a17c2b0dfad2f1c5e95d7d299efa1daa639.tar.gz git-buildpackage-f3df7a17c2b0dfad2f1c5e95d7d299efa1daa639.tar.bz2 git-buildpackage-f3df7a17c2b0dfad2f1c5e95d7d299efa1daa639.zip |
rpm: track all "section" directives in spec file
Here "section" stands for all scripts, scriptlets and other directives,
i.e. "%prep", "%post", "%files" etc.
Change-Id: I748311bb53657dc9047e0a7b0aa60687ed4a6e3a
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | gbp/rpm/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py index 18bd9dad..cd62e08b 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -111,6 +111,12 @@ class SpecFile(object): '(\s+(?P<args>.*))?$', flags=re.I) gbptag_re = re.compile(r'^\s*#\s*gbp-(?P<name>[a-z-]+)' '(\s*:\s*(?P<args>\S.*))?$', flags=re.I) + # Here "sections" stand for all scripts, scriptlets and other directives, + # but not macros + section_identifiers = ('package', 'description', 'prep', 'build', 'install', + 'clean', 'check', 'pre', 'preun', 'post', 'postun', 'verifyscript', + 'files', 'changelog', 'triggerin', 'triggerpostin', 'triggerun', + 'triggerpostun') def __init__(self, filename=None, filedata=None): @@ -371,7 +377,7 @@ class SpecFile(object): directiveid = -1 # Record special directive/scriptlet/macro locations - if directivename in ('prep', 'setup', 'patch'): + if directivename in self.section_identifiers + ('setup', 'patch'): linerecord = {'line': lineobj, 'id': directiveid, 'args': matchobj.group('args')} @@ -410,11 +416,7 @@ class SpecFile(object): continue matched = self._parse_directive(lineobj) if matched: - if matched in ('package', 'description', 'prep', 'build', - 'install', 'clean', 'check', 'pre', 'preun', - 'post', 'postun', 'verifyscript', 'files', - 'changelog', 'triggerin', 'triggerpostin', - 'triggerun', 'triggerpostun'): + if matched in self.section_identifiers: in_preamble = False continue self._parse_gbp_tag(linenum, lineobj) |