update to 5.2.1

- split fmt_build_doc_system.patch into smaller patches, to simplify
  the patch management
- drop fmt_test8_segfault.patch, as it does not apply anymore
- add patches to avoid accessing to internet via installed document
- use python3 packages to adapt fedora python3 migration
- drop fmt-static package, as it's non-trivial to build static and
  shared libraries in a single run. and it's not encouraged to ship
  static library, see
https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries_2
- package ChangeLog.rst README.rst in fmt package, to help use
  to understand the latest changes, and to silence rpmlint warnings
- pass cmake options in multiple lines, to have less code churn of
  future changes.
- drop DCMAKE_SKIP_RPATH=OFF, as RHEL6 is not supported anymore
- use %make_build and %make_install macros, see
  https://fedoraproject.org/wiki/Packaging:Cmake
- bump up packaged fmt to v5.2.1

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2018-10-13 11:06:43 +08:00
parent 6e4c11409f
commit 591078f81f
11 changed files with 334 additions and 130 deletions

View File

@ -0,0 +1,29 @@
From: "Eugene V. Lyubimkin" <jackyf@iki.fi>
Date: Sat, 7 Nov 2015 19:49:54 +0100
Subject: doc: _templates: layout: stripped Google Analytics
---
doc/_templates/layout.html | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html
index 0ac2dec..8f5dfd9 100644
--- a/doc/_templates/layout.html
+++ b/doc/_templates/layout.html
@@ -5,16 +5,6 @@
<meta name="keywords" content="C++, formatting, printf, string, library">
<meta name="author" content="Victor Zverovich">
<link rel="stylesheet" href="_static/fmt.css">
-{# Google Analytics #}
-<script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();
- a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;
- a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-20116650-4', 'fmtlib.net');
- ga('send', 'pageview');
-</script>
{% endblock %}
{%- macro searchform(classes, button) %}

View File

@ -0,0 +1,58 @@
From: "Eugene V. Lyubimkin" <jackyf@iki.fi>
Date: Sat, 7 Nov 2015 19:53:09 +0100
Subject: doc: _templates: layout: stripped download links
---
doc/_templates/layout.html | 29 +----------------------------
1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html
index 8f5dfd9..7bc00fc 100644
--- a/doc/_templates/layout.html
+++ b/doc/_templates/layout.html
@@ -38,20 +38,9 @@
</button>
<a class="navbar-brand" href="index.html">{fmt}</a>
</div>
-
{# Collect the nav links, forms, and other content for toggling #}
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown"
- role="button" aria-expanded="false">{{ version }}
- <span class="caret"></span></a>
- <ul class="dropdown-menu" role="menu">
- {% for v in versions.split(',') %}
- <li><a href="http://fmtlib.net/{{v}}">{{v}}</a></li>
- {% endfor %}
- </ul>
- </li>
{% for name in ['Contents', 'Usage', 'API', 'Syntax'] %}
{% if pagename == name.lower() %}
<li class="active"><a href="{{name.lower()}}.html">{{name}}
@@ -74,23 +63,7 @@
<div class="jumbotron">
<div class="tb-container">
<h1>{fmt}</h1>
- <p class="lead">Small, safe and fast formatting library</p>
- <div class="btn-group" role="group">
- {% set name = 'fmt' if version.split('.')[0]|int >= 3 else 'cppformat' %}
- <a class="btn btn-success"
- href="{{download_url}}/{{version}}/{{name}}-{{version}}.zip">
- <span class="glyphicon glyphicon-download"></span> Download
- </a>
- <button type="button" class="btn btn-success dropdown-toggle"
- data-toggle="dropdown"><span class="caret"></span></button>
- <ul class="dropdown-menu">
- {% for v in versions.split(',') %}
- {% set name = 'fmt' if v.split('.')[0]|int >= 3 else 'cppformat' %}
- <li><a href="{{download_url}}/{{v}}/{{name}}-{{v}}.zip">Version {{v}}
- </a></li>
- {% endfor %}
- </ul>
- </div>
+ <p class="lead">Small, safe and fast formatting library for C++</p>
</div>
</div>
{% endif %}

View File

@ -0,0 +1,37 @@
From: "Eugene V. Lyubimkin" <jackyf@iki.fi>
Date: Sat, 7 Nov 2015 19:05:57 +0100
Subject: doc: build: do not create virtual environment
Since we have no packages to fetch or locally install at the building
time.
---
doc/build.py | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/doc/build.py b/doc/build.py
index 1ce12cf..4ff82c5 100755
--- a/doc/build.py
+++ b/doc/build.py
@@ -7,16 +7,6 @@ from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
versions = ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0', '4.1.0', '5.0.0', '5.1.0', '5.2.0', '5.2.1']
-def create_build_env(dirname='virtualenv'):
- # Create virtualenv.
- if not os.path.exists(dirname):
- check_call(['virtualenv', dirname])
- import sysconfig
- scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
- activate_this_file = os.path.join(dirname, scripts_dir, 'activate_this.py')
- with open(activate_this_file) as f:
- exec(f.read(), dict(__file__=activate_this_file))
-
def build_docs(version='dev', **kwargs):
doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__)))
work_dir = kwargs.get('work_dir', '.')
@@ -65,5 +55,4 @@ def build_docs(version='dev', **kwargs):
return html_dir
if __name__ == '__main__':
- create_build_env()
build_docs(sys.argv[1])

