From 7189ad629ca19c305ed12549eb671ae19777a6efee9066947050b817fa5ba5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Tue, 3 May 2011 19:47:10 +0000 Subject: [PATCH] Accepting request 69282 from home:vuntz Update to 0.2 OBS-URL: https://build.opensuse.org/request/show/69282 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/spec-cleaner?expand=0&rev=3 --- spec-cleaner | 59 +++++++++++++++++++++++++++++++------------- spec-cleaner.changes | 21 ++++++++++++++++ spec-cleaner.spec | 4 +-- 3 files changed, 65 insertions(+), 19 deletions(-) diff --git a/spec-cleaner b/spec-cleaner index 7ca5922..00c0d92 100644 --- a/spec-cleaner +++ b/spec-cleaner @@ -51,7 +51,7 @@ import shlex ####################################################################### -VERSION = '0.1' +VERSION = '0.2' re_comment = re.compile('^$|^\s*#') re_define = re.compile('^\s*%define', re.IGNORECASE) @@ -143,13 +143,18 @@ def replace_utils(s): def replace_buildservice(s): for i in ['centos', 'debian', 'fedora', 'mandriva', 'meego', 'rhel', 'sles', 'suse', 'ubuntu']: - s = s.replace('%' + i + '_version', '0%{?' + i + '_version}') - s = s.replace('%{' + i + '_version}', '0%{?' + i + '_version}') + s = s.replace('%' + i + '_version', '0%{?' + i + '_version}').replace('00%{','0%{') + s = s.replace('%{' + i + '_version}', '0%{?' + i + '_version}').replace('00%{','0%{') return s -def replace_macros(s): +def replace_preamble_macros(s): for i in ['name', 'version', 'release']: s = s.replace('%' + i, '%{' + i + '}') + for i in map(str,range(100)): + s = s.replace('%{P:' + i + '}', '%{PATCH' + i + '}') + s = s.replace('%PATCH' + i, '%{PATCH' + i + '}') + s = s.replace('%{S:' + i + '}', '%{SOURCE' + i + '}') + s = s.replace('%SOURCE' + i, '%{SOURCE' + i + '}') return s def replace_all(s): @@ -159,7 +164,7 @@ def replace_all(s): s = replace_remove_la(s) s = replace_utils(s) s = replace_buildservice(s) - s = replace_macros(s) + s = replace_preamble_macros(s) return s @@ -261,7 +266,7 @@ class RpmPreamble(RpmSection): re_version = re.compile('^Version:\s*(\S*)', re.IGNORECASE) re_release = re.compile('^Release:\s*(\S*)', re.IGNORECASE) re_license = re.compile('^License:\s*(.*)', re.IGNORECASE) - re_summary = re.compile('^Summary:\s*(.*)', re.IGNORECASE) + re_summary = re.compile('^Summary:\s*([^\.]*).*', re.IGNORECASE) re_url = re.compile('^Url:\s*(\S*)', re.IGNORECASE) re_group = re.compile('^Group:\s*(.*)', re.IGNORECASE) re_source = re.compile('^Source(\d*):\s*(\S*)', re.IGNORECASE) @@ -335,7 +340,11 @@ class RpmPreamble(RpmSection): 'GPL v2 only': 'GPLv2', 'GPL v2 or later': 'GPLv2+', 'GPL v3 only': 'GPLv3', - 'GPL v3 or later': 'GPLv3+' + 'GPL v3 or later': 'GPLv3+', + 'FDL 1.1': 'FDLv1.1', + 'FDL 1.2': 'FDLv1.2', + 'FDL 1.2 or later': 'FDLv1.2+', + 'FDL 1.3': 'FDLv1.3' } categories_order = [ 'name', 'version', 'release', 'license', 'summary', 'url', 'group', 'source', 'patch', 'buildrequires', 'prereq', 'requires', 'recommends', 'suggests', 'supplements', 'provides_obsoletes', 'buildroot', 'buildarch', 'misc' ] @@ -375,12 +384,19 @@ class RpmPreamble(RpmSection): def sort_helper_key(a): t = type(a) if t == str: - return a + key = a elif t == list: - return a[-1] + key = a[-1] else: raise RpmException('Unknown type during sort: %s' % t) + # Put pkgconfig()-style packages at the end of the list, after all + # non-pkgconfig()-style packages + if key.find('pkgconfig(') != -1: + return '1'+key + else: + return '0'+key + for i in self.categories_order: if i in self.categories_with_sorted_package_tokens: self.paragraph[i].sort(key=sort_helper_key) @@ -413,15 +429,20 @@ class RpmPreamble(RpmSection): 'dbus-1-devel': 'dbus-1', 'dbus-1-glib-devel': 'dbus-glib-1', 'gconf2-devel': 'gconf-2.0', + 'gstreamer-0_10-devel': 'gstreamer-0.10', 'exo-devel': 'exo-1', 'glib2-devel': 'glib-2.0', 'gtk2-devel': 'gtk+-2.0', 'hal-devel': 'hal', + 'ImageMagick-devel': 'ImageMagick', + 'libapr1-devel': 'apr-1', + 'libapr-util1-devel': 'apr-util-1', 'libexif-devel': 'libexif', 'libgarcon-devel': 'garcon-1', 'libglade2-devel': 'libglade-2.0', 'libgladeui-1_0-devel': 'gladeui-1.0', 'libgudev-1_0-devel': 'gudev-1.0', + 'libical-devel': 'libical', 'libnotify-devel': 'libnotify', 'libwnck-devel': 'libwnck-1.0', 'libxfce4ui-devel': 'libxfce4ui-1', @@ -430,7 +451,9 @@ class RpmPreamble(RpmSection): 'libxfconf-devel': 'libxfconf-0', 'libxklavier-devel': 'libxklavier', 'libxml2-devel': 'libxml-2.0', + 'pango-devel': 'pango', 'startup-notification-devel': 'libstartup-notification-1.0', + 'vte-devel': 'vte', 'xfce4-panel-devel': 'libxfce4panel-1.0', } for i in r: @@ -536,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/Packaging/Patches') + self.current_group.append('# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines') match = self.re_patch.match(line) # convert Patch: to Patch0: @@ -647,7 +670,7 @@ class RpmPrep(RpmSection): cmp_line = strip_useless_spaces(cmp_line) if cmp_line == '%setup': line = '%setup -q' - if line.startswith('%patch '): + if line.startswith('%patch ') or line == '%patch': line = line.replace('%patch','%patch0') RpmSection.add(self, line) @@ -663,11 +686,13 @@ class RpmBuild(RpmSection): def add(self, line): if not re_comment.match(line): - line = line.replace('%_smp_mflags' , '%{?_smp_mflags}') - line = line.replace('%{_smp_mflags}' , '%{?_smp_mflags}') - line = line.replace('%{?jobs:-j%jobs}' , '%{?_smp_mflags}') - line = line.replace('%{?jobs: -j%jobs}', '%{?_smp_mflags}') - line = line.replace('%{?jobs:-j %jobs}', '%{?_smp_mflags}') + line = line.replace('%_smp_mflags' , '%{?_smp_mflags}') + line = line.replace('%{_smp_mflags}' , '%{?_smp_mflags}') + line = line.replace('%{?jobs:-j%jobs}' , '%{?_smp_mflags}') + line = line.replace('%{?jobs: -j%jobs}' , '%{?_smp_mflags}') + line = line.replace('%{?jobs:-j %jobs}' , '%{?_smp_mflags}') + line = line.replace('%{?jobs:-j%{jobs}}' , '%{?_smp_mflags}') + line = line.replace('%{?jobs:-j %{jobs}}', '%{?_smp_mflags}') RpmSection.add(self, line) @@ -872,7 +897,7 @@ class RpmSpecCleaner: self.fin = io self.fout = open(self.specfile, 'w') elif self.diff: - self.fout = tempfile.NamedTemporaryFile(prefix=self.specfile) + self.fout = tempfile.NamedTemporaryFile(prefix=self.specfile+'.', suffix='.spec') else: self.fout = sys.stdout diff --git a/spec-cleaner.changes b/spec-cleaner.changes index 5c284d8..7c4435e 100644 --- a/spec-cleaner.changes +++ b/spec-cleaner.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Mon May 2 18:38:05 CEST 2011 - vuntz@opensuse.org + +- Update to version 0.2: + + Handle suse_version + + Do not check for AutoReqProv in %install + + Replace %makeinstall by %make_install + + Reformat versioned package names too + + Remove #usedforbuild + + Replace Patch: with Patch0: (and %patch with %patch0) + + Change default .spec headers to not include any license + + Replace some package names with pkgconfig()-style names + + Add --diff and --diff-prog options + + Put brackets around %name, %version, %release, ... + + Update url for PATCH-MISSING-TAGw + + Cut summary after the first dot + + Add FDL licenses + + Add .spec extension to spec files created by script + + Put pkgconfig()-style package names at the end of their list + + Code improvements + ------------------------------------------------------------------- Mon Dec 6 11:41:07 UTC 2010 - prusnak@opensuse.org diff --git a/spec-cleaner.spec b/spec-cleaner.spec index b895820..4afce0d 100644 --- a/spec-cleaner.spec +++ b/spec-cleaner.spec @@ -1,5 +1,5 @@ # -# spec file for package spec-cleaner (version 0.1) +# spec file for package spec-cleaner # # Copyright (c) 2010 Vincent Untz # @@ -16,7 +16,7 @@ # Name: spec-cleaner -Version: 0.1 +Version: 0.2 Release: 1 License: BSD 3-Clause Summary: .spec file cleaner