pcpa pushed to sagemath (master). "Rework build to remove buildroot references"

notifications at fedoraproject.org notifications at fedoraproject.org
Sat Apr 4 16:43:46 UTC 2015


>From 7531f3c2df8989d3564afacbdcc6d6e6efc79fc2 Mon Sep 17 00:00:00 2001
From: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
Date: Sat, 4 Apr 2015 13:43:41 -0300
Subject: Rework build to remove buildroot references


diff --git a/sagemath-sagenb.patch b/sagemath-sagenb.patch
index 0158b7d..d4d87ad 100644
--- a/sagemath-sagenb.patch
+++ b/sagemath-sagenb.patch
@@ -45,8 +45,8 @@ diff -up build/pkgs/sagenb/src/sagenb-0.11.4/sagenb/misc/misc.py.orig build/pkgs
  SAGENB_ROOT = os.path.split(resource_filename(__name__, ''))[0]
  
 -DATA = os.path.join(SAGENB_ROOT, 'data')
-+from sage.misc.misc import SAGE_SRC
-+DATA = os.path.join(SAGE_SRC, 'sagenb', 'data')
++import sage.env
++DATA = os.path.join(sage.env.SAGE_SRC, 'sagenb', 'data')
  
  if os.environ.has_key('DOT_SAGENB'):
      DOT_SAGENB = os.environ['DOT_SAGENB']
diff --git a/sagemath.spec b/sagemath.spec
index 680b61c..51a7379 100644
--- a/sagemath.spec
+++ b/sagemath.spec
@@ -1,19 +1,22 @@
 %global __provides_exclude_from	.*/site-packages/.*\\.so
 
+# for faster full rpm test builds
+%bcond_without docs
+
 # not functional due to missing jar dependencies
-%global with_sage3d		0
+%bcond_with sage3d
 
 # use an workaround to match upstream sagemath patched sphinx
-%global with_sphinx_hack	1
+%bcond_without sphinx_hack
 
 %ifarch x86_64
-%global have_fes		1
+%bcond_without fes
 %else
-%global have_fes		0
+%bcond_with fes
 %endif
 
 # set to run sage -testall in %%install
-%global with_check		0
+%bcond_with check
 %global SAGE_TIMEOUT		60
 %global SAGE_TIMEOUT_LONG	180
 
@@ -158,7 +161,7 @@ BuildRequires:	dvipng
 BuildRequires:	ecl
 BuildRequires:	eclib-devel
 BuildRequires:	factory-devel
-%if %{have_fes}
+%if %{with fes}
 BuildRequires:	fes-devel
 %endif
 BuildRequires:	flint-devel >= 2.3
@@ -393,6 +396,7 @@ Requires:	%{name}%{?_isa} = %{version}-%{release}
 This package contains the header files and development documentation
 for %{name}.
 
+%if %{with docs}
 #------------------------------------------------------------------------
 %package	doc
 Summary:	Documentation infrastructure files for %{name}
@@ -491,6 +495,8 @@ BuildArch:	noarch
 
 %description	doc-tr
 This package contains the Turkish %{name} documentation.
+# with docs
+%endif
 
 #------------------------------------------------------------------------
 %package	notebook
@@ -627,7 +633,7 @@ popd
 %patch18
 %patch19
 
-%if %{have_fes}
+%if %{with fes}
 %patch20
 %endif
 
@@ -725,6 +731,14 @@ pushd build/pkgs/rubiks/src
     make %{?_smp_mflags} CC="gcc -fPIC" CXX="g++ -fPIC" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}"
 popd
 
+# Remove buildroot reference from cython comments
+perl -pi -e 's|%{buildroot}||g;' `find src/build/cythonized -type f`
+# Try hard to remove buildroot from binaries
+rm -f `grep -lr "%{buildroot}" src/build/lib.linux-*/`
+pushd src
+    python ./setup.py build
+popd
+
 # last build command
 rm -fr $DOT_SAGE
 
@@ -762,9 +776,11 @@ pushd src
     python setup.py install --root=%{buildroot}
     cp -fa c_lib/libcsage.so.0 %{buildroot}%{_libdir}
     ln -sf libcsage.so.0 %{buildroot}%{_libdir}/libcsage.so
+%if %{with docs}
     # install documentation sources
     rm -fr $SAGE_DOC/{common,en,fr}
     cp -far doc/{common,ca,de,en,fr,hu,it,pt,ru,tr} $SAGE_DOC
+%endif
 popd
 
 #------------------------------------------------------------------------
@@ -775,7 +791,7 @@ pushd build/pkgs/sagenb/src/%{sagenb_pkg}
     ln -sf %{_jsdir}/jsmol $SAGE_SHARE/jsmol
     # sage3d
     rm -f %{buildroot}%{_bindir}/sage3d
-%if %{with_sage3d}
+%if %{with sage3d}
     ln -sf %{SAGE_LOCAL}/bin/sage3d %{buildroot}%{python_sitearch}/sagenb/data/sage3d/sage3d
 %endif
     ln -sf %{python_sitearch}/sagenb %{buildroot}%{SAGE_SRC}/sagenb
@@ -956,7 +972,7 @@ EOF
 chmod +x %{buildroot}%{_bindir}/sage
 
 #------------------------------------------------------------------------
