Bootstrapping for so-name bump

This commit is contained in:
Björn Esser 2018-03-06 14:17:58 +01:00
parent f6922954cc
commit 2d9c3f7d8d
No known key found for this signature in database
GPG Key ID: F52E98007594C21D
7 changed files with 52 additions and 189 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ clog
/json-c-0.12-20140410.tar.gz
/json-c-0.12.1-20160607.tar.gz
/json-c-0.13-20171207.tar.gz
/json-c-0.13.1-20180305.tar.gz

View File

@ -1,20 +0,0 @@
From 87556afe2a062c28bccd910ec5bc22b9988726e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Sun, 10 Dec 2017 16:29:41 +0100
Subject: [PATCH] Makefile: Add ACLOCAL_AMFLAGS
This is recommended by the libtool manual.
---
Makefile.am | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index 5ad354a4a3..a0a43fc8bc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS = -I autoconf-archive/m4
+
EXTRA_DIST = README.md README.html
EXTRA_DIST += config.h.win32
EXTRA_DIST += Doxyfile

View File

@ -1,42 +0,0 @@
From c123a1c21b944b3391fe022263ebfcdc15e5c5d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Mon, 11 Dec 2017 12:55:40 +0100
Subject: [PATCH] json_object: Add size_t json_object_sizeof()
---
json_object.c | 5 +++++
json_object.h | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/json_object.c b/json_object.c
index 9daa6fdb0a..f12d8f08d8 100644
--- a/json_object.c
+++ b/json_object.c
@@ -509,6 +509,11 @@ int json_object_object_length(const struct json_object *jso)
return lh_table_length(jso->o.c_object);
}
+size_t json_object_sizeof(void)
+{
+ return sizeof(struct json_object);
+}
+
struct json_object* json_object_object_get(const struct json_object* jso,
const char *key)
{
diff --git a/json_object.h b/json_object.h
index 283eb95300..6a2751d228 100644
--- a/json_object.h
+++ b/json_object.h
@@ -392,6 +392,11 @@ JSON_EXPORT struct lh_table* json_object_get_object(const struct json_object *ob
*/
JSON_EXPORT int json_object_object_length(const struct json_object* obj);
+/** Get the sizeof (struct json_object).
+ * @returns a size_t with the sizeof (struct json_object)
+ */
+JSON_EXPORT size_t json_object_sizeof(void);
+
/** Add an object field to a json_object of type json_type_object
*
* The reference count will *not* be incremented. This is to make adding

View File

@ -1,51 +0,0 @@
From 5b6d62259afbc1709d4437b8c488de429079cae0 Mon Sep 17 00:00:00 2001
From: Eric Haszlakiewicz <erh+git@nimenees.com>
Date: Tue, 12 Dec 2017 18:26:51 -0500
Subject: [PATCH] Apply gcc's "const" attribute to the json_c_object_sizeof()
function as an optimizer hint. Also, rename that function from
json_object_sizeof().
---
json_object.c | 2 +-
json_object.h | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/json_object.c b/json_object.c
index f12d8f08d8..042477a71b 100644
--- a/json_object.c
+++ b/json_object.c
@@ -509,7 +509,7 @@ int json_object_object_length(const struct json_object *jso)
return lh_table_length(jso->o.c_object);
}
-size_t json_object_sizeof(void)
+size_t json_c_object_sizeof(void)
{
return sizeof(struct json_object);
}
diff --git a/json_object.h b/json_object.h
index 6a2751d228..758efa6f1d 100644
--- a/json_object.h
+++ b/json_object.h
@@ -27,6 +27,12 @@
#define THIS_FUNCTION_IS_DEPRECATED(func) func
#endif
+#ifdef __GNUC__
+#define JSON_C_CONST_FUNCTION(func) func __attribute__((const))
+#else
+#define CONST_FUNCTION(func) func
+#endif
+
#if defined(_MSC_VER)
#define JSON_EXPORT __declspec(dllexport)
#else
@@ -395,7 +401,7 @@ JSON_EXPORT int json_object_object_length(const struct json_object* obj);
/** Get the sizeof (struct json_object).
* @returns a size_t with the sizeof (struct json_object)
*/
-JSON_EXPORT size_t json_object_sizeof(void);
+JSON_C_CONST_FUNCTION(JSON_EXPORT size_t json_c_object_sizeof(void));
/** Add an object field to a json_object of type json_type_object
*

View File

@ -1,26 +0,0 @@
From 9aca3b6a087a396a81d7e26f4557eb97fecc1386 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Wed, 13 Dec 2017 19:22:52 +0100
Subject: [PATCH] json_object: Avoid invalid free (and thus a segfault) when
ref_count gets < 0
---
json_object.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/json_object.c b/json_object.c
index 042477a71b..7c7438d8ea 100644
--- a/json_object.c
+++ b/json_object.c
@@ -182,6 +182,11 @@ int json_object_put(struct json_object *jso)
{
if(!jso) return 0;
+ /* Avoid invalid free and crash explicitly instead of (silently)
+ * segfaulting.
+ */
+ assert(jso->_ref_count > 0);
+
#if defined(HAVE_ATOMIC_BUILTINS) && defined(ENABLE_THREADING)
/* Note: this only allow the refcount to remain correct
* when multiple threads are adjusting it. It is still an error

View File

@ -1,38 +1,32 @@
%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
%global so_ver 3
%global reldate 20171207
%global so_ver 4
%global reldate 20180305
# Uncomment when building a bootstrap for a bumped so-name.
# You also need to adjust the parameters below.
#global bootstrap 1
%global bootstrap 1
%if 0%{?bootstrap}
%global reldate_old 20160607
%global version_old 0.12.1
%global so_ver_old 2
%global reldate_old 20171207
%global version_old 0.13
%global so_ver_old 3
%endif
Name: json-c
Version: 0.13
Release: 7%{?dist}
Summary: JSON implementation in C
Name: json-c
Version: 0.13.1
Release: 0.1%{?dist}
Summary: JSON implementation in C
License: MIT
URL: https://github.com/%{name}/%{name}
Source0: %{url}/archive/%{name}-%{version}-%{reldate}.tar.gz
License: MIT
URL: https://github.com/%{name}/%{name}
Source0: %{url}/archive/%{name}-%{version}-%{reldate}.tar.gz
%if 0%{?bootstrap}
Source1: %{url}/archive/%{name}-%{version_old}-%{reldate_old}.tar.gz
Source1: %{url}/archive/%{name}-%{version_old}-%{reldate_old}.tar.gz
%endif
# Upstreamed.
Patch0: %{url}/pull/386.patch#/%{name}-0.13_Makefile_add_aclocal_amflags.patch
Patch1: %{url}/commit/94fd101601c24627ae44498a7a73e9f2d9fb6e91.patch#/%{name}-0.13_json_object_add_size_t_json_c_object_sizeof_1.patch
Patch2: %{url}/commit/5b6d62259afbc1709d4437b8c488de429079cae0.patch#/%{name}-0.13_json_object_add_size_t_json_c_object_sizeof_2.patch
Patch3: %{url}/pull/389.patch#/json-c-0.13_json_object_avoid_invalid_free.patch
BuildRequires: libtool
BuildRequires: libtool
%description
JSON-C implements a reference counting object model that allows you
@ -41,25 +35,25 @@ strings and parse JSON formatted strings back into the C representation
of JSON objects. It aims to conform to RFC 7159.
%package devel
Summary: Development files for %{name}
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} == %{version}-%{release}
Requires: %{name}%{?_isa} == %{version}-%{release}
%description devel
%description devel
This package contains libraries and header files for
developing applications that use %{name}.
%package doc
Summary: Reference manual for json-c
%package doc
Summary: Reference manual for json-c
BuildArch: noarch
BuildArch: noarch
BuildRequires: doxygen
BuildRequires: hardlink
BuildRequires: doxygen
BuildRequires: hardlink
%description doc
%description doc
This package contains the reference manual for %{name}.
@ -67,30 +61,32 @@ This package contains the reference manual for %{name}.
%autosetup -Tb 0 -n %{name}-%{name}-%{version}-%{reldate} -p 1
for doc in ChangeLog; do
%{_bindir}/iconv -f iso-8859-1 -t utf8 ${doc} > ${doc}.new
/bin/touch -r ${doc} ${doc}.new
%{__mv} -f ${doc}.new ${doc}
%{_bindir}/iconv -f iso-8859-1 -t utf8 ${doc} > ${doc}.new
/bin/touch -r ${doc} ${doc}.new
%{__mv} -f ${doc}.new ${doc}
done
%{__sed} -i -e 's!#ACLOCAL_AMFLAGS!ACLOCAL_AMFLAGS!g' Makefile.am
%{_bindir}/autoreconf -fiv
%if 0%{?bootstrap}
%{__mkdir} -p bootstrap_ver
pushd bootstrap_ver
%{__tar} --strip-components=1 -xf %{SOURCE1}
%{__grep} -Rl '\-Werror' . | %{_bindir}/xargs %{__sed} -i -e 's!-Werror!!g'
%{__sed} -i -e 's!#ACLOCAL_AMFLAGS!ACLOCAL_AMFLAGS!g' Makefile.am
%{_bindir}/autoreconf -fiv
popd
%endif
%build
%configure \
--disable-silent-rules \
--disable-static \
--enable-rdrand \
--enable-shared \
--enable-threading
%configure \
--disable-silent-rules \
--disable-static \
--enable-rdrand \
--enable-shared \
--enable-threading
%make_build
@ -98,12 +94,13 @@ popd
%if 0%{?bootstrap}
pushd bootstrap_ver
%configure \
--disable-rpath \
--disable-silent-rules \
--disable-static \
--enable-rdrand \
--enable-shared
%configure \
--disable-silent-rules \
--disable-static \
--enable-rdrand \
--enable-shared \
--enable-threading
%make_build
popd
%endif
@ -112,9 +109,9 @@ popd
%install
%if 0%{?bootstrap}
%make_install -C bootstrap_ver
rm -fr %{buildroot}%{_includedir}/%{name} \
%{buildroot}%{_libdir}/lib%{name}.so \
%{buildroot}%{_libdir}/pkgconfig
%{__rm} -fr %{buildroot}%{_includedir}/%{name} \
%{buildroot}%{_libdir}/lib%{name}.so \
%{buildroot}%{_libdir}/pkgconfig
%endif
%make_install
@ -173,6 +170,9 @@ end
%changelog
* Tue Mar 06 2018 Björn Esser <besser82@fedoraproject.org> - 0.13.1-0.1
- Bootstrapping for so-name bump
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

View File

@ -1 +1,2 @@
SHA512 (json-c-0.13.1-20180305.tar.gz) = 89c448eabe37d408491dd8730cb92c9f8e7463e868fb999eb40a94b47a41c9342231096b242fad891a8d80648439be8ed85cf1137f9f2089db3f656b84b2e6d8
SHA512 (json-c-0.13-20171207.tar.gz) = bac85d9107694b479549a28ce79ae6a2eb937694a7848f7f69fb8a280b20ef39249d9d31aa3f82fd5d66a887dd96b2d17717e6e37b97156a3cc44fdfaa0138e0