View File

@ -0,0 +1,72 @@
From: "Eugene V. Lyubimkin" <jackyf@iki.fi>
Date: Sat, 7 Nov 2015 18:55:28 +0100
Subject: doc: build: removed all pip/internet stuff
Debian package must only use locally available packages and resources.
---
doc/build.py | 43 +------------------------------------------
1 file changed, 1 insertion(+), 42 deletions(-)
diff --git a/doc/build.py b/doc/build.py
index 5947e46..dc0d861 100755
--- a/doc/build.py
+++ b/doc/build.py
@@ -4,27 +4,9 @@
from __future__ import print_function
import errno, os, shutil, sys, tempfile
from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
-from distutils.version import LooseVersion
versions = ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0', '4.1.0', '5.0.0', '5.1.0', '5.2.0', '5.2.1']
-def pip_install(package, commit=None, **kwargs):
- "Install package using pip."
- min_version = kwargs.get('min_version')
- if min_version:
- from pkg_resources import get_distribution, DistributionNotFound
- try:
- installed_version = get_distribution(os.path.basename(package)).version
- if LooseVersion(installed_version) >= min_version:
- print('{} {} already installed'.format(package, min_version))
- return
- except DistributionNotFound:
- pass
- if commit:
- package = 'git+https://github.com/{0}.git@{1}'.format(package, commit)
- print('Installing {0}'.format(package))
- check_call(['pip', 'install', package])
-
def create_build_env(dirname='virtualenv'):
# Create virtualenv.
if not os.path.exists(dirname):
@@ -34,30 +16,6 @@ def create_build_env(dirname='virtualenv'):
activate_this_file = os.path.join(dirname, scripts_dir, 'activate_this.py')
with open(activate_this_file) as f:
exec(f.read(), dict(__file__=activate_this_file))
- # Import get_distribution after activating virtualenv to get info about
- # the correct packages.
- from pkg_resources import get_distribution, DistributionNotFound
- # Upgrade pip because installation of sphinx with pip 1.1 available on Travis
- # is broken (see #207) and it doesn't support the show command.
- pip_version = get_distribution('pip').version
- if LooseVersion(pip_version) < LooseVersion('1.5.4'):
- print("Updating pip")
- check_call(['pip', 'install', '--upgrade', 'pip'])
- # Upgrade distribute because installation of sphinx with distribute 0.6.24
- # available on Travis is broken (see #207).
- try:
- distribute_version = get_distribution('distribute').version
- if LooseVersion(distribute_version) <= LooseVersion('0.6.24'):
- print("Updating distribute")
- check_call(['pip', 'install', '--upgrade', 'distribute'])
- except DistributionNotFound:
- pass
- # Install Sphinx and Breathe.
- pip_install('sphinx-doc/sphinx', '12b83372ac9316e8cbe86e7fed889296a4cc29ee',
- min_version='1.4.1.dev20160531')
- pip_install('michaeljones/breathe',
- '129222318f7c8f865d2631e7da7b033567e7f56a',
- min_version='4.2.0')
def build_docs(version='dev', **kwargs):
doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__)))

