Add cmake.req to autogenerate proper depency on cmake-filesystem

This commit is contained in:
Björn Esser 2017-08-02 18:53:08 +02:00
parent 4dec04629a
commit 7cb318c85b
2 changed files with 81 additions and 1 deletions

71
cmake.req Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
#
# Copyright (C) 2017 Björn Esser <besser82@fedoraproject.org>
#
# based on cmake.prov, which is
# Copyright (C) 2015 Daniel Vrátil <dvratil@redhat.com>
# Copyright (C) 2017 Daniel Vrátil <dvratil@fedoraproject.org>
#
#
# 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()

View File

@ -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 <besser82@fedoraproject.org> - 3.9.0-7
- Add cmake.req to autogenerate proper depency on cmake-filesystem
* Wed Aug 02 2017 Björn Esser <besser82@fedoraproject.org> - 3.9.0-6
- Fix cmake-gui being picked up by main package