From f1581215e5e20221ee768c81f6ff4c06b96a78ad Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Feb 05 2020 14:00:44 +0000 Subject: Revive package --- diff --git a/commoncpp2-1.7.3-gcc44.patch b/commoncpp2-1.7.3-gcc44.patch deleted file mode 100644 index 7966605..0000000 --- a/commoncpp2-1.7.3-gcc44.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up commoncpp2-1.7.3/src/cidr.cpp.orig commoncpp2-1.7.3/src/cidr.cpp ---- commoncpp2-1.7.3/src/cidr.cpp.orig 2009-04-06 21:24:07.857718325 +0200 -+++ commoncpp2-1.7.3/src/cidr.cpp 2009-04-06 21:50:26.874088776 +0200 -@@ -202,7 +202,7 @@ void IPV4Cidr::set(const char *cp) - #if defined(_MSC_VER) && _MSC_VER >= 1500 - ep = (char *)strchr(cp, '/'); - #else -- ep = strchr(cp, '/'); -+ ep = (char *)strchr(cp, '/'); - #endif - - if(ep) -@@ -332,7 +332,7 @@ void IPV6Cidr::set(const char *cp) - memset(&netmask, 0, sizeof(netmask)); - bitset((bit_t *)&netmask, getMask(cp)); - setString(cbuf, sizeof(cbuf), cp); -- ep = strchr(cp, '/'); -+ ep = (char *)strchr(cp, '/'); - if(ep) - *ep = 0; - diff --git a/commoncpp2-1.8.1-statfix.patch b/commoncpp2-1.8.1-statfix.patch deleted file mode 100644 index 5dfc36e..0000000 --- a/commoncpp2-1.8.1-statfix.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff -Nur commoncpp2-1.8.1.orig/src/applog.cpp commoncpp2-1.8.1/src/applog.cpp ---- commoncpp2-1.8.1.orig/src/applog.cpp 2010-10-31 17:11:55.000000000 -0600 -+++ commoncpp2-1.8.1/src/applog.cpp 2012-01-22 19:23:13.639292789 -0700 -@@ -45,6 +45,7 @@ - #include - #include - #include -+#include - - // TODO sc: test if has to move up now that it is into commoncpp - // NOTE: the order of inclusion is important do not move following include line -@@ -297,7 +298,7 @@ - else - { - // create pipe -- int err = mkfifo(_nomeFile.c_str(), S_IREAD | S_IWRITE); -+ int err = mkfifo(_nomeFile.c_str(), S_IRUSR | S_IWUSR); - if (err == 0 || errno == EEXIST) - { - // and open it -@@ -342,7 +343,7 @@ - else - { - // create pipe -- int err = mkfifo(_nomeFile.c_str(), S_IREAD | S_IWRITE); -+ int err = mkfifo(_nomeFile.c_str(), S_IRUSR | S_IWUSR); - if (err == 0 || errno == EEXIST) - { - // and open it -@@ -456,7 +457,7 @@ - else - { - // create pipe -- int err = mkfifo(d->_nomeFile.c_str(), S_IREAD | S_IWRITE); -+ int err = mkfifo(d->_nomeFile.c_str(), S_IRUSR | S_IWUSR); - if (err == 0 || errno == EEXIST) - { - // and open it -@@ -562,7 +563,7 @@ - else - { - // create pipe -- int err = mkfifo(d->_nomeFile.c_str(), S_IREAD | S_IWRITE); -+ int err = mkfifo(d->_nomeFile.c_str(), S_IRUSR | S_IWUSR); - if (err == 0 || errno == EEXIST) - { - // and open it diff --git a/commoncpp2-gcc9.patch b/commoncpp2-gcc9.patch new file mode 100644 index 0000000..b1ec6b7 --- /dev/null +++ b/commoncpp2-gcc9.patch @@ -0,0 +1,22 @@ +diff -rupN --no-dereference commoncpp2-1.8.1/inc/cc++/string.h commoncpp2-1.8.1-new/inc/cc++/string.h +--- commoncpp2-1.8.1/inc/cc++/string.h 2010-10-31 23:49:18.000000000 +0100 ++++ commoncpp2-1.8.1-new/inc/cc++/string.h 2020-02-04 23:56:43.215896768 +0100 +@@ -58,6 +58,9 @@ namespace ost { + + class MemPager; + ++class String; ++__EXPORT std::istream &getline(std::istream &is, String &str, char delim = '\n', size_t size = 0); ++ + /** + * This is a generic and portable string class. It uses optimized + * memory allocation strategies to efficiently handle smaller string +@@ -731,7 +734,7 @@ public: + * @param delim deliminator to use. + * @param size optional size limitor. + */ +- friend __EXPORT std::istream &getline(std::istream &is, String &str, char delim = '\n', size_t size = 0); ++ friend std::istream &getline(std::istream &is, String &str, char delim, size_t size); + + /** + * Stream the content of our string variable directly to a C++ diff --git a/commoncpp2-statfix.patch b/commoncpp2-statfix.patch new file mode 100644 index 0000000..d743f16 --- /dev/null +++ b/commoncpp2-statfix.patch @@ -0,0 +1,47 @@ +diff -rupN --no-dereference commoncpp2-1.8.1/src/applog.cpp commoncpp2-1.8.1-new/src/applog.cpp +--- commoncpp2-1.8.1/src/applog.cpp 2010-11-01 00:11:55.000000000 +0100 ++++ commoncpp2-1.8.1-new/src/applog.cpp 2020-02-04 23:56:43.194896881 +0100 +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + // TODO sc: test if has to move up now that it is into commoncpp + // NOTE: the order of inclusion is important do not move following include line +@@ -297,7 +298,7 @@ logger::logger(const char* logFileName, + else + { + // create pipe +- int err = mkfifo(_nomeFile.c_str(), S_IREAD | S_IWRITE); ++ int err = mkfifo(_nomeFile.c_str(), S_IRUSR | S_IWUSR); + if (err == 0 || errno == EEXIST) + { + // and open it +@@ -342,7 +343,7 @@ void logger::logFileName(const char* Fil + else + { + // create pipe +- int err = mkfifo(_nomeFile.c_str(), S_IREAD | S_IWRITE); ++ int err = mkfifo(_nomeFile.c_str(), S_IRUSR | S_IWUSR); + if (err == 0 || errno == EEXIST) + { + // and open it +@@ -456,7 +457,7 @@ AppLog::AppLog(const char* logFileName, + else + { + // create pipe +- int err = mkfifo(d->_nomeFile.c_str(), S_IREAD | S_IWRITE); ++ int err = mkfifo(d->_nomeFile.c_str(), S_IRUSR | S_IWUSR); + if (err == 0 || errno == EEXIST) + { + // and open it +@@ -562,7 +563,7 @@ void AppLog::logFileName(const char* Fil + else + { + // create pipe +- int err = mkfifo(d->_nomeFile.c_str(), S_IREAD | S_IWRITE); ++ int err = mkfifo(d->_nomeFile.c_str(), S_IRUSR | S_IWUSR); + if (err == 0 || errno == EEXIST) + { + // and open it diff --git a/commoncpp2.spec b/commoncpp2.spec index 0c2f86c..68a72e9 100644 --- a/commoncpp2.spec +++ b/commoncpp2.spec @@ -1,14 +1,35 @@ -Summary: GNU Common C++ class framework -Name: commoncpp2 -Version: 1.8.1 -Release: 18%{?dist} -License: GPLv2+ with exceptions -Source0: http://www.gnutelephony.org/dist/tarballs/commoncpp2-%{version}.tar.gz -Patch1: commoncpp2-1.8.1-statfix.patch -URL: http://www.gnu.org/software/commoncpp/ -BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: libxml2-devel, zlib-devel, doxygen +Name: commoncpp2 +Version: 1.8.1 +Release: 21%{?dist} +Summary: GNU Common C++ class framework + +# Library is GPLv2+ with exceptions +License: GPLv2+ with exceptions +URL: http://www.gnu.org/software/commoncpp/ +Source0: https://ftp.gnu.org/gnu/commoncpp/%{name}-%{version}.tar.gz + +# Fix mkfifo modes: S_IREAD | S_IWRITE -> S_IRUSR | S_IWUSR +Patch1: commoncpp2-statfix.patch +# Fix build against GCC9+ +Patch2: commoncpp2-gcc9.patch +# Fix two occurences of incorrect sizeof usage +Patch3: commoncpp2_sizeof.patch +# Replace obsolete macros +Patch4: commoncpp2_obsoletem4.patch +# Call setgroups before setuid +Patch5: commoncpp2_setgroups.patch +# Disable thread1 test which is badly written and hangs (or takes a very long time) +# Add return code to detect failure/success +Patch6: commoncpp2_tests.patch + +BuildRequires: automake autoconf libtool +BuildRequires: doxygen +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: libxml2-devel +BuildRequires: zlib-devel +BuildRequires: make + %description GNU Common C++ is a portable and highly optimized class framework for writing @@ -18,51 +39,104 @@ that hides platform differences from your C++ application so that you need not write platform specific code. GNU Common C++ has been ported to compile natively on most platforms which support posix threads. + %package devel -Summary: Header files and libraries for %{name} development -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: libxml2-devel, zlib-devel +Summary: Header files and libraries for %{name} development +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: libxml2-devel%{?_isa} +Requires: zlib-devel%{?_isa} %description devel The %{name}-devel package contains the header files and libraries needed to develop programs that use the %{name} library. +%package doc +Summary: Developer documentation for %{name} +License: GPLv2+ with exceptions and GFDL +BuildArch: noarch + +%description doc +The %{name}-doc package contains the developer documentation for %{name}. + + %prep -%setup -q +%autosetup -p1 -%patch1 -p1 %build +# Kill rpath +autoreconf -ifv %configure \ - --disable-static \ - --disable-dependency-tracking -%{__make} #%%{?_smp_mflags} smp building disabled + --disable-static \ + --disable-dependency-tracking + +# Get rid of undesirable hardcoded rpaths; workaround libtool reordering +# -Wl,--as-needed after all the libraries. +sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ + -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ + -e 's|CC="\(g..\)"|CC="\1 -Wl,--as-needed"|' \ + -i libtool + +# Parallel build occasionally broken +make + +# Build tests +pushd tests +%make_build +popd + %install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=%{buildroot} +%make_install +find %{buildroot} -name '*.la' -delete + +# Drop info index rm -f %{buildroot}%{_infodir}/dir -find %{buildroot} -name '*.la' -exec rm -f {} \; -%ldconfig_scriptlets +%check +pushd tests +LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./test.sh +popd + %files -%doc COPYING README ChangeLog +%doc README ChangeLog +%license COPYING %{_libdir}/*.so.* %files devel -%doc doc/html -%dir %{_includedir}/cc++ -%{_includedir}/cc++/* %{_bindir}/ccgnu2-config +%{_includedir}/cc++/ %{_libdir}/*.so %{_libdir}/pkgconfig/libccext2.pc %{_libdir}/pkgconfig/libccgnu2.pc %{_datadir}/aclocal/ost_check2.m4 + +%files doc +%doc doc/html %{_infodir}/commoncpp2.info* %changelog +* Wed Feb 05 2020 Sandro Mani - 1.8.1-21 +- Actually add files to %%doc +- Only list GFDL license for %%doc subpackage +- Drop badly written thread1 test, enable remaining tests + +* Tue Feb 04 2020 Sandro Mani - 1.8.1-20 +- Split off documentation +- Clarify license +- Drop ldconfig_scriptlets +- Add %%{?_isa} to Requires +- Patch another incorrect sizeof usage +- Build tests, add %%check (disabled with comment though) +- Patch setuid not preceded by setgroups call +- Fix unused direct dependencies +- Fix obsolete m4 macros + +* Wed Jan 29 2020 Sandro Mani - 1.8.1-19 +- Revived package + * Wed Jul 24 2019 Fedora Release Engineering - 1.8.1-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/commoncpp2_obsoletem4.patch b/commoncpp2_obsoletem4.patch new file mode 100644 index 0000000..4bf168f --- /dev/null +++ b/commoncpp2_obsoletem4.patch @@ -0,0 +1,15 @@ +diff -rupN --no-dereference commoncpp2-1.8.1/configure.ac commoncpp2-1.8.1-new/configure.ac +--- commoncpp2-1.8.1/configure.ac 2010-10-31 23:10:07.000000000 +0100 ++++ commoncpp2-1.8.1-new/configure.ac 2020-02-04 23:56:43.265896501 +0100 +@@ -89,9 +89,9 @@ AC_PROG_CXX + OST_PROG_CC_POSIX + NP_PROG_MSC + AC_LIBTOOL_WIN32_DLL +-AM_PROG_LIBTOOL ++LT_INIT() + AM_INIT_AUTOMAKE(commoncpp2, [$VERSION]) +-AM_CONFIG_HEADER(config.h) ++AC_CONFIG_HEADERS([config.h]) + + AC_C_RESTRICT + AC_C_VOLATILE diff --git a/commoncpp2_setgroups.patch b/commoncpp2_setgroups.patch new file mode 100644 index 0000000..0ec40e3 --- /dev/null +++ b/commoncpp2_setgroups.patch @@ -0,0 +1,12 @@ +diff -rupN --no-dereference commoncpp2-1.8.1/src/process.cpp commoncpp2-1.8.1-new/src/process.cpp +--- commoncpp2-1.8.1/src/process.cpp 2010-11-01 01:04:11.000000000 +0100 ++++ commoncpp2-1.8.1-new/src/process.cpp 2020-02-04 23:56:43.287896384 +0100 +@@ -313,6 +313,8 @@ bool Process::setUser(const char *id, bo + if(!pw) + return false; + ++ setgroups(0, NULL); ++ + if(grp) + if(setgid(pw->pw_gid)) + return false; diff --git a/commoncpp2_sizeof.patch b/commoncpp2_sizeof.patch new file mode 100644 index 0000000..2fc3cc9 --- /dev/null +++ b/commoncpp2_sizeof.patch @@ -0,0 +1,24 @@ +diff -rupN --no-dereference commoncpp2-1.8.1/src/inaddr.cpp commoncpp2-1.8.1-new/src/inaddr.cpp +--- commoncpp2-1.8.1/src/inaddr.cpp 2010-11-01 00:43:40.000000000 +0100 ++++ commoncpp2-1.8.1-new/src/inaddr.cpp 2020-02-04 23:56:43.241896629 +0100 +@@ -333,7 +333,7 @@ void IPV4Address::setAddress(const char + if(ipaddr) + delete[] ipaddr; + ipaddr = new struct in_addr[1]; +- memset((void *)&ipaddr[0], 0, sizeof(ipaddr)); ++ memset((void *)&ipaddr[0], 0, sizeof(ipaddr[0])); + return; + } + +diff -rupN --no-dereference commoncpp2-1.8.1/src/socket.cpp commoncpp2-1.8.1-new/src/socket.cpp +--- commoncpp2-1.8.1/src/socket.cpp 2010-11-01 01:33:55.000000000 +0100 ++++ commoncpp2-1.8.1-new/src/socket.cpp 2020-02-04 23:56:43.242896624 +0100 +@@ -1560,7 +1560,7 @@ Socket::Error UDPSocket::join(const IPV4 + + getsockname(so, (struct sockaddr *)&myaddr, &len); + memset(&group, 0, sizeof(group)); +- memcpy(&group.imr_address, &myaddr.sin_addr, sizeof(&myaddr.sin_addr)); ++ memcpy(&group.imr_address, &myaddr.sin_addr, sizeof(myaddr.sin_addr)); + group.imr_multiaddr = getaddress(ia); + group.imr_ifindex = InterfaceIndex; + setsockopt(so, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)); diff --git a/commoncpp2_tests.patch b/commoncpp2_tests.patch new file mode 100644 index 0000000..4e11d79 --- /dev/null +++ b/commoncpp2_tests.patch @@ -0,0 +1,75 @@ +diff -rupN commoncpp2-1.8.1/tests/dotests.sh commoncpp2-1.8.1-new/tests/dotests.sh +--- commoncpp2-1.8.1/tests/dotests.sh 2010-10-31 17:29:17.000000000 +0100 ++++ commoncpp2-1.8.1-new/tests/dotests.sh 2020-02-04 23:56:48.549867971 +0100 +@@ -2,7 +2,7 @@ + + # execute all test to make a single output + +-for t in bug1 bug2 thread1 digest tcpstr1 url1; do ++for t in bug1 bug2 digest tcpstr1 url1; do + echo $t test... + echo $t test... 1>&2 + ./$t +diff -rupN commoncpp2-1.8.1/tests/output.txt commoncpp2-1.8.1-new/tests/output.txt +--- commoncpp2-1.8.1/tests/output.txt 2010-10-31 17:29:17.000000000 +0100 ++++ commoncpp2-1.8.1-new/tests/output.txt 2020-02-05 00:00:25.953602417 +0100 +@@ -4,46 +4,6 @@ Run()... + Final()... + exiting... + bug2 test... +-thread1 test... +-*********************************************** +-* Testing class Thread without syncronization * +-*********************************************** +-Testing thread creation +- +-- thread should set n to 1...ok +- +-Testing thread is working +- +-- thread should change n...ok +-- thread should change n...ok +- +-Testing suspend & resume +- +-- thread should not change n...ok +-- thread should not change n...ok +-- thread should change n...ok +-- thread should change n...ok +- +-Testing recursive suspend & resume +- +-- thread should not change n...ok +-- thread should not change n...ok +-- thread should not change n...ok +-- thread should not change n...ok +-- thread should change n...ok +-- thread should change n...ok +- +-Testing no suspend on resume +- +-- thread should change n...ok +-- thread should change n...ok +- +-Testing resuspend +- +-- thread should not change n...ok +-- thread should not change n...ok +- +-Now program should finish... :) + digest test... + 0c88028bf3aa6a6a143ed846f2be1ea4 + tcpstr1 test... +diff -rupN commoncpp2-1.8.1/tests/test.sh commoncpp2-1.8.1-new/tests/test.sh +--- commoncpp2-1.8.1/tests/test.sh 2010-10-31 17:29:17.000000000 +0100 ++++ commoncpp2-1.8.1-new/tests/test.sh 2020-02-04 23:56:50.946854814 +0100 +@@ -5,7 +5,9 @@ sh dotests.sh > testout.txt + + if cmp testout.txt output.txt; then + echo Test successfully ++ exit 0 + else + echo 'Test failed :(' + echo 'Compare testout.txt (wrong) and output.txt (correct) for more information' ++ exit 1 + fi diff --git a/sources b/sources index 3d07143..07f8e4c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4804b184e609154ba2bc0aa9f61dc6ef commoncpp2-1.8.1.tar.gz +SHA512 (commoncpp2-1.8.1.tar.gz) = 949823461d20429c2b0acfa22554a5a9dacc977e3ee097f34416f65d322df84fbdb27c644435c6c6caaed800347dfbe789cee7f19b39b306165c97b4f4012bfe