[gcc-python-plugin] 0.6-3: add hard requirement on the exact gcc version the plugin was built with
dmalcolm
dmalcolm at fedoraproject.org
Mon Oct 3 19:44:51 UTC 2011
commit 4fabc53d12d03cad2f8f5dcc0b0c1c5187e9f7d7
Author: David Malcolm <dmalcolm at redhat.com>
Date: Mon Oct 3 15:43:46 2011 -0400
0.6-3: add hard requirement on the exact gcc version the plugin was built with
* Mon Oct 3 2011 David Malcolm <dmalcolm at redhat.com> - 0.6-3
- add hard requirement on the exact gcc version the plugin was built with
gcc-python-plugin.spec | 66 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 65 insertions(+), 1 deletions(-)
---
diff --git a/gcc-python-plugin.spec b/gcc-python-plugin.spec
index cc01608..2283e23 100644
--- a/gcc-python-plugin.spec
+++ b/gcc-python-plugin.spec
@@ -1,6 +1,45 @@
+# GCC will only load plugins that were built against exactly that build of GCC
+# We thus need to embed the exact GCC version as a requirement within the
+# metadata.
+#
+# Define "gcc_vr", a variable to hold the VERSION-RELEASE string for the gcc
+# we are being built against.
+#
+# Unfortunately, we can't simply run:
+# rpm -q --qf="%{version}-%{release}"
+# to determine this, as there's no guarantee of a sane rpm database within
+# the chroots created by our build system
+#
+# So we instead query the version from gcc's output.
+#
+# gcc.spec has:
+# Version: %{gcc_version}
+# Release: %{gcc_release}%{?dist}
+# ...snip...
+# echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
+
+# So, given this output:
+#
+# $ gcc --version
+# gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
+# Copyright (C) 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# we can scrape out the "4.6.1-9" from the version line.
+#
+# We then have to add the dist tag; which we must hope is the same as what we
+# have
+#
+# The following implements the above:
+%global gcc_vr %(gcc --version | python -c "import re; import sys; print(re.match(r'.*\\(Red Hat (.+)\\).*', sys.stdin.read()).group(1))")%{dist}
+
+# Define a boolean to make it easy to turn the above off, in case it fails:
+%global with_hard_gcc_version_requirement 1
+
Name: gcc-python-plugin
Version: 0.6
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: GCC plugin that embeds Python
Group: Development/Languages
@@ -50,6 +89,11 @@ Summary: GCC plugin embedding Python 2
Group: Development/Languages
Requires: python-six
Requires: python-pygments
+%if %{with_hard_gcc_version_requirement}
+Requires: gcc = %{gcc_vr}
+%else
+Requires: gcc
+%endif
%description -n gcc-python2-plugin
GCC plugin embedding Python 2
@@ -59,6 +103,11 @@ Summary: GCC plugin embedding Python 3
Group: Development/Languages
Requires: python3-six
Requires: python3-pygments
+%if %{with_hard_gcc_version_requirement}
+Requires: gcc = %{gcc_vr}
+%else
+Requires: gcc
+%endif
%description -n gcc-python3-plugin
GCC plugin embedding Python 3
@@ -68,6 +117,11 @@ Summary: GCC plugin embedding Python 2 debug build
Group: Development/Languages
Requires: python-six
Requires: python-pygments
+%if %{with_hard_gcc_version_requirement}
+Requires: gcc = %{gcc_vr}
+%else
+Requires: gcc
+%endif
%description -n gcc-python2-debug-plugin
GCC plugin embedding debug build of Python 2
@@ -77,6 +131,11 @@ Summary: GCC plugin embedding Python 3 debug build
Group: Development/Languages
Requires: python3-six
Requires: python3-pygments
+%if %{with_hard_gcc_version_requirement}
+Requires: gcc = %{gcc_vr}
+%else
+Requires: gcc
+%endif
%description -n gcc-python3-debug-plugin
GCC plugin embedding debug build of Python 3
@@ -96,6 +155,8 @@ This package contains API documentation for the GCC Python plugin
%build
+echo "gcc_vr: %{gcc_vr}"
+
BuildPlugin() {
PythonExe=$1
PythonConfig=$2
@@ -338,6 +399,9 @@ CheckPlugin \
%doc examples
%changelog
+* Mon Oct 3 2011 David Malcolm <dmalcolm at redhat.com> - 0.6-3
+- add hard requirement on the exact gcc version the plugin was built with
+
* Mon Sep 19 2011 David Malcolm <dmalcolm at redhat.com> - 0.6-2
- fix include paths against gcc-4.6.1-7.fc16 onwards (rhbz#728011)
More information about the scm-commits
mailing list