View File

@ -0,0 +1,32 @@
From 21955af0e5a30f0cabbdf128cb27acc1ea6c28c4 Mon Sep 17 00:00:00 2001
From: Kefu Chai <tchaikov@gmail.com>
Date: Fri, 12 Oct 2018 18:10:07 +0800
Subject: doc: build use python3
use python3 as an alternative of python (python2)
---
doc/CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 66b4bd1..87ad9ec 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -4,11 +4,13 @@ if (NOT DOXYGEN)
return ()
endif ()
+find_package(PythonInterp
+ QUIET REQUIRED)
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build sphinx-build-3)
add_custom_target(doc
COMMAND ${CMAKE_COMMAND} -E env SPHINX_EXECUTABLE=${SPHINX_EXECUTABLE}
- ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}
+ ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}
SOURCES api.rst syntax.rst build.py conf.py _templates/layout.html)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
--
2.19.1

View File

@ -0,0 +1,45 @@
From f8091ad4f1fc8140dd133fa12e20435583658dbe Mon Sep 17 00:00:00 2001
From: Kefu Chai <tchaikov@gmail.com>
Date: Fri, 12 Oct 2018 14:04:04 +0800
Subject: doc: build: use sphinx-build-3
use sphinx-build-3 as an alternative of sphinx-build.
---
doc/CMakeLists.txt | 5 ++++-
doc/build.py | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index c16427a..66b4bd1 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -4,8 +4,11 @@ if (NOT DOXYGEN)
return ()
endif ()
+find_program(SPHINX_EXECUTABLE
+ NAMES sphinx-build sphinx-build-3)
add_custom_target(doc
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}
+ COMMAND ${CMAKE_COMMAND} -E env SPHINX_EXECUTABLE=${SPHINX_EXECUTABLE}
+ ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}
SOURCES api.rst syntax.rst build.py conf.py _templates/layout.html)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
diff --git a/doc/build.py b/doc/build.py
index f745ee0..19093d3 100755
--- a/doc/build.py
+++ b/doc/build.py
@@ -47,7 +47,8 @@ def build_docs(version='dev', **kwargs):
raise CalledProcessError(p.returncode, cmd)
html_dir = os.path.join(work_dir, 'html')
main_versions = reversed(versions[-3:])
- check_call(['sphinx-build',
+ sphinx_build = os.environ.get('SPHINX_EXECUTABLE', 'sphinx-build')
+ check_call([sphinx_build,
'-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir),
'-Dversion=' + version, '-Drelease=' + version,
'-Aversion=' + version, '-Aversions=' + ','.join(main_versions),
--
2.19.1

View File

@ -0,0 +1,24 @@
From: "Eugene V. Lyubimkin" <jackyf@iki.fi>
Date: Sun, 15 Oct 2017 22:28:11 +0200
Subject: doc: index: removed GitHub iframe
---
doc/index.rst | 8 --------
1 file changed, 8 deletions(-)
diff --git a/doc/index.rst b/doc/index.rst
index ce9b7bf..1363779 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -196,11 +196,3 @@ a single header file and a single source file and no external dependencies.
A permissive BSD `license <https://github.com/fmtlib/fmt#license>`_ allows
using the library both in open-source and commercial projects.
-.. raw:: html
-
- <a class="btn btn-success" href="https://github.com/fmtlib/fmt">GitHub Repository</a>
-
- <div class="section footer">
- <iframe src="http://ghbtns.com/github-btn.html?user=fmtlib&amp;repo=fmt&amp;type=watch&amp;count=true"
- class="github-btn" width="100" height="20"></iframe>
- </div>

View File

@ -1,15 +1,19 @@
Name: fmt
Version: 3.0.2
Release: 7%{?dist}
Version: 5.2.1
Release: 1%{?dist}
Summary: Small, safe and fast formatting library for C++
License: BSD
URL: https://github.com/fmtlib/fmt
Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# See https://github.com/fmtlib/fmt/issues/443 and https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/LVKYLDLJVWAVJE4MQVKDO6PYZRD5MCP6/
Patch0: fmt_build_doc_system.patch
# See https://github.com/fmtlib/fmt/issues/551
Patch1: fmt_test8_segfault.patch
Patch1: doc-build-removed-all-pip-internet-stuff.patch
Patch3: doc-build-do-not-create-virtual-environment.patch
Patch4: doc-_templates-layout-stripped-Google-Analytics.patch
Patch5: doc-_templates-layout-stripped-download-links.patch
Patch6: doc-index-removed-GitHub-iframe.patch
Patch7: doc-build-use-sphinx-build-3.patch
Patch8: doc-build-use-python3.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -21,8 +25,13 @@ BuildRequires: cmake
# For building documentation
BuildRequires: doxygen
BuildRequires: nodejs-less
%if 0%{?fedora}
BuildRequires: python3-sphinx
BuildRequires: python3-breathe
%else
BuildRequires: python2-sphinx
BuildRequires: python2-breathe
%endif
# This package replaces the old name of cppformat
Provides: cppformat = %{version}-%{release}
@ -43,13 +52,6 @@ Obsoletes: cppformat-devel < %{version}-%{release}
%description devel
This package contains the header file for using %{name}.
%package static
Summary: Header only development files for %{name}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
This package contains the files for using %{name} as a header only library.
%package doc
Summary: Documentation files for %{name}
License: Python
@ -64,53 +66,45 @@ This package contains documentation for developer documentation for %{name}.
%prep
%autosetup -p1
# Fix shebang
sed -i -e 's~#!/usr/bin/env python~#!%{_bindir}/python2~g' doc/build.py
%build
mkdir build
cd build
cmakeopts="-DFMT_LIB_DIR=%{_lib} -DFMT_CMAKE_DIR=%{_datarootdir}/cmake/%{name}"
# NOTE: Specifying CMAKE_SKIP_RPATH=OFF is so it will link properly on RHEL 6
# See https://bugzilla.redhat.com/show_bug.cgi?id=640672
%if 0%{?rhel}%{?fedora} == 6
cmakeopts="$cmakeopts -DCMAKE_SKIP_RPATH=OFF"
%endif
pushd build
%if 0%{?rhel} && 0%{?rhel} <= 7
%cmake3 \
%cmake3 .. \
%else
%cmake \
%cmake .. \
%endif
$cmakeopts ..
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DFMT_CMAKE_DIR=%{_datarootdir}/cmake/%{name} \
-DFMT_LIB_DIR=%{_libdir}
# Remove --clean-css since that plugin isn't available
sed -i "s/'--clean-css',//" ../doc/build.py
make %{?_smp_mflags} all doc
%make_build all doc
# Remove temporary build products
rm -rf ../build/doc/html/{.buildinfo,.doctrees}
rm -rf ../build/doc/html/{.buildinfo,.doctrees,objects.inv}
%install
make -C build install DESTDIR=%{buildroot}
%make_install -C build
%check
make -C build test
pushd build
ctest -VV %{?_smp_mflags}
popd
%files
%{_libdir}/libfmt.so.*
%{!?_licensedir:%global license %%doc}
%license LICENSE.rst
%doc ChangeLog.rst README.rst
%files devel
%{_includedir}/fmt/
%{_libdir}/libfmt.so
%{_datarootdir}/cmake/fmt/
%files static
%{_includedir}/fmt/format.cc
%{_includedir}/fmt/ostream.cc
%{_includedir}/fmt/ostream.h
%{_includedir}/fmt/posix.h
%{_includedir}/fmt/time.h
%files doc
%doc %{_datadir}/doc/fmt/
%license doc/python-license.txt
@ -120,6 +114,13 @@ make -C build test
%postun -p /sbin/ldconfig
%changelog
* Thu Oct 11 2018 Kefu Chai <tchaikov@gmail.com> - 5.2.1-1
- Update to 5.2.1
- Build using python3 packages on fedora
- Remove links in document accessing network
- Package ChangeLog.rst and README.rst
- Drop fmt-static package
* Fri Aug 31 2018 Leigh Scott <leigh123linux@googlemail.com> - 3.0.2-7
- Fix python2 issue for doc

View File

@ -1,56 +0,0 @@
--- a/doc/build.py
+++ b/doc/build.py
@@ -4,53 +4,9 @@
from __future__ import print_function
import errno, os, shutil, sys, tempfile
from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
-from distutils.version import LooseVersion
-
-def pip_install(package, commit=None, **kwargs):
- "Install package using pip."
- if commit:
- check_version = kwargs.get('check_version', '')
- #output = check_output(['pip', 'show', package.split('/')[1]])
- #if check_version in output:
- # print('{} already installed'.format(package))
- # return
- package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
- print('Installing {}'.format(package))
- check_call(['pip', 'install', package])
def build_docs(version='dev'):
- # Create virtualenv.
doc_dir = os.path.dirname(os.path.realpath(__file__))
- virtualenv_dir = 'virtualenv'
- check_call(['virtualenv', virtualenv_dir])
- import sysconfig
- scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
- activate_this_file = os.path.join(virtualenv_dir, scripts_dir,
- 'activate_this.py')
- with open(activate_this_file) as f:
- exec(f.read(), dict(__file__=activate_this_file))
- # Upgrade pip because installation of sphinx with pip 1.1 available on Travis
- # is broken (see #207) and it doesn't support the show command.
- from pkg_resources import get_distribution, DistributionNotFound
- pip_version = get_distribution('pip').version
- if LooseVersion(pip_version) < LooseVersion('1.5.4'):
- print("Updating pip")
- check_call(['pip', 'install', '--upgrade', 'pip'])
- # Upgrade distribute because installation of sphinx with distribute 0.6.24
- # available on Travis is broken (see #207).
- try:
- distribute_version = get_distribution('distribute').version
- if LooseVersion(distribute_version) <= LooseVersion('0.6.24'):
- print("Updating distribute")
- check_call(['pip', 'install', '--upgrade', 'distribute'])
- except DistributionNotFound:
- pass
- # Install Sphinx and Breathe.
- pip_install('sphinx-doc/sphinx',
- '12b83372ac9316e8cbe86e7fed889296a4cc29ee',
- check_version='1.4.1.dev20160525')
- pip_install('michaeljones/breathe',
- '1c9d7f80378a92cffa755084823a78bb38ee4acc')
# Build docs.
cmd = ['doxygen', '-']
p = Popen(cmd, stdin=PIPE)

View File

@ -1,38 +0,0 @@
From 032c83807f95d83f2355f1c436909bb577b920bc Mon Sep 17 00:00:00 2001
From: Victor Zverovich <victor.zverovich@gmail.com>
Date: Thu, 10 Aug 2017 09:27:06 -0700
Subject: [PATCH] Fix a segfault in test on glibc 2.26 #551, take 2
NOTE: Added ::internal so it would apply - DLJ
---
test/util-test.cc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/util-test.cc b/test/util-test.cc
index 6cef7e81..6617b857 100644
--- a/test/util-test.cc
+++ b/test/util-test.cc
@@ -837,8 +837,21 @@ TEST(UtilTest, FormatSystemError) {
fmt::internal::format_system_error(message, EDOM, "test");
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), message.str());
message.clear();
- fmt::internal::format_system_error(
- message, EDOM, fmt::StringRef(0, std::numeric_limits<size_t>::max()));
+
+ // Check if std::allocator throws on allocating max size_t / 2 chars.
+ size_t max_size = std::numeric_limits<size_t>::max() / 2;
+ bool throws_on_alloc = false;
+ try {
+ std::allocator<char> alloc;
+ alloc.deallocate(alloc.allocate(max_size), max_size);
+ } catch (std::bad_alloc) {
+ throws_on_alloc = true;
+ }
+ if (!throws_on_alloc) {
+ fmt::print("warning: std::allocator allocates {} chars", max_size);
+ return;
+ }
+ fmt::internal::format_system_error(message, EDOM, fmt::StringRef(0, max_size));
EXPECT_EQ(fmt::format("error {}", EDOM), message.str());
}

View File

@ -1 +1 @@
SHA512 (fmt-3.0.2.tar.gz) = 50f5a25d1a10fd5b265f3811fa11886b9efdae2952f2aefc9f22c87c1a748128369f4d530b320e5e9c67c745cdab4607d1cb08940f4cf968300dee22e1150117
SHA512 (fmt-5.1.1.tar.gz) = 2b63a741df4df9c3cbf04098c6548bb3d0f9836fe912325542298df57c888f43e72159469fb87685b423694e43e4418545377d5ee6393f2709955be2c13780a8