-%if %{with_sage3d}
+%if %{with sage3d}
 cat > %{buildroot}%{SAGE_LOCAL}/bin/sage3d << EOF
 #!/bin/sh
 
@@ -981,6 +997,7 @@ pushd src
     touch %{buildroot}%{python_sitearch}/sage/libs/gmp/__init__.py
 popd
 
+%if %{with docs}
 #------------------------------------------------------------------------
 cp -f $SAGE_PYTHONPATH/{ANSI,FSM,pexpect,pxssh,screen}.py %{buildroot}%{python_sitearch}
 
@@ -993,7 +1010,7 @@ pushd src/doc
     export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:%{_libdir}/atlas:$LD_LIBRARY_PATH
     export PYTHONPATH=%{buildroot}%{python_sitearch}:$SAGE_PYTHONPATH:$SAGE_DOC
 
-%if %{with_sphinx_hack}
+%if %{with sphinx_hack}
     cp -far %{python_sitelib}/sphinx %{buildroot}%{python_sitearch}
     sed -i "s|\(source.startswith('>>>')\)|\1 or source.startswith('sage: ')|" \
 	%{buildroot}%{python_sitearch}/sphinx/highlighting.py
@@ -1009,7 +1026,7 @@ pushd src/doc
     rm -fr $SAGE_DOC/output/doctrees
 popd
 
-%if %{with_check}
+%if %{with check}
 export SAGE_TIMEOUT=%{SAGE_TIMEOUT}
 export SAGE_TIMEOUT_LONG=%{SAGE_TIMEOUT_LONG}
 sage -testall --verbose || :
@@ -1020,17 +1037,19 @@ sed -i 's|%{buildroot}||g' $SAGE_DOC/test.log
 
     rm -f %{buildroot}%{python_sitearch}/{ANSI,FSM,pexpect,pxssh,screen}.py{,c}
 
-%if %{with_sphinx_hack}
+%if %{with sphinx_hack}
     rm -fr %{buildroot}%{python_sitearch}/sphinx
 %endif
 
-# Script was used to build documentation 
-perl -pi -e 's|%{buildroot}||g;s|^##||g;' %{buildroot}%{_bindir}/sage
-
 # More wrong buildroot references
 perl -pi -e 's|%{buildroot}||g;' \
 	 -e "s|$PWD/src/doc|%{SAGE_DOC}|g;" \
     %{buildroot}%{SAGE_DOC}/output/html/en/reference/todolist.html
+# with docs
+%endif
+
+# Script was used to build documentation
+perl -pi -e 's|%{buildroot}||g;s|^##||g;' %{buildroot}%{_bindir}/sage
 
 #------------------------------------------------------------------------
 # Fix links
@@ -1072,12 +1091,15 @@ for file in `find %{buildroot} -name \*.py`; do
 	chmod +x $file
     fi
 done
+
+%if %{with doc}
 chmod -x %{buildroot}%{SAGE_DOC}/en/prep/media/Rplot001.png
 
 # Documentation is not rebuilt (also corrects rpmlint warning of hidden file)
 find %{buildroot}%{SAGE_DOC} -name .buildinfo -exec rm {} \;
 rm -fr %{buildroot}%{SAGE_DOC}/output/inventory
 find %{buildroot}%{SAGE_DOC} -type d -name _sources | xargs rm -fr
+%endif
 
 # remove bundles fonts
 rm -r %{buildroot}%{python_sitearch}/sagenb/data/mathjax/fonts
@@ -1085,7 +1107,7 @@ rm -r %{buildroot}%{python_sitearch}/sagenb/data/mathjax/fonts
 # remove .po files
 rm %{buildroot}%{python_sitearch}/sagenb/translations/*/LC_MESSAGES/*.po
 
-%if !%{with_sage3d}
+%if %{without sage3d}
 rm -r %{buildroot}%{python_sitearch}/sagenb/data/sage3d
 %endif
 
@@ -1193,6 +1215,7 @@ exit 0
 %{_includedir}/csage
 %{_libdir}/libcsage.so
 
+%if %{with docs}
 #------------------------------------------------------------------------
 %files		doc
 # GPLv2+
@@ -1254,6 +1277,8 @@ exit 0
 # GPLv2+
 %{SAGE_DOC}/tr
 %{SAGE_DOC}/output/html/tr
+# with docs
+%endif
 
 #------------------------------------------------------------------------
 %files		notebook
@@ -1285,7 +1310,7 @@ exit 0
 %{python_sitearch}/sagenb/data/openid-realselector
 # GPLv2+
 %{python_sitearch}/sagenb/data/sage
-%if %{with_sage3d}
+%if %{with sage3d}
 # GPLv2+
 %{python_sitearch}/sagenb/data/sage3d
 %endif
@@ -1346,6 +1371,9 @@ exit 0
 - Update to sagemath 6.5
 - Add new Catalan and Hungarian doc subpackages
 - Add customizations to not need a patched pari
+- Add "with docs" test build option
+- Convert build conditionals to use bcond
+- Correct deprecated warning when loading sagenb
 
 * Sat Feb  7 2015 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 6.4.1-4
 - Rebuild with a functional jsmol interface (#1190356)
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/sagemath.git/commit/?h=master&id=7531f3c2df8989d3564afacbdcc6d6e6efc79fc2


More information about the scm-commits mailing list