Hello community,

here is the log from the commit of package cmake for openSUSE:Factory checked 
in at 2015-04-07 09:26:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cmake (Old)
 and      /work/SRC/openSUSE:Factory/.cmake.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cmake"

Changes:
--------
--- /work/SRC/openSUSE:Factory/cmake/cmake.changes      2015-03-18 
14:35:59.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.cmake.new/cmake.changes 2015-04-07 
09:26:50.000000000 +0200
@@ -1,0 +2,6 @@
+Sat Apr  4 19:35:33 UTC 2015 - hrvoje.sen...@gmail.com
+
+- Let CMake produces automatic RPM provides (added cmake.attr and
+  cmake.prov as sources)
+
+-------------------------------------------------------------------

New:
----
  cmake.attr
  cmake.prov

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cmake.spec ++++++
--- /var/tmp/diff_new_pack.Kqv6hP/_old  2015-04-07 09:26:51.000000000 +0200
+++ /var/tmp/diff_new_pack.Kqv6hP/_new  2015-04-07 09:26:51.000000000 +0200
@@ -26,6 +26,8 @@
 Source0:        http://www.cmake.org/files/v3.2/%{name}-%{version}.tar.gz
 Source1:        cmake.macros
 Source2:        opensuse_rules.cmake
+Source3:        cmake.attr
+Source4:        cmake.prov
 Patch2:         cmake-fix-ruby-test.patch
 # PATCH-FIX-UPSTREAM form.patch -- set the correct include path for the 
ncurses includes
 Patch4:         form.patch
@@ -93,6 +95,10 @@
     -e 's:OPTFLAGS:%{optflags}:g' \
     %{buildroot}%{_datadir}/cmake/Modules/opensuse_rules.cmake
 
+# RPM auto provides
+install -p -m0644 -D %{SOURCE3} 
%{buildroot}%{_prefix}/lib/rpm/fileattrs/cmake.attr
+install -p -m0755 -D %{SOURCE4} %{buildroot}%{_prefix}/lib/rpm/cmake.prov
+
 %fdupes %{buildroot}%{_datadir}/cmake
 
 %check
@@ -130,6 +136,8 @@
 %files
 %defattr(-,root,root)
 %config %{_sysconfdir}/rpm/macros.cmake
+%{_prefix}/lib/rpm/fileattrs/cmake.attr
+%{_prefix}/lib/rpm/cmake.prov
 %{_bindir}/cpack
 %{_bindir}/cmake
 %{_bindir}/ctest

++++++ cmake.attr ++++++
%__cmake_provides       %{_rpmconfigdir}/cmake.prov
%__cmake_path           
^/usr/lib(64)/cmake/.*/.*(Config\.cmake|-config\.cmake)$++++++ cmake.prov ++++++
#!/usr/bin/python
# -*- coding:utf-8 -*-
#
# Copyright (C) 2015 Daniel Vrátil <dvra...@redhat.com>
#
#
# 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

class CMakeParser:
    def __init__(self, filelist = None):
        if filelist == None:
            filelist = sys.stdin

        paths = map(lambda x: x.rstrip(), filelist.readlines())
        for path in paths:
            modulePath, cmakeModule, lowercase = 
self.parseCmakeModuleConfig(path)
            if modulePath and cmakeModule:
                version = self.resolveCMakeModuleVersion(modulePath, 
cmakeModule, lowercase)

                if version:
                    print("cmake(%s) = %s" % (cmakeModule, version))
                else:
                    print("cmake(%s)" % cmakeModule)


    def parseCmakeModuleConfig(self, configFile):
        paths = configFile.rsplit("/", 3)

        modulePath = "%s/cmake/%s" % (paths[0], paths[2])

        lowercase = False
        configFile = glob.glob("%s/*Config.cmake" % modulePath)
        if not configFile:
            configFile = glob.glob("%s/*-config.cmake" % modulePath)
            lowercase = True
        if not configFile:
            return (None, None)

        if lowercase:
            moduleName = configFile[0][len(modulePath) + 
1:-len("-config.cmake")]
        else:
            moduleName = configFile[0][len(modulePath) + 1:-len("Config.cmake")]

        return (modulePath, moduleName, lowercase)

    def resolveCMakeModuleVersion(self, modulePath, cmakeModule, lowercase):
        versionFile = ("%s/%s-config-version.cmake" if lowercase else 
"%s/%sConfigVersion.cmake") % (modulePath, cmakeModule)
        try:
            f = open(versionFile, 'r')
        except:
            return None

        for line in f:
            line = line.strip()

            # set(PACKAGE_VERSION <version>)
            version = re.match(r"^set[\ ]*\([\ ]*PACKAGE_VERSION[\ 
]+[\"]*([0-9\.]+)[\"]*[\ ]*[.]*\)", line)
            if version:
                return version.groups(1)[0]

        return None

if __name__ == "__main__":
    parser = CMakeParser()

Reply via email to