From 7cb318c85bf0d850ba2148c4024c6d6434d80b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Wed, 2 Aug 2017 18:53:08 +0200 Subject: [PATCH] Add cmake.req to autogenerate proper depency on cmake-filesystem --- cmake.req | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ cmake.spec | 11 ++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 cmake.req diff --git a/cmake.req b/cmake.req new file mode 100644 index 0000000..96c9086 --- /dev/null +++ b/cmake.req @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- +# +# Copyright (C) 2017 Björn Esser +# +# based on cmake.prov, which is +# Copyright (C) 2015 Daniel Vrátil +# Copyright (C) 2017 Daniel Vrátil +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +import sys +import re +import glob +import subprocess + +class CMakeParser: + def __init__(self, filelist = None): + if filelist == None: + filelist = sys.stdin + + has_module = False + is_arched = False + + isa_suf = subprocess.check_output(["/usr/bin/rpm", "-E %{?_isa}"]).decode().strip() + + paths = map(lambda x: x.rstrip(), filelist.readlines()) + for path in paths: + modulePath, cmakeModule, lowercase = self.parseCmakeModuleConfig(path) + if modulePath and cmakeModule: + has_module = True + if re.match("/usr/lib.*", path): + is_arched = True + + if has_module: + if is_arched: + print("cmake-filesystem%s" % isa_suf) + else: + print("cmake-filesystem") + + + def parseCmakeModuleConfig(self, configFile): + paths = configFile.rsplit("/", 3) + + modulePath = "%s/cmake/%s" % (paths[0], paths[2]) + cfgFile = paths[3] + if cfgFile.endswith("Config.cmake"): + return (modulePath, cfgFile[0:-len("Config.cmake")], False) + elif cfgFile.endswith("-config.cmake"): + return (modulePath, cfgFile[0:-len("-config.cmake")], True) + else: + return (None, None, False) + + +if __name__ == "__main__": + parser = CMakeParser() diff --git a/cmake.spec b/cmake.spec index b2baa63..9a42955 100644 --- a/cmake.spec +++ b/cmake.spec @@ -41,7 +41,7 @@ Name: %{orig_name}%{?name_suffix} Version: %{major_version}.%{minor_version}.0 -Release: 6%{?relsuf}%{?dist} +Release: 7%{?relsuf}%{?dist} Summary: Cross-platform make system # most sources are BSD @@ -57,6 +57,7 @@ Source2: macros.%{name} # See https://bugzilla.redhat.com/show_bug.cgi?id=1202899 Source3: %{name}.attr Source4: %{name}.prov +Source5: %{name}.req # Always start regular patches with numbers >= 100. # We need lower numbers for patches in compat package. @@ -187,10 +188,13 @@ The %{name}-gui package contains the Qt based GUI for %{name}. %if %{with python3} echo '#!%{__python3}' > %{name}.prov +echo '#!%{__python3}' > %{name}.req %else echo '#!%{__python2}' > %{name}.prov +echo '#!%{__python2}' > %{name}.req %endif tail -n +2 %{SOURCE4} >> %{name}.prov +tail -n +2 %{SOURCE5} >> %{name}.req %build @@ -245,6 +249,7 @@ touch -r %{SOURCE2} %{buildroot}%{rpm_macros_dir}/macros.%{name} # RPM auto provides install -p -m0644 -D %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/fileattrs/%{name}.attr install -p -m0755 -D %{name}.prov %{buildroot}%{_prefix}/lib/rpm/%{name}.prov +install -p -m0755 -D %{name}.req %{buildroot}%{_prefix}/lib/rpm/%{name}.req %endif mkdir -p %{buildroot}%{_libdir}/%{orig_name} # Install copyright files for main package @@ -406,6 +411,7 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || : %if 0%{?_rpmconfigdir:1} %{_rpmconfigdir}/fileattrs/%{name}.attr %{_rpmconfigdir}/%{name}.prov +%{_rpmconfigdir}/%{name}.req %endif @@ -437,6 +443,9 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || : %changelog +* Wed Aug 02 2017 Björn Esser - 3.9.0-7 +- Add cmake.req to autogenerate proper depency on cmake-filesystem + * Wed Aug 02 2017 Björn Esser - 3.9.0-6 - Fix cmake-gui being picked up by main package