From 2af51ea2c233c20de6587512a545536bf5cda99429ed2d66e3cdb1a1a6edaffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Thu, 15 Sep 2011 13:31:32 +0000 Subject: [PATCH] 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 --- spec-cleaner | 15 ++++++++++----- spec-cleaner.changes | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/spec-cleaner b/spec-cleaner index 8de1d2b..d7588da 100644 --- a/spec-cleaner +++ b/spec-cleaner @@ -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", diff --git a/spec-cleaner.changes b/spec-cleaner.changes index 7794d0b..b742253 100644 --- a/spec-cleaner.changes +++ b/spec-cleaner.changes @@ -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