Accepting request 81885 from home:prusnak:branches:openSUSE:Tools

- synchronize obs and git changes

OBS-URL: https://build.opensuse.org/request/show/81885
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/spec-cleaner?expand=0&rev=5
This commit is contained in:
Adrian Schröter 2011-09-15 13:31:32 +00:00 committed by Git OBS Bridge
parent 60c3b5fe85
commit 2af51ea2c2
2 changed files with 15 additions and 5 deletions

View File

@ -316,7 +316,7 @@ class RpmPreamble(RpmSection):
'source': 'Source',
'patch': 'Patch',
'buildrequires': 'BuildRequires',
'prereq': 'PreReq',
'prereq': 'Requires(pre)',
'requires': 'Requires',
'recommends': 'Recommends',
'suggests': 'Suggests',
@ -559,7 +559,7 @@ class RpmPreamble(RpmSection):
elif self.re_patch.match(line):
# FIXME: this is not perfect, but it's good enough for most cases
if not self.previous_line or not re_comment.match(self.previous_line):
self.current_group.append('# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines')
self.current_group.append('# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines')
match = self.re_patch.match(line)
# convert Patch: to Patch0:
@ -663,6 +663,8 @@ class RpmPrep(RpmSection):
Replace %patch with %patch0
'''
re_patch = re.compile('^%patch\s*(.*)-P\s*(\d*)\s*(.*)')
def add(self, line):
if line.startswith('%setup'):
cmp_line = line.replace(' -q', '')
@ -670,7 +672,10 @@ class RpmPrep(RpmSection):
cmp_line = strip_useless_spaces(cmp_line)
if cmp_line == '%setup':
line = '%setup -q'
if line.startswith('%patch ') or line == '%patch':
if self.re_patch.match(line):
match = self.re_patch.match(line)
line = strip_useless_spaces('%%patch%s %s %s' % (match.group(2), match.group(1), match.group(3)))
elif line.startswith('%patch ') or line == '%patch':
line = line.replace('%patch','%patch0')
RpmSection.add(self, line)
@ -958,8 +963,8 @@ class RpmSpecCleaner:
def main(args):
parser = optparse.OptionParser(
usage='usage: %prog [options] $package.spec',
epilog='''This script cleans the given spec file according to some arbitrary style guide and prints the result.
usage='usage: %prog [options] package.spec',
epilog='''This script cleans the given spec file according to some arbitrary style guide and prints the result.
The results it produces should always be checked by someone since it is not and will never be perfect.''')
parser.add_option("-i", "--inline", action="store_true", dest="inline",

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Sep 12 08:00:40 UTC 2011 - prusnak@opensuse.org
- synchronize obs and git changes
-------------------------------------------------------------------
Thu Jul 14 10:28:13 UTC 2011 - giecrilj@stegny.2a.pl