From 60b7c78fa47a13e146fbf51b557064362411725b Mon Sep 17 00:00:00 2001 From: Denis Arnaud Date: Tue, 29 Oct 2019 19:59:19 +0100 Subject: [PATCH] OpenPGM now builds with SCons. The issue is how to install it --- .gitignore | 6 +- openpgm-01-scons.patch | 54 +++++++++++++ openpgm-02-c-func.patch | 129 ++++++++++++++++++++++++++++++++ openpgm-03-pkgconfig.patch | 11 +++ openpgm-04-py-version-gen.patch | 60 +++++++++++++++ openpgm.spec | 105 +++++--------------------- sources | 2 +- 7 files changed, 277 insertions(+), 90 deletions(-) create mode 100644 openpgm-01-scons.patch create mode 100644 openpgm-02-c-func.patch create mode 100644 openpgm-03-pkgconfig.patch create mode 100644 openpgm-04-py-version-gen.patch diff --git a/.gitignore b/.gitignore index 1884390..3f4b063 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -/libpgm-5.1.118%7Edfsg.tar.gz -/libpgm-5.1.118-1~dfsg.tar.gz -/libpgm-5.1.118~dfsg.tar.gz -/libpgm-5.2.122~dfsg.tar.gz +/openpgm-?.?.???.tar.gz +/openpgm-release-?-?-???/ diff --git a/openpgm-01-scons.patch b/openpgm-01-scons.patch new file mode 100644 index 0000000..285e0c5 --- /dev/null +++ b/openpgm-01-scons.patch @@ -0,0 +1,54 @@ +diff --git a/openpgm/pgm/SConscript.autoconf b/openpgm/pgm/SConscript.autoconf +index d3d833d..abcfd94 100644 +--- a/openpgm/pgm/SConscript.autoconf ++++ b/openpgm/pgm/SConscript.autoconf +@@ -113,7 +113,7 @@ def CheckMember (context, member, header): + int + main () + { +- offsetof (""" + string.replace (member, '.', ', ') + """); ++ offsetof (""" + member.replace('.', ', ') + """); + return 0; + } + """ +diff --git a/openpgm/pgm/SConstruct b/openpgm/pgm/SConstruct +index adff0b7..d408945 100644 +--- a/openpgm/pgm/SConstruct ++++ b/openpgm/pgm/SConstruct +@@ -116,7 +116,7 @@ release = env.Clone(BUILD = 'release') + release.Append(CCFLAGS = '-O2') + + debug = env.Clone(BUILD = 'debug') +-debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-gdb') ++debug.Append(CCFLAGS = ['-DPGM_DEBUG','-ggdb'], LINKFLAGS = '-ggdb') + + profile = env.Clone(BUILD = 'profile') + profile.Append(CCFLAGS = ['-O2','-pg'], LINKFLAGS = '-pg') +@@ -206,15 +206,15 @@ if env['WITH_SNMP'] == 'true': + conf = Configure(env, custom_tests = tests); + + if env['WITH_SNMP'] == 'true' and not conf.CheckSNMP(): +- print 'Net-SNMP libraries not compatible.'; ++ print ('Net-SNMP libraries not compatible.'); + Exit(1); + + if env['WITH_CHECK'] == 'true' and conf.CheckCheck(): +- print 'Enabling Check unit tests.'; ++ print ('Enabling Check unit tests.'); + conf.env['CHECK'] = 'true'; + env['CHECK_FLAGS'] = env.ParseFlags('!pkg-config --cflags --libs check'); + else: +- print 'Disabling Check unit tests.'; ++ print ('Disabling Check unit tests.'); + conf.env['CHECK'] = 'false'; + + env = conf.Finish(); +@@ -236,7 +236,7 @@ env.Append(BUILDERS = {'StaticSharedLibrary': pic_lib}); + #----------------------------------------------------------------------------- + + ref_node = 'ref/' + env['BUILD'] + '-' + platform.system() + '-' + platform.machine() + '/'; +-BuildDir(ref_node, '.', duplicate=0) ++VariantDir(ref_node, '.', duplicate=0) + + env.Append(CPPPATH = [ + # $(top_builddir)/include diff --git a/openpgm-02-c-func.patch b/openpgm-02-c-func.patch new file mode 100644 index 0000000..8a14d98 --- /dev/null +++ b/openpgm-02-c-func.patch @@ -0,0 +1,129 @@ +diff --git a/openpgm/pgm/include/impl/messages.h b/openpgm/pgm/include/impl/messages.h +index 812393f..1655e9c 100644 +--- a/openpgm/pgm/include/impl/messages.h ++++ b/openpgm/pgm/include/impl/messages.h +@@ -185,14 +185,14 @@ static inline void pgm_fatal (const char* format, ...) { + #define pgm_warn_if_reached() \ + do { \ + pgm_warn ("file %s: line %d (%s): code should not be reached", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__); \ ++ __FILE__, __LINE__, __func__); \ + } while (0) + #define pgm_warn_if_fail(expr) \ + do { \ + if (PGM_LIKELY (expr)); \ + else \ + pgm_warn ("file %s: line %d (%s): runtime check failed: (%s)", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ ++ __FILE__, __LINE__, __func__, #expr); \ + } while (0) + + +@@ -210,14 +210,14 @@ static inline void pgm_fatal (const char* format, ...) { + if (PGM_LIKELY(expr)); \ + else { \ + pgm_fatal ("file %s: line %d (%s): assertion failed: (%s)", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ ++ __FILE__, __LINE__, __func__, #expr); \ + abort (); \ + } \ + } while (0) + # define pgm_assert_not_reached() \ + do { \ + pgm_fatal ("file %s: line %d (%s): should not be reached", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__); \ ++ __FILE__, __LINE__, __func__); \ + abort (); \ + } while (0) + # define pgm_assert_cmpint(n1, cmp, n2) \ +@@ -226,7 +226,7 @@ static inline void pgm_fatal (const char* format, ...) { + if (PGM_LIKELY(_n1 cmp _n2)); \ + else { \ + pgm_fatal ("file %s: line %d (%s): assertion failed (%s): (%" PRIi64 " %s %" PRIi64 ")", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ ++ __FILE__, __LINE__, __func__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ + abort (); \ + } \ + } while (0) +@@ -236,7 +236,7 @@ static inline void pgm_fatal (const char* format, ...) { + if (PGM_LIKELY(_n1 cmp _n2)); \ + else { \ + pgm_fatal ("file %s: line %d (%s): assertion failed (%s): (%" PRIu64 " %s %" PRIu64 ")", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ ++ __FILE__, __LINE__, __func__, #n1 " " #cmp " " #n2, _n1, #cmp, _n2); \ + abort (); \ + } \ + } while (0) +@@ -295,7 +295,7 @@ static inline void pgm_fatal (const char* format, ...) { + if (PGM_LIKELY(expr)); \ + else { \ + pgm_warn ("file %s: line %d (%s): assertion `%s' failed", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ ++ __FILE__, __LINE__, __func__, #expr); \ + return; \ + } \ + } while (0) +@@ -304,20 +304,20 @@ static inline void pgm_fatal (const char* format, ...) { + if (PGM_LIKELY(expr)); \ + else { \ + pgm_warn ("file %s: line %d (%s): assertion `%s' failed", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ ++ __FILE__, __LINE__, __func__, #expr); \ + return (val); \ + } \ + } while (0) + # define pgm_return_if_reached() \ + do { \ + pgm_warn ("file %s: line %d (%s): should not be reached", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__); \ ++ __FILE__, __LINE__, __func__); \ + return; \ + } while (0) + # define pgm_return_val_if_reached(val) \ + do { \ + pgm_warn ("file %s: line %d (%s): should not be reached", \ +- __FILE__, __LINE__, __PRETTY_FUNCTION__); \ ++ __FILE__, __LINE__, __func__); \ + return (val); \ + } while (0) + +diff --git a/openpgm/pgm/mem.c b/openpgm/pgm/mem.c +index 5697baf..d3d5295 100644 +--- a/openpgm/pgm/mem.c ++++ b/openpgm/pgm/mem.c +@@ -163,7 +163,7 @@ pgm_malloc ( + + #ifdef __GNUC__ + pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes", +- __FILE__, __LINE__, __PRETTY_FUNCTION__, ++ __FILE__, __LINE__, __func__, + n_bytes); + #else + pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes", +@@ -186,7 +186,7 @@ pgm_malloc_n ( + if (SIZE_OVERFLOWS (n_blocks, block_bytes)) { + #ifdef __GNUC__ + pgm_fatal ("file %s: line %d (%s): overflow allocating %" PRIzu "*%" PRIzu " bytes", +- __FILE__, __LINE__, __PRETTY_FUNCTION__, ++ __FILE__, __LINE__, __func__, + n_blocks, block_bytes); + #else + pgm_fatal ("file %s: line %d: overflow allocating %" PRIzu "*%" PRIzu " bytes", +@@ -210,7 +210,7 @@ pgm_malloc0 ( + + #ifdef __GNUC__ + pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes", +- __FILE__, __LINE__, __PRETTY_FUNCTION__, ++ __FILE__, __LINE__, __func__, + n_bytes); + #else + pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes", +@@ -236,7 +236,7 @@ pgm_malloc0_n ( + + #ifdef __GNUC__ + pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu "*%" PRIzu " bytes", +- __FILE__, __LINE__, __PRETTY_FUNCTION__, ++ __FILE__, __LINE__, __func__, + n_blocks, block_bytes); + #else + pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu "*%" PRIzu " bytes", diff --git a/openpgm-03-pkgconfig.patch b/openpgm-03-pkgconfig.patch new file mode 100644 index 0000000..5344b47 --- /dev/null +++ b/openpgm-03-pkgconfig.patch @@ -0,0 +1,11 @@ +diff --git a/openpgm/pgm/openpgm-5.2.pc.in b/openpgm/pgm/openpgm-5.2.pc.in +index 1e56d944..9e30a6da 100644 +--- a/openpgm/pgm/openpgm-5.2.pc.in ++++ b/openpgm/pgm/openpgm-5.2.pc.in +@@ -9,4 +9,4 @@ Version: @PACKAGE_VERSION@ + # packagers may wish to move @LIBS@ to Libs.private for platforms with + # versions of pkg-config that support static linking. + Libs: -L${libdir} -lpgm @LIBS@ +-Cflags: -I${includedir}/pgm-@VERSION_MAJOR@.@VERSION_MINOR@ -I${libdir}/pgm-@VERSION_MAJOR@.@VERSION_MINOR@/include ++Cflags: -I${includedir}/pgm-@VERSION_MAJOR@.@VERSION_MINOR@ + diff --git a/openpgm-04-py-version-gen.patch b/openpgm-04-py-version-gen.patch new file mode 100644 index 0000000..9540f13 --- /dev/null +++ b/openpgm-04-py-version-gen.patch @@ -0,0 +1,60 @@ +diff --git a/openpgm/pgm/version_generator.py b/openpgm/pgm/version_generator.py +index e489aef..581eabe 100755 +--- a/openpgm/pgm/version_generator.py ++++ b/openpgm/pgm/version_generator.py +@@ -1,19 +1,25 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + import os + import platform + import time + +-build_date = time.strftime ("%Y-%m-%d") +-build_time = time.strftime ("%H:%M:%S") +-build_rev = filter (str.isdigit, "$Revision$") ++timestamp = time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))) ++build_date = time.strftime ("%Y-%m-%d", timestamp) ++build_time = time.strftime ("%H:%M:%S", timestamp) ++build_rev = ''.join (list (filter (str.isdigit, "$Revision$"))) ++build_system = platform.system() ++build_machine = platform.machine() ++if 'SOURCE_DATE_EPOCH' in os.environ: ++ build_system = 'BuildSystem' ++ build_machine = 'BuildMachine' + +-print """ ++print (""" + /* vim:ts=8:sts=8:sw=4:noai:noexpandtab + * + * OpenPGM version. + * +- * Copyright (c) 2006-2011 Miru Limited. ++ * Copyright (c) 2006-2014 Miru Limited. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -41,15 +47,16 @@ + + const unsigned pgm_major_version = 5; + const unsigned pgm_minor_version = 2; +-const unsigned pgm_micro_version = 122; +-const char* pgm_build_date = "%s"; +-const char* pgm_build_time = "%s"; +-const char* pgm_build_system = "%s"; +-const char* pgm_build_machine = "%s"; +-const char* pgm_build_revision = "%s"; ++const unsigned pgm_micro_version = 127; ++const char* pgm_build_date = "{0}"; ++const char* pgm_build_time = "{1}"; ++const char* pgm_build_system = "{2}"; ++const char* pgm_build_machine = "{3}"; ++const char* pgm_build_revision = "{4}"; + + + /* eof */ +-"""%(build_date, build_time, platform.system(), platform.machine(), build_rev) ++""".format (build_date, build_time, build_system, build_machine, build_rev)) + + # end of file ++ diff --git a/openpgm.spec b/openpgm.spec index 44d1371..c4a0130 100644 --- a/openpgm.spec +++ b/openpgm.spec @@ -1,20 +1,24 @@ Name: openpgm Version: 5.2.122 -Release: 18%{?dist} +%global version_dash 5-2-122 +Release: 1%{?dist} Summary: An implementation of the PGM reliable multicast protocol # The license is LGPLv2.1 License: LGPLv2 # New URL is https://github.com/steve-o/openpgm # The files are now on https://code.google.com/archive/p/openpgm/downloads -# https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/openpgm/libpgm-%{version}~dfsg.tar.gz -URL: https://github.com/steve-o/openpgm -Source0: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/openpgm/libpgm-%{version}~dfsg.tar.gz -Patch0001: https://github.com/steve-o/openpgm/commit/ee25ff3d13f2639b4c3a42125e79f77f921c3320.patch - +URL: https://github.com/steve-o/%{name} +Source0: https://github.com/steve-o/%{name}/archive/release-%{version_dash}.tar.gz#/%{name}-%{version}.tar.gz +# All the following patches have been submitted upstream +# as a merge request: https://github.com/steve-o/openpgm/pull/64 +Patch1: openpgm-01-scons.patch +Patch2: openpgm-02-c-func.patch +Patch3: openpgm-03-pkgconfig.patch +Patch4: openpgm-04-py-version-gen.patch BuildRequires: gcc -BuildRequires: python3 +BuildRequires: python3 python3-scons BuildRequires: perl-interpreter @@ -32,14 +36,15 @@ This package contains OpenPGM related development libraries and header files. %prep -%autosetup -n libpgm-%{version}~dfsg/openpgm/pgm -p3 - -sed -i "s:#!/usr/bin/python:#!/usr/bin/python3:" version_generator.py - +%setup -q -n %{name}-release-%{version_dash}/openpgm/pgm +%patch1 -p3 +%patch2 -p3 +%patch3 -p3 +%patch4 -p3 %build -%configure -make %{_smp_mflags} +scons-3 +#make %%{_smp_mflags} %install rm -rf %{buildroot} @@ -61,76 +66,6 @@ rm %{buildroot}%{_libdir}/libpgm.{a,la} %changelog -* Sat Oct 26 2019 Denis Arnaud - 5.2.122-18 -- Updated the source URL and Python to Python 3 - -* Thu Jul 25 2019 Fedora Release Engineering - 5.2.122-17 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Fri Feb 01 2019 Fedora Release Engineering - 5.2.122-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Wed Jan 23 2019 Elliott Sales de Andrade - 5.2.122-15 -- Remove non-existent directory from pkgconfig file - -* Wed Sep 19 2018 Randy Barlow - 5.2.122-14 -- Use python2 explicitly (#1605329). -- Remove unnecessary calls to ldconfig. - -* Fri Jul 13 2018 Fedora Release Engineering - 5.2.122-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Mon Mar 19 2018 Iryna Shcherbina - 5.2.122-12 -- Update Python 2 dependency declarations to new packaging standards - (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) - -* Thu Feb 08 2018 Fedora Release Engineering - 5.2.122-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Thu Aug 03 2017 Fedora Release Engineering - 5.2.122-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Thu Jul 27 2017 Fedora Release Engineering - 5.2.122-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Sat Feb 18 2017 Jose Pedro Oliveira - 5.2.122-8 -- Add perl to the build requirements list (required by galois_generator.pl) - -* Sat Feb 11 2017 Fedora Release Engineering - 5.2.122-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Thu Feb 04 2016 Fedora Release Engineering - 5.2.122-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Thu Jun 18 2015 Fedora Release Engineering - 5.2.122-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Sun Aug 17 2014 Fedora Release Engineering - 5.2.122-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - -* Sat Jun 07 2014 Fedora Release Engineering - 5.2.122-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Sat Aug 03 2013 Fedora Release Engineering - 5.2.122-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Wed May 15 2013 Jose Pedro Oliveira - 5.2.122-1 -- Update to 5.2.122 - -* Thu Feb 14 2013 Fedora Release Engineering - 5.1.118-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Fri Dec 21 2012 Jose Pedro Oliveira - 5.1.118-3 -- Build requires python (no longer available by default in F18+ buildroots) - -* Fri Dec 21 2012 Jose Pedro Oliveira - 5.1.118-2 -- Renamed the tarball (replaced '%7E' by '~') -- Removed the defattr lines - -* Wed Dec 19 2012 Jose Pedro Oliveira - 5.1.118-1 -- Change license from LGPLv2.1 to LGPLv2 (867182#c13) - -* Tue Dec 18 2012 Jose Pedro Oliveira - 5.1.118-0 -- First Fedora specfile +* Tue Oct 29 2019 Denis Arnaud - 5.2.122-1 +- First build on EPEL 8 -# vim:set ai ts=4 sw=4 sts=4 et: diff --git a/sources b/sources index 4ecad4e..ba3ae1d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a4a4ad05678c360f44cd90a6e5dbd391 libpgm-5.2.122~dfsg.tar.gz +SHA512 (openpgm-5.2.122.tar.gz) = f8b29fb69acb548536179262665c0cdcc8bb1510d3e970d6abebaf33e301f87fbfa7e2c46e387973d8b65470350af66b3130482269b9fbb15fe7bf98b52